OSDN Git Service

Adjusted QAAC detection for shared 'libsoxrate' library.
authorlordmulder <mulder2@gmx.de>
Tue, 22 Nov 2011 22:48:54 +0000 (23:48 +0100)
committerlordmulder <mulder2@gmx.de>
Tue, 22 Nov 2011 22:48:54 +0000 (23:48 +0100)
src/Config.h
src/Dialog_MainWindow.cpp
src/Dialog_Processing.cpp
src/Encoder_AAC_QAAC.cpp
src/Encoder_AAC_QAAC.h
src/Model_Settings.cpp
src/Thread_Initialization.cpp

index 02af1f7..47e89fe 100644 (file)
@@ -30,7 +30,7 @@
 #define VER_LAMEXP_MINOR_LO                                    4
 #define VER_LAMEXP_TYPE                                                Alpha
 #define VER_LAMEXP_PATCH                                       2
-#define VER_LAMEXP_BUILD                                       785
+#define VER_LAMEXP_BUILD                                       786
 
 ///////////////////////////////////////////////////////////////////////////////
 // Tool versions (minimum expected versions!)
index 745d9c5..5701755 100644 (file)
@@ -90,7 +90,7 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
        m_settings(settingsModel),
        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_qaacEncoderAvailable(lamexp_check_tool("qaac.exe")),
+       m_qaacEncoderAvailable(lamexp_check_tool("qaac.exe") && lamexp_check_tool("libsoxrate.dll")),
        m_accepted(false),
        m_firstTimeShown(true),
        m_OutputFolderViewInitialized(false)
index 26f52a4..7eb6f35 100644 (file)
@@ -661,7 +661,7 @@ void ProcessingDialog::startNextJob(void)
                break;
        case SettingsModel::AACEncoder:
                {
-                       if(lamexp_check_tool("qaac.exe"))
+                       if(lamexp_check_tool("qaac.exe") && lamexp_check_tool("libsoxrate.dll"))
                        {
                                QAACEncoder *aacEncoder = new QAACEncoder();
                                aacEncoder->setBitrate(m_settings->compressionBitrate());
index a30377c..9a69b66 100644 (file)
 
 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!";
        }
index 2d990e2..ca52c0c 100644 (file)
@@ -42,5 +42,6 @@ public:
 
 private:
        const QString m_binary_enc;
+       const QString m_binary_dll;
        int m_configProfile;
 };
index e660c17..7094f9a 100644 (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("qaac.exe"))
+                       if(!(lamexp_check_tool("qaac.exe") && lamexp_check_tool("libsoxrate.dll")))
                        {
                                if(this->compressionEncoder() == SettingsModel::AACEncoder)
                                {
index 9c3f9e1..f359dd7 100644 (file)
@@ -485,9 +485,12 @@ void InitializationThread::initQAac(void)
 {
        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)
@@ -496,16 +499,21 @@ void InitializationThread::initQAac(void)
                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;
        }
@@ -513,7 +521,7 @@ void InitializationThread::initQAac(void)
        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())
        {
@@ -521,7 +529,7 @@ void InitializationThread::initQAac(void)
                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;
        }
 
@@ -538,7 +546,7 @@ void InitializationThread::initQAac(void)
                        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)
@@ -577,30 +585,31 @@ void InitializationThread::initQAac(void)
        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)