Detect Nero AAC encoder binary at runtime
This commit is contained in:
parent
88eae834d2
commit
cd83ebd5d6
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>676</width>
|
||||
<height>550</height>
|
||||
<height>459</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -503,7 +503,7 @@
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Automatically generate playlist (.m3u)</string>
|
||||
<string>Automatically generate playlist file (.m3u)</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
@ -545,70 +545,284 @@
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>75</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../res/Images.qrc">:/images/Construction.gif</pixmap>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
<property name="title">
|
||||
<string> Encoder / Format </string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="1">
|
||||
<widget class="QRadioButton" name="radioButtonEncoderMP3">
|
||||
<property name="text">
|
||||
<string>Lame MP3</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QRadioButton" name="radioButtonEncoderVorbis">
|
||||
<property name="text">
|
||||
<string>Ogg Vorbis</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QRadioButton" name="radioButtonEncoderAAC">
|
||||
<property name="text">
|
||||
<string>Nero AAC</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="5">
|
||||
<widget class="QRadioButton" name="radioButtonEncoderPCM">
|
||||
<property name="text">
|
||||
<string>Wave (PCM)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<widget class="QRadioButton" name="radioButtonEncoderFLAC">
|
||||
<property name="text">
|
||||
<string>FLAC</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<spacer name="horizontalSpacer_7">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<spacer name="horizontalSpacer_8">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_4">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
<width>0</width>
|
||||
<height>75</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<spacer name="horizontalSpacer_9">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<property name="title">
|
||||
<string> Rate Control Method </string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_13">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_12">
|
||||
<item row="0" column="1">
|
||||
<widget class="QRadioButton" name="radioButtonModeQuality">
|
||||
<property name="text">
|
||||
<string>Quality-based (VBR)</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QRadioButton" name="radioButtonModeAverageBitrate">
|
||||
<property name="text">
|
||||
<string>Average Bitrate (ABR)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QRadioButton" name="radioButtonConstBitrate">
|
||||
<property name="text">
|
||||
<string>Constant Bitrate (CBR)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<spacer name="horizontalSpacer_8">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
<width>0</width>
|
||||
<height>100</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
<property name="title">
|
||||
<string> Quality / Bitrate </string>
|
||||
</property>
|
||||
</spacer>
|
||||
<layout class="QGridLayout" name="gridLayout_15">
|
||||
<item row="0" column="2">
|
||||
<layout class="QGridLayout" name="gridLayout_14">
|
||||
<item row="1" column="2" colspan="3">
|
||||
<widget class="QSlider" name="sliderBitrate">
|
||||
<property name="minimum">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>50</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>24</number>
|
||||
</property>
|
||||
<property name="tracking">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="invertedAppearance">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="tickPosition">
|
||||
<enum>QSlider::TicksBelow</enum>
|
||||
</property>
|
||||
<property name="tickInterval">
|
||||
<number>5</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Minimum</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="4">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Maximum</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="3">
|
||||
<widget class="QLabel" name="labelBitrate">
|
||||
<property name="text">
|
||||
<string>(VALUE)</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignHCenter|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>8</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<spacer name="horizontalSpacer_9">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="5">
|
||||
<spacer name="horizontalSpacer_10">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<spacer name="verticalSpacer_4">
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
@ -637,6 +851,9 @@
|
||||
<layout class="QGridLayout" name="gridLayout_7">
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="cursor">
|
||||
<cursorShape>ForbiddenCursor</cursorShape>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
@ -647,7 +864,7 @@
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../res/Images.qrc">:/images/Construction.gif</pixmap>
|
||||
<pixmap resource="../res/Images.qrc">:/images/Cogwheels.png</pixmap>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
@ -1052,6 +1269,26 @@
|
||||
<include location="../res/Images.qrc"/>
|
||||
<include location="../res/Icons.qrc"/>
|
||||
<include location="../res/Images.qrc"/>
|
||||
<include location="../res/Icons.qrc"/>
|
||||
<include location="../res/Images.qrc"/>
|
||||
<include location="../res/Icons.qrc"/>
|
||||
<include location="../res/Images.qrc"/>
|
||||
<include location="../res/Icons.qrc"/>
|
||||
<include location="../res/Images.qrc"/>
|
||||
<include location="../res/Icons.qrc"/>
|
||||
<include location="../res/Images.qrc"/>
|
||||
<include location="../res/Icons.qrc"/>
|
||||
<include location="../res/Images.qrc"/>
|
||||
<include location="../res/Icons.qrc"/>
|
||||
<include location="../res/Images.qrc"/>
|
||||
<include location="../res/Icons.qrc"/>
|
||||
<include location="../res/Images.qrc"/>
|
||||
<include location="../res/Icons.qrc"/>
|
||||
<include location="../res/Images.qrc"/>
|
||||
<include location="../res/Icons.qrc"/>
|
||||
<include location="../res/Images.qrc"/>
|
||||
<include location="../res/Icons.qrc"/>
|
||||
<include location="../res/Images.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
|
@ -3,12 +3,13 @@
|
||||
<qresource>
|
||||
<file>images/Busy.gif</file>
|
||||
<file>images/HeaderIcon_MetaInfo.png</file>
|
||||
<file>images/Label.png</file>
|
||||
<file>images/Loading.gif</file>
|
||||
<file>images/Logo.png</file>
|
||||
<file>images/Splash.png</file>
|
||||
<file>images/Thumb.png</file>
|
||||
<file>images/Label.png</file>
|
||||
<file>images/Loading.gif</file>
|
||||
<file>images/Logo.png</file>
|
||||
<file>images/Splash.png</file>
|
||||
<file>images/Thumb.png</file>
|
||||
<file>images/Construction.gif</file>
|
||||
<file>images/Cogwheels.png</file>
|
||||
<file>images/Qt.svg</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
BIN
res/images/Cogwheels.png
Normal file
BIN
res/images/Cogwheels.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 172 KiB |
@ -36,6 +36,13 @@
|
||||
//Helper macros
|
||||
#define LINK(URL) QString("<a href=\"%1\">%2</a>").arg(URL).arg(URL)
|
||||
|
||||
//Constants
|
||||
const char *AboutDialog::neroAacUrl = "http://www.nero.com/eng/technologies-aac-codec.html";
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Constructor
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
AboutDialog::AboutDialog(QWidget *parent)
|
||||
: QMessageBox(parent)
|
||||
{
|
||||
@ -83,6 +90,10 @@ AboutDialog::~AboutDialog(void)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Public Functions
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
int AboutDialog::exec()
|
||||
{
|
||||
PlaySound(MAKEINTRESOURCE(IDR_WAVE_ABOUT), GetModuleHandle(NULL), SND_RESOURCE | SND_ASYNC);
|
||||
@ -105,30 +116,32 @@ int AboutDialog::exec()
|
||||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Private Functions
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
void AboutDialog::showMoreAbout()
|
||||
{
|
||||
const QString li("<li style=\"margin-left:-25px\">");
|
||||
|
||||
QString moreAboutText;
|
||||
moreAboutText += "<h3>The following third-party software is used in LameXP:</h3>";
|
||||
moreAboutText += "<ul>";
|
||||
moreAboutText += li + "<b>LAME - OpenSource mp3 Encoder</b><br>";
|
||||
moreAboutText += "<div style=\"margin-left:-25px\"><ul>";
|
||||
moreAboutText += "<li><b>LAME - OpenSource mp3 Encoder</b><br>";
|
||||
moreAboutText += "Released under the terms of the GNU Leser General Public License.<br>";
|
||||
moreAboutText += LINK("http://lame.sourceforge.net/");
|
||||
moreAboutText += "<br>";
|
||||
moreAboutText += li + "<b>OggEnc - Ogg Vorbis Encoder</b>";
|
||||
moreAboutText += "<li><b>OggEnc - Ogg Vorbis Encoder</b>";
|
||||
moreAboutText += "<br>Completely open and patent-free audio encoding technology.<br>";
|
||||
moreAboutText += LINK("http://www.vorbis.com/");
|
||||
moreAboutText += "<br>";
|
||||
moreAboutText += li + "<b>Nero AAC reference MPEG-4 Encoder</b><br>";
|
||||
moreAboutText += "<li><b>Nero AAC reference MPEG-4 Encoder</b><br>";
|
||||
moreAboutText += "Freeware state-of-the-art HE-AAC encoder with 2-Pass support.<br>";
|
||||
moreAboutText += "(Available from vendor web-site as free download)<br>";
|
||||
moreAboutText += LINK("http://www.nero.com/eng/technologies-aac-codec.html/");
|
||||
moreAboutText += LINK(neroAacUrl);
|
||||
moreAboutText += "<br>";
|
||||
moreAboutText += li + "<b>MediaInfo - Media File Analysis Tool</b><br>";
|
||||
moreAboutText += "<li><b>MediaInfo - Media File Analysis Tool</b><br>";
|
||||
moreAboutText += "Released under the terms of the GNU Leser General Public License.<br>";
|
||||
moreAboutText += LINK("http://mediainfo.sourceforge.net/");
|
||||
moreAboutText += "<br></ul>";
|
||||
moreAboutText += "<br></ul></div>";
|
||||
|
||||
QMessageBox *moreAboutBox = new QMessageBox(dynamic_cast<QWidget*>(this->parent()));
|
||||
moreAboutBox->setText(moreAboutText);
|
||||
|
@ -30,6 +30,7 @@ public:
|
||||
|
||||
public slots:
|
||||
int exec();
|
||||
static const char *neroAacUrl;
|
||||
|
||||
private:
|
||||
void AboutDialog::showMoreAbout();
|
||||
|
@ -56,9 +56,8 @@ if(m_banner->isVisible() || m_delayedFileTimer->isActive()) \
|
||||
{ \
|
||||
MessageBeep(MB_ICONEXCLAMATION); \
|
||||
return; \
|
||||
} \
|
||||
|
||||
#define LINK(X) ""
|
||||
}
|
||||
#define LINK(URL) QString("<a href=\"%1\">%2</a>").arg(URL).arg(URL)
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Constructor
|
||||
@ -129,6 +128,11 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
connect(buttonEditMeta, SIGNAL(clicked()), this, SLOT(editMetaButtonClicked()));
|
||||
connect(buttonClearMeta, SIGNAL(clicked()), this, SLOT(clearMetaButtonClicked()));
|
||||
|
||||
//Setup "Compression" tab
|
||||
sliderBitrate->setValue(24);
|
||||
connect(sliderBitrate, SIGNAL(valueChanged(int)), this, SLOT(updateBitrate(int)));
|
||||
updateBitrate(sliderBitrate->value());
|
||||
|
||||
//Activate file menu actions
|
||||
connect(actionOpenFolder, SIGNAL(triggered()), this, SLOT(openFolderActionActivated()));
|
||||
|
||||
@ -265,6 +269,23 @@ void MainWindow::windowShown(void)
|
||||
{
|
||||
QStringList arguments = QApplication::arguments();
|
||||
|
||||
//Check for AAC support
|
||||
if(lamexp_check_tool("neroAacEnc.exe") && lamexp_check_tool("neroAacDec.exe") && lamexp_check_tool("neroAacTag.exe"))
|
||||
{
|
||||
radioButtonEncoderAAC->setEnabled(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
QString messageText;
|
||||
messageText += "<nobr>The Nero AAC encoder could not be found. AAC encoding support will be disabled.<br>";
|
||||
messageText += "Please put 'neroAacEnc.exe', 'neroAacDec.exe' and 'neroAacTag.exe' into the LameXP directory!<br><br>";
|
||||
messageText += "You can download the Nero AAC encoder for free from the official Nero web-site at:<br>";
|
||||
messageText += "<b>" + LINK(AboutDialog::neroAacUrl) + "</b><br></nobr>";
|
||||
QMessageBox::information(this, "AAC Support Disabled", messageText);
|
||||
radioButtonEncoderAAC->setEnabled(false);
|
||||
}
|
||||
|
||||
//Add files from the command-line
|
||||
for(int i = 0; i < arguments.count() - 1; i++)
|
||||
{
|
||||
if(!arguments[i].compare("--add", Qt::CaseInsensitive))
|
||||
@ -659,3 +680,11 @@ void MainWindow::handleDelayedFiles(void)
|
||||
|
||||
addFiles(selectedFiles);
|
||||
}
|
||||
|
||||
/*
|
||||
* Update bitrate
|
||||
*/
|
||||
void MainWindow::updateBitrate(int value)
|
||||
{
|
||||
labelBitrate->setText(QString("%1 kbps").arg(value * 8));
|
||||
}
|
||||
|
@ -66,6 +66,7 @@ private slots:
|
||||
void handleDelayedFiles(void);
|
||||
void editMetaButtonClicked(void);
|
||||
void clearMetaButtonClicked(void);
|
||||
void updateBitrate(int value);
|
||||
|
||||
protected:
|
||||
void showEvent(QShowEvent *event);
|
||||
|
@ -285,8 +285,10 @@ int lamexp_init_ipc(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
g_lamexp_semaphore_read_ptr = new QSystemSemaphore(g_lamexp_semaphore_read_uuid, 0);
|
||||
g_lamexp_semaphore_write_ptr = new QSystemSemaphore(g_lamexp_semaphore_write_uuid, 0);
|
||||
const QString versionTag = QString().sprintf("@%d.%02d.%04d", lamexp_version_major(), lamexp_version_minor(), lamexp_version_build());
|
||||
|
||||
g_lamexp_semaphore_read_ptr = new QSystemSemaphore(QString(g_lamexp_semaphore_read_uuid).append(versionTag), 0);
|
||||
g_lamexp_semaphore_write_ptr = new QSystemSemaphore(QString(g_lamexp_semaphore_write_uuid).append(versionTag), 0);
|
||||
|
||||
if(g_lamexp_semaphore_read_ptr->error() != QSystemSemaphore::NoError)
|
||||
{
|
||||
@ -305,7 +307,7 @@ int lamexp_init_ipc(void)
|
||||
return -1;
|
||||
}
|
||||
|
||||
g_lamexp_sharedmem_ptr = new QSharedMemory(g_lamexp_sharedmem_uuid, NULL);
|
||||
g_lamexp_sharedmem_ptr = new QSharedMemory(QString(g_lamexp_sharedmem_uuid).append(versionTag), NULL);
|
||||
|
||||
if(!g_lamexp_sharedmem_ptr->create(sizeof(lamexp_ipc_t)))
|
||||
{
|
||||
@ -495,20 +497,28 @@ void lamexp_finalization(void)
|
||||
*/
|
||||
void lamexp_register_tool(const QString &toolName, LockedFile *file)
|
||||
{
|
||||
if(g_lamexp_tool_registry.contains(toolName))
|
||||
if(g_lamexp_tool_registry.contains(toolName.toLower()))
|
||||
{
|
||||
throw "lamexp_register_tool: Tool is already registered!";
|
||||
}
|
||||
|
||||
g_lamexp_tool_registry.insert(toolName, file);
|
||||
g_lamexp_tool_registry.insert(toolName.toLower(), file);
|
||||
}
|
||||
|
||||
/*
|
||||
* Register tool
|
||||
* Check for tool
|
||||
*/
|
||||
bool lamexp_check_tool(const QString &toolName)
|
||||
{
|
||||
return g_lamexp_tool_registry.contains(toolName.toLower());
|
||||
}
|
||||
|
||||
/*
|
||||
* Lookup tool
|
||||
*/
|
||||
const QString lamexp_lookup_tool(const QString &toolName)
|
||||
{
|
||||
if(g_lamexp_tool_registry.contains(toolName))
|
||||
if(g_lamexp_tool_registry.contains(toolName.toLower()))
|
||||
{
|
||||
return g_lamexp_tool_registry.value(toolName)->filePath();
|
||||
}
|
||||
|
@ -49,6 +49,7 @@ void lamexp_init_console(int argc, char* argv[]);
|
||||
bool lamexp_init_qt(int argc, char* argv[]);
|
||||
int lamexp_init_ipc(void);
|
||||
void lamexp_register_tool(const QString &toolName, LockedFile *file);
|
||||
bool lamexp_check_tool(const QString &toolName);
|
||||
const QString lamexp_lookup_tool(const QString &toolName);
|
||||
void lamexp_finalization(void);
|
||||
const QString &lamexp_temp_folder(void);
|
||||
|
@ -44,16 +44,16 @@ LockedFile::LockedFile(const QString &resourcePath, const QString &outPath, cons
|
||||
if(outFile.write(reinterpret_cast<const char*>(resource.data()), resource.size()) != resource.size())
|
||||
{
|
||||
QFile::remove(QFileInfo(outFile).absoluteFilePath());
|
||||
char error_msg[256];
|
||||
strcpy_s(error_msg, 256, QString("File '%1' could not be written!").arg(QFileInfo(outFile).fileName()).toUtf8().constData());
|
||||
char error_msg[512];
|
||||
strcpy_s(error_msg, 512, QString("File '%1' could not be written!").arg(QFileInfo(outFile).fileName()).toUtf8().constData());
|
||||
throw error_msg;
|
||||
}
|
||||
outFile.close();
|
||||
}
|
||||
else
|
||||
{
|
||||
char error_msg[256];
|
||||
strcpy_s(error_msg, 256, QString("File '%1' could not be created!").arg(QFileInfo(outFile).fileName()).toUtf8().constData());
|
||||
char error_msg[512];
|
||||
strcpy_s(error_msg, 512, QString("File '%1' could not be created!").arg(QFileInfo(outFile).fileName()).toUtf8().constData());
|
||||
throw error_msg;
|
||||
}
|
||||
|
||||
@ -63,8 +63,8 @@ LockedFile::LockedFile(const QString &resourcePath, const QString &outPath, cons
|
||||
if(m_fileHandle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
QFile::remove(QFileInfo(outFile).absoluteFilePath());
|
||||
char error_msg[256];
|
||||
strcpy_s(error_msg, 256, QString("File '%1' could not be locked!").arg(QFileInfo(outFile).fileName()).toLatin1().constData());
|
||||
char error_msg[512];
|
||||
strcpy_s(error_msg, 512, QString("File '%1' could not be locked!").arg(QFileInfo(outFile).fileName()).toLatin1().constData());
|
||||
throw error_msg;
|
||||
}
|
||||
|
||||
@ -82,8 +82,31 @@ LockedFile::LockedFile(const QString &resourcePath, const QString &outPath, cons
|
||||
qWarning("\nFile checksum error:\n Expected = %040s\n Detected = %040s\n", expectedHash.constData(), fileHash.result().toHex().constData());
|
||||
LAMEXP_CLOSE(m_fileHandle);
|
||||
QFile::remove(QFileInfo(outFile).absoluteFilePath());
|
||||
char error_msg[512];
|
||||
strcpy_s(error_msg, 512, QString("File '%1' is corruputed, take care!").arg(QFileInfo(outFile).fileName()).toLatin1().constData());
|
||||
throw error_msg;
|
||||
}
|
||||
}
|
||||
|
||||
LockedFile::LockedFile(const QString &filePath)
|
||||
{
|
||||
m_fileHandle = NULL;
|
||||
QFileInfo existingFile(filePath);
|
||||
|
||||
if(!existingFile.exists())
|
||||
{
|
||||
char error_msg[256];
|
||||
strcpy_s(error_msg, 256, QString("File '%1' is corruputed, take care!").arg(QFileInfo(outFile).fileName()).toLatin1().constData());
|
||||
strcpy_s(error_msg, 256, QString("File '%1' does not exist!").arg(existingFile.fileName()).toLatin1().constData());
|
||||
throw error_msg;
|
||||
}
|
||||
|
||||
//Now lock the file
|
||||
m_fileHandle = CreateFileW(QWCHAR(QDir::toNativeSeparators(filePath)), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, NULL, NULL);
|
||||
|
||||
if(m_fileHandle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
char error_msg[256];
|
||||
strcpy_s(error_msg, 256, QString("File '%1' could not be locked!").arg(existingFile.fileName()).toLatin1().constData());
|
||||
throw error_msg;
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ class LockedFile
|
||||
{
|
||||
public:
|
||||
LockedFile(const QString &resourcePath, const QString &outPath, const QByteArray &expectedHash = QByteArray());
|
||||
LockedFile(const QString &filePath);
|
||||
~LockedFile(void);
|
||||
|
||||
const QString &filePath();
|
||||
|
@ -24,6 +24,9 @@
|
||||
#include "Global.h"
|
||||
#include "LockedFile.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
#include <QCoreApplication>
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// TOOLS
|
||||
////////////////////////////////////////////////////////////
|
||||
@ -43,7 +46,6 @@ static const struct lamexp_tool_t g_lamexp_tools[] =
|
||||
{"e613a1b56a2187edb4cdf3628a5a3e60de2e8cbc", "lame.exe"},
|
||||
{"775b260b3f64101beaeb317b74746f9bccdab842", "MAC.exe"},
|
||||
{"e770eaa5f2449d0fd6b3f3c02a1f574fc4370b5e", "mediainfo_icl11.exe"},
|
||||
// {"6f57f93b597f143453c6a30ee0bc9d161afe2e4b", "mediainfo_msvc9.exe"},
|
||||
{"55c293a80475f7aeccf449ac9487a4626e5139cb", "mpcdec.exe"},
|
||||
{"8bbf4a3fffe2ff143eb5ba2cf82ca16d676e865d", "mpg123.exe"},
|
||||
{"437a1b193727c3dbdd557b9a58659d1ce7fbec51", "oggdec.exe"},
|
||||
@ -115,6 +117,37 @@ void InitializationThread::run()
|
||||
|
||||
qDebug("All extracted.\n");
|
||||
|
||||
//Look for Nero encoder
|
||||
QFileInfo neroFileInfo[3];
|
||||
neroFileInfo[0] = QFileInfo(QString("%1/neroAacEnc.exe").arg(QCoreApplication::applicationDirPath()));
|
||||
neroFileInfo[1] = QFileInfo(QString("%1/neroAacDec.exe").arg(QCoreApplication::applicationDirPath()));
|
||||
neroFileInfo[2] = QFileInfo(QString("%1/neroAacTag.exe").arg(QCoreApplication::applicationDirPath()));
|
||||
|
||||
bool neroFilesFound = true;
|
||||
for(int i = 0; i < 3; i++) { if(!neroFileInfo[i].exists()) neroFilesFound = false; }
|
||||
|
||||
//Lock the Nero binaries
|
||||
if(neroFilesFound)
|
||||
{
|
||||
qDebug("Found Nero AAC encoder binary:\n%s\n", neroFileInfo[0].absoluteFilePath().toUtf8().constData());
|
||||
LockedFile *neroBin[3];
|
||||
for(int i = 0; i < 3; i++) neroBin[i] = NULL;
|
||||
try
|
||||
{
|
||||
for(int i = 0; i < 3; i++) { neroBin[i] = new LockedFile(neroFileInfo[i].absoluteFilePath()); }
|
||||
for(int i = 0; i < 3; i++) { lamexp_register_tool(neroFileInfo[i].fileName(), neroBin[i]); }
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
for(int i = 0; i < 3; i++) LAMEXP_DELETE(neroBin[i]);
|
||||
qWarning("Failed to lock Nero encoder binary -> AAC encoding support will be disabled!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug("Nero encoder binaries not found -> AAC encoding support will be disabled!\n");
|
||||
}
|
||||
|
||||
delay();
|
||||
m_bSuccess = true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user