Adjusted QAAC detection for shared 'libsoxrate' library.

This commit is contained in:
LoRd_MuldeR 2011-11-22 23:48:54 +01:00
parent 6235115429
commit 6a90dad03f
7 changed files with 31 additions and 20 deletions

View File

@ -30,7 +30,7 @@
#define VER_LAMEXP_MINOR_LO 4 #define VER_LAMEXP_MINOR_LO 4
#define VER_LAMEXP_TYPE Alpha #define VER_LAMEXP_TYPE Alpha
#define VER_LAMEXP_PATCH 2 #define VER_LAMEXP_PATCH 2
#define VER_LAMEXP_BUILD 785 #define VER_LAMEXP_BUILD 786
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Tool versions (minimum expected versions!) // Tool versions (minimum expected versions!)

View File

@ -90,7 +90,7 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
m_settings(settingsModel), m_settings(settingsModel),
m_neroEncoderAvailable(lamexp_check_tool("neroAacEnc.exe") && lamexp_check_tool("neroAacDec.exe") && lamexp_check_tool("neroAacTag.exe")), m_neroEncoderAvailable(lamexp_check_tool("neroAacEnc.exe") && lamexp_check_tool("neroAacDec.exe") && lamexp_check_tool("neroAacTag.exe")),
m_fhgEncoderAvailable(lamexp_check_tool("fhgaacenc.exe") && lamexp_check_tool("enc_fhgaac.dll") && lamexp_check_tool("nsutil.dll") && lamexp_check_tool("libmp4v2.dll")), m_fhgEncoderAvailable(lamexp_check_tool("fhgaacenc.exe") && lamexp_check_tool("enc_fhgaac.dll") && lamexp_check_tool("nsutil.dll") && lamexp_check_tool("libmp4v2.dll")),
m_qaacEncoderAvailable(lamexp_check_tool("qaac.exe")), m_qaacEncoderAvailable(lamexp_check_tool("qaac.exe") && lamexp_check_tool("libsoxrate.dll")),
m_accepted(false), m_accepted(false),
m_firstTimeShown(true), m_firstTimeShown(true),
m_OutputFolderViewInitialized(false) m_OutputFolderViewInitialized(false)

View File

@ -661,7 +661,7 @@ void ProcessingDialog::startNextJob(void)
break; break;
case SettingsModel::AACEncoder: case SettingsModel::AACEncoder:
{ {
if(lamexp_check_tool("qaac.exe")) if(lamexp_check_tool("qaac.exe") && lamexp_check_tool("libsoxrate.dll"))
{ {
QAACEncoder *aacEncoder = new QAACEncoder(); QAACEncoder *aacEncoder = new QAACEncoder();
aacEncoder->setBitrate(m_settings->compressionBitrate()); aacEncoder->setBitrate(m_settings->compressionBitrate());

View File

@ -31,9 +31,10 @@
QAACEncoder::QAACEncoder(void) QAACEncoder::QAACEncoder(void)
: :
m_binary_enc(lamexp_lookup_tool("qaac.exe")) m_binary_enc(lamexp_lookup_tool("qaac.exe")),
m_binary_dll(lamexp_lookup_tool("libsoxrate.dll"))
{ {
if(m_binary_enc.isEmpty()) if(m_binary_enc.isEmpty() || m_binary_dll.isEmpty())
{ {
throw "Error initializing QAAC. Tool 'qaac.exe' is not registred!"; throw "Error initializing QAAC. Tool 'qaac.exe' is not registred!";
} }

View File

@ -42,5 +42,6 @@ public:
private: private:
const QString m_binary_enc; const QString m_binary_enc;
const QString m_binary_dll;
int m_configProfile; int m_configProfile;
}; };

View File

@ -222,7 +222,7 @@ void SettingsModel::validate(void)
{ {
if(!(lamexp_check_tool("fhgaacenc.exe") && lamexp_check_tool("enc_fhgaac.dll"))) if(!(lamexp_check_tool("fhgaacenc.exe") && lamexp_check_tool("enc_fhgaac.dll")))
{ {
if(!lamexp_check_tool("qaac.exe")) if(!(lamexp_check_tool("qaac.exe") && lamexp_check_tool("libsoxrate.dll")))
{ {
if(this->compressionEncoder() == SettingsModel::AACEncoder) if(this->compressionEncoder() == SettingsModel::AACEncoder)
{ {

View File

@ -485,9 +485,12 @@ void InitializationThread::initQAac(void)
{ {
const QString appPath = QDir(QCoreApplication::applicationDirPath()).canonicalPath(); const QString appPath = QDir(QCoreApplication::applicationDirPath()).canonicalPath();
QFileInfo qaacFileInfo[2];
qaacFileInfo[0] = QFileInfo(QString("%1/qaac.exe").arg(appPath));
qaacFileInfo[1] = QFileInfo(QString("%1/libsoxrate.dll").arg(appPath));
bool qaacFilesFound = true; bool qaacFilesFound = true;
QFileInfo qaacFileInfo(QString("%1/qaac.exe").arg(appPath)); for(int i = 0; i < 4; i++) { if(!qaacFileInfo[i].exists()) qaacFilesFound = false; }
if(!qaacFileInfo.exists()) qaacFilesFound = false;
//Lock the QAAC binaries //Lock the QAAC binaries
if(!qaacFilesFound) if(!qaacFilesFound)
@ -496,16 +499,21 @@ void InitializationThread::initQAac(void)
return; return;
} }
qDebug("Found QAAC encoder:\n%s\n", qaacFileInfo.canonicalFilePath().toUtf8().constData()); qDebug("Found QAAC encoder:\n%s\n", qaacFileInfo[0].canonicalFilePath().toUtf8().constData());
LockedFile *qaacBin = NULL;
LockedFile *qaacBin[2];
for(int i = 0; i < 2; i++) qaacBin[i] = NULL;
try try
{ {
qaacBin = new LockedFile(qaacFileInfo.canonicalFilePath()); for(int i = 0; i < 2; i++)
{
qaacBin[i] = new LockedFile(qaacFileInfo[i].canonicalFilePath());
}
} }
catch(...) catch(...)
{ {
LAMEXP_DELETE(qaacBin); for(int i = 0; i < 2; i++) LAMEXP_DELETE(qaacBin[i]);
qWarning("Failed to get excluive lock to QAAC binary -> QAAC support will be disabled!"); qWarning("Failed to get excluive lock to QAAC binary -> QAAC support will be disabled!");
return; return;
} }
@ -513,7 +521,7 @@ void InitializationThread::initQAac(void)
QProcess process; QProcess process;
process.setProcessChannelMode(QProcess::MergedChannels); process.setProcessChannelMode(QProcess::MergedChannels);
process.setReadChannel(QProcess::StandardOutput); process.setReadChannel(QProcess::StandardOutput);
process.start(qaacFileInfo.canonicalFilePath(), QStringList() << "--check"); process.start(qaacFileInfo[0].canonicalFilePath(), QStringList() << "--check");
if(!process.waitForStarted()) if(!process.waitForStarted())
{ {
@ -521,7 +529,7 @@ void InitializationThread::initQAac(void)
qWarning("Error message: \"%s\"\n", process.errorString().toLatin1().constData()); qWarning("Error message: \"%s\"\n", process.errorString().toLatin1().constData());
process.kill(); process.kill();
process.waitForFinished(-1); process.waitForFinished(-1);
LAMEXP_DELETE(qaacBin); for(int i = 0; i < 2; i++) LAMEXP_DELETE(qaacBin[i]);
return; return;
} }
@ -538,7 +546,7 @@ void InitializationThread::initQAac(void)
qWarning("QAAC process time out -> killing!"); qWarning("QAAC process time out -> killing!");
process.kill(); process.kill();
process.waitForFinished(-1); process.waitForFinished(-1);
LAMEXP_DELETE(qaacBin); for(int i = 0; i < 2; i++) LAMEXP_DELETE(qaacBin[i]);
return; return;
} }
while(process.bytesAvailable() > 0) while(process.bytesAvailable() > 0)
@ -577,30 +585,31 @@ void InitializationThread::initQAac(void)
if(!(qaacVersion > 0)) if(!(qaacVersion > 0))
{ {
qWarning("QAAC version couldn't be determined -> QAAC support will be disabled!"); qWarning("QAAC version couldn't be determined -> QAAC support will be disabled!");
LAMEXP_DELETE(qaacBin); for(int i = 0; i < 2; i++) LAMEXP_DELETE(qaacBin[i]);
return; return;
} }
else if(qaacVersion < lamexp_toolver_qaacenc()) else if(qaacVersion < lamexp_toolver_qaacenc())
{ {
qWarning("QAAC version is too much outdated (%s) -> QAAC support will be disabled!", lamexp_version2string("v?.??", qaacVersion, "N/A").toLatin1().constData()); qWarning("QAAC version is too much outdated (%s) -> QAAC support will be disabled!", lamexp_version2string("v?.??", qaacVersion, "N/A").toLatin1().constData());
LAMEXP_DELETE(qaacBin); for(int i = 0; i < 2; i++) LAMEXP_DELETE(qaacBin[i]);
return; return;
} }
if(!(coreVersion > 0)) if(!(coreVersion > 0))
{ {
qWarning("CoreAudioToolbox version couldn't be determined -> QAAC support will be disabled!"); qWarning("CoreAudioToolbox version couldn't be determined -> QAAC support will be disabled!");
LAMEXP_DELETE(qaacBin); for(int i = 0; i < 2; i++) LAMEXP_DELETE(qaacBin[i]);
return; return;
} }
else if(coreVersion < lamexp_toolver_coreaudio()) else if(coreVersion < lamexp_toolver_coreaudio())
{ {
qWarning("CoreAudioToolbox version is too much outdated (%s) -> QAAC support will be disabled!", lamexp_version2string("v?.?.?.?", coreVersion, "N/A").toLatin1().constData()); qWarning("CoreAudioToolbox version is too much outdated (%s) -> QAAC support will be disabled!", lamexp_version2string("v?.?.?.?", coreVersion, "N/A").toLatin1().constData());
LAMEXP_DELETE(qaacBin); for(int i = 0; i < 2; i++) LAMEXP_DELETE(qaacBin[i]);
return; return;
} }
lamexp_register_tool(qaacFileInfo.fileName(), qaacBin, qaacVersion); lamexp_register_tool(qaacFileInfo[0].fileName(), qaacBin[0], qaacVersion);
lamexp_register_tool(qaacFileInfo[1].fileName(), qaacBin[1], qaacVersion);
} }
void InitializationThread::selfTest(void) void InitializationThread::selfTest(void)