{
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;
- QFileInfo qaacFileInfo(QString("%1/qaac.exe").arg(appPath));
- if(!qaacFileInfo.exists()) qaacFilesFound = false;
+ for(int i = 0; i < 4; i++) { if(!qaacFileInfo[i].exists()) qaacFilesFound = false; }
//Lock the QAAC binaries
if(!qaacFilesFound)
return;
}
- qDebug("Found QAAC encoder:\n%s\n", qaacFileInfo.canonicalFilePath().toUtf8().constData());
- LockedFile *qaacBin = NULL;
+ qDebug("Found QAAC encoder:\n%s\n", qaacFileInfo[0].canonicalFilePath().toUtf8().constData());
+
+ LockedFile *qaacBin[2];
+ for(int i = 0; i < 2; i++) qaacBin[i] = NULL;
try
{
- qaacBin = new LockedFile(qaacFileInfo.canonicalFilePath());
+ for(int i = 0; i < 2; i++)
+ {
+ qaacBin[i] = new LockedFile(qaacFileInfo[i].canonicalFilePath());
+ }
}
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!");
return;
}
QProcess process;
process.setProcessChannelMode(QProcess::MergedChannels);
process.setReadChannel(QProcess::StandardOutput);
- process.start(qaacFileInfo.canonicalFilePath(), QStringList() << "--check");
+ process.start(qaacFileInfo[0].canonicalFilePath(), QStringList() << "--check");
if(!process.waitForStarted())
{
qWarning("Error message: \"%s\"\n", process.errorString().toLatin1().constData());
process.kill();
process.waitForFinished(-1);
- LAMEXP_DELETE(qaacBin);
+ for(int i = 0; i < 2; i++) LAMEXP_DELETE(qaacBin[i]);
return;
}
qWarning("QAAC process time out -> killing!");
process.kill();
process.waitForFinished(-1);
- LAMEXP_DELETE(qaacBin);
+ for(int i = 0; i < 2; i++) LAMEXP_DELETE(qaacBin[i]);
return;
}
while(process.bytesAvailable() > 0)
if(!(qaacVersion > 0))
{
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;
}
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());
- LAMEXP_DELETE(qaacBin);
+ for(int i = 0; i < 2; i++) LAMEXP_DELETE(qaacBin[i]);
return;
}
if(!(coreVersion > 0))
{
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;
}
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());
- LAMEXP_DELETE(qaacBin);
+ for(int i = 0; i < 2; i++) LAMEXP_DELETE(qaacBin[i]);
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)