From 7aea8ce0630226c7194d2e9ec75dccfe25121aeb Mon Sep 17 00:00:00 2001 From: LoRd_MuldeR Date: Sun, 19 Jan 2014 17:19:01 +0100 Subject: [PATCH] Updated the QAAC add-in for LameXP to QAAC v2.33 (2014-01-14), compiled with MSVC 12.0. --- doc/Changelog.html | 1 + doc/FAQ.html | 6 ++- doc/Manual.html | 3 ++ src/Config.h | 8 ++-- src/Global.h | 1 + src/Global_Win32.cpp | 14 +++++++ src/Thread_Initialization.cpp | 72 ++++++++++++++++++++++++++--------- 7 files changed, 82 insertions(+), 23 deletions(-) diff --git a/doc/Changelog.html b/doc/Changelog.html index 25fe5ed6..849ecc5b 100644 --- a/doc/Changelog.html +++ b/doc/Changelog.html @@ -33,6 +33,7 @@ a:visited { color: #0000EE; }
  • Updated MediaInfo to v0.7.67 (2014-01-10), compiled with ICL 14.0 and MSVC 12.0
  • Updated GNU Wget binary to v1.14.0 (2012-08-05), compiled with GCC 4.8.1
  • Updated GnuPG to v1.4.16 (2013-12-13), compiled with GCC 4.8.1 +
  • Updated the QAAC add-in for LameXP to QAAC v2.33 (2014-01-14), compiled with MSVC 12.0
  • Fixed a resource (file descriptor) leak in "static" builds, didn't cause much harm though
  • Various bugfixes and code improvements
    diff --git a/doc/FAQ.html b/doc/FAQ.html index 5b64689c..250b5449 100644 --- a/doc/FAQ.html +++ b/doc/FAQ.html @@ -504,8 +504,9 @@ QAAC encoder, then you have to install QuickTime v7.7.1 (or newer). Alternativel be installed. Both, QuickTime and iTunes, can be downloaded for free from the official Apple web-site.

    In order to enable the QAAC Encoder support you will also need the 'QAAC Encoder Add-in' for LameXP:
    +
  • http://www.mediafire.com/download/38nv297501obvwv/LameXP.qaac-addin.2014-01-19.zip +
  • http://sf.net/projects/lamexp/files/Miscellaneous/Add-ins/qaac/LameXP.qaac-addin.2014-01-19.zip +
  • http://muldersoft.com/misc/lamexp/add-ins/LameXP.qaac-addin.2014-01-19.zip
    Please follow the install instructions that are included with the 'QAAC Encoder Add-in' download package!
    Note that you do NOT need to install this Add-in, if you only want to use the Nero AAC Encoder.
    @@ -521,6 +522,7 @@ available as a free download (you don't need to buy the "Pro" version!) from the
    In order to enable the FHG AAC Encoder support you will also need the 'FHG AAC Encoder Add-in' for LameXP:

    Please follow the install instructions that are included with the 'FHG AAC Encoder Add-in' download package!
    diff --git a/doc/Manual.html b/doc/Manual.html index 840493f7..6c9b5897 100644 --- a/doc/Manual.html +++ b/doc/Manual.html @@ -27,5 +27,8 @@ Sorry, there is no LameXP user manual (yet), but we have an extensive F.A.Q. document, it will probably answer your question...


    +Note: If you are willing to contribute an in-depth LameXP manual, then please contact us!
    +
    +
    eof diff --git a/src/Config.h b/src/Config.h index 79e3989e..52ac9771 100644 --- a/src/Config.h +++ b/src/Config.h @@ -34,8 +34,8 @@ #define VER_LAMEXP_MINOR_HI 0 #define VER_LAMEXP_MINOR_LO 9 #define VER_LAMEXP_TYPE RC -#define VER_LAMEXP_PATCH 1 -#define VER_LAMEXP_BUILD 1519 +#define VER_LAMEXP_PATCH 2 +#define VER_LAMEXP_BUILD 1520 #define VER_LAMEXP_CONFG 1348 /////////////////////////////////////////////////////////////////////////////// @@ -51,8 +51,8 @@ #define VER_LAMEXP_TOOL_NEROAAC 1540 #define VER_LAMEXP_TOOL_FHGAACENC 20120806 -#define VER_LAMEXP_TOOL_QAAC 139 -#define VER_LAMEXP_TOOL_COREAUDIO 7710 +#define VER_LAMEXP_TOOL_QAAC 233 +#define VER_LAMEXP_TOOL_COREAUDIO 7900 /////////////////////////////////////////////////////////////////////////////// // Helper macros (aka: having fun with the C pre-processor) diff --git a/src/Global.h b/src/Global.h index ac519478..da262127 100644 --- a/src/Global.h +++ b/src/Global.h @@ -186,6 +186,7 @@ bool lamexp_install_translator_from_file(const QString &qmFile); void lamexp_invalid_param_handler(const wchar_t*, const wchar_t*, const wchar_t*, unsigned int, uintptr_t); void lamexp_ipc_read(unsigned int *command, char* message, size_t buffSize); void lamexp_ipc_send(unsigned int command, const char* message); +bool lamexp_is_executable(const QString &path); bool lamexp_is_hibernation_supported(void); const QString &lamexp_known_folder(lamexp_known_folder_t folder_id); const QString lamexp_lookup_tool(const QString &toolName); diff --git a/src/Global_Win32.cpp b/src/Global_Win32.cpp index 10735060..a66ee50b 100644 --- a/src/Global_Win32.cpp +++ b/src/Global_Win32.cpp @@ -2253,6 +2253,20 @@ bool lamexp_user_is_admin(void) return isAdmin; } +/* + * Check if file is a valid Win32/Win64 executable + */ +bool lamexp_is_executable(const QString &path) +{ + bool bIsExecutable = false; + DWORD binaryType; + if(GetBinaryType(QWCHAR(QDir::toNativeSeparators(path)), &binaryType)) + { + bIsExecutable = (binaryType == SCS_32BIT_BINARY || binaryType == SCS_64BIT_BINARY); + } + return bIsExecutable; +} + /* * Fatal application exit */ diff --git a/src/Thread_Initialization.cpp b/src/Thread_Initialization.cpp index 08dd4bbf..e49b6478 100644 --- a/src/Thread_Initialization.cpp +++ b/src/Thread_Initialization.cpp @@ -546,15 +546,24 @@ void InitializationThread::initNeroAac(void) bool neroFilesFound = true; for(int i = 0; i < 3; i++) { if(!neroFileInfo[i].exists()) neroFilesFound = false; } - //Lock the Nero binaries if(!neroFilesFound) { qDebug("Nero encoder binaries not found -> AAC encoding support will be disabled!\n"); return; } + for(int i = 0; i < 3; i++) + { + if(!lamexp_is_executable(neroFileInfo[i].canonicalFilePath())) + { + qDebug("%s executbale is invalid -> AAC encoding support will be disabled!\n", QUTF8(neroFileInfo[i].fileName())); + return; + } + } + qDebug("Found Nero AAC encoder binary:\n%s\n", QUTF8(neroFileInfo[0].canonicalFilePath())); + //Lock the Nero binaries LockedFile *neroBin[3]; for(int i = 0; i < 3; i++) neroBin[i] = NULL; @@ -651,16 +660,22 @@ void InitializationThread::initFhgAac(void) bool fhgFilesFound = true; for(int i = 0; i < 5; i++) { if(!fhgFileInfo[i].exists()) fhgFilesFound = false; } - //Lock the FhgAacEnc binaries if(!fhgFilesFound) { qDebug("FhgAacEnc binaries not found -> FhgAacEnc support will be disabled!\n"); return; } + if(!lamexp_is_executable(fhgFileInfo[0].canonicalFilePath())) + { + qDebug("FhgAacEnc executbale is invalid -> FhgAacEnc support will be disabled!\n"); + return; + } + qDebug("Found FhgAacEnc cli_exe:\n%s\n", QUTF8(fhgFileInfo[0].canonicalFilePath())); qDebug("Found FhgAacEnc enc_dll:\n%s\n", QUTF8(fhgFileInfo[1].canonicalFilePath())); + //Lock the FhgAacEnc binaries LockedFile *fhgBin[5]; for(int i = 0; i < 5; i++) fhgBin[i] = NULL; @@ -743,35 +758,43 @@ void InitializationThread::initQAac(void) { const QString appPath = QDir(QCoreApplication::applicationDirPath()).canonicalPath(); - QFileInfo qaacFileInfo[2]; + QFileInfo qaacFileInfo[4]; qaacFileInfo[0] = QFileInfo(QString("%1/qaac.exe").arg(appPath)); - qaacFileInfo[1] = QFileInfo(QString("%1/libsoxrate.dll").arg(appPath)); + qaacFileInfo[1] = QFileInfo(QString("%1/libsoxr.dll").arg(appPath)); + qaacFileInfo[2] = QFileInfo(QString("%1/libsoxconvolver.dll").arg(appPath)); + qaacFileInfo[3] = QFileInfo(QString("%1/libgcc_s_sjlj-1.dll").arg(appPath)); bool qaacFilesFound = true; - for(int i = 0; i < 2; i++) { if(!qaacFileInfo[i].exists()) qaacFilesFound = false; } + for(int i = 0; i < 4; i++) { if(!qaacFileInfo[i].exists()) qaacFilesFound = false; } - //Lock the QAAC binaries if(!qaacFilesFound) { - qDebug("QAAC binaries not found -> QAAC support will be disabled!\n"); + qDebug("QAAC binary or companion DLL's not found -> QAAC support will be disabled!\n"); + return; + } + + if(!lamexp_is_executable(qaacFileInfo[0].canonicalFilePath())) + { + qDebug("QAAC executbale is invalid -> QAAC support will be disabled!\n"); return; } qDebug("Found QAAC encoder:\n%s\n", QUTF8(qaacFileInfo[0].canonicalFilePath())); - LockedFile *qaacBin[2]; - for(int i = 0; i < 2; i++) qaacBin[i] = NULL; + //Lock the required QAAC binaries + LockedFile *qaacBin[4]; + for(int i = 0; i < 4; i++) qaacBin[i] = NULL; try { - for(int i = 0; i < 2; i++) + for(int i = 0; i < 4; i++) { qaacBin[i] = new LockedFile(qaacFileInfo[i].canonicalFilePath()); } } catch(...) { - for(int i = 0; i < 2; i++) LAMEXP_DELETE(qaacBin[i]); + for(int i = 0; i < 4; i++) LAMEXP_DELETE(qaacBin[i]); qWarning("Failed to get excluive lock to QAAC binary -> QAAC support will be disabled!"); return; } @@ -787,14 +810,19 @@ void InitializationThread::initQAac(void) qWarning("Error message: \"%s\"\n", process.errorString().toLatin1().constData()); process.kill(); process.waitForFinished(-1); - for(int i = 0; i < 2; i++) LAMEXP_DELETE(qaacBin[i]); + for(int i = 0; i < 4; i++) LAMEXP_DELETE(qaacBin[i]); return; } QRegExp qaacEncSig("qaac (\\d)\\.(\\d)(\\d)", Qt::CaseInsensitive); QRegExp coreEncSig("CoreAudioToolbox (\\d)\\.(\\d)\\.(\\d)\\.(\\d)", Qt::CaseInsensitive); + QRegExp soxrEncSig("libsoxr-\\d\\.\\d\\.\\d", Qt::CaseInsensitive); + QRegExp soxcEncSig("libsoxconvolver \\d\\.\\d\\.\\d", Qt::CaseInsensitive); + unsigned int qaacVersion = 0; unsigned int coreVersion = 0; + bool soxrFound = false; + bool soxcFound = false; while(process.state() != QProcess::NotRunning) { @@ -804,7 +832,7 @@ void InitializationThread::initQAac(void) qWarning("QAAC process time out -> killing!"); process.kill(); process.waitForFinished(-1); - for(int i = 0; i < 2; i++) LAMEXP_DELETE(qaacBin[i]); + for(int i = 0; i < 4; i++) LAMEXP_DELETE(qaacBin[i]); return; } while(process.bytesAvailable() > 0) @@ -835,6 +863,8 @@ void InitializationThread::initQAac(void) coreVersion = (qBound(0U, tmp[0], 9U) * 1000) + (qBound(0U, tmp[1], 9U) * 100) + (qBound(0U, tmp[2], 9U) * 10) + qBound(0U, tmp[3], 9U); } } + if(soxcEncSig.lastIndexIn(line) >= 0) { soxcFound = true; } + if(soxrEncSig.lastIndexIn(line) >= 0) { soxrFound = true; } } } @@ -843,33 +873,41 @@ void InitializationThread::initQAac(void) if(!(qaacVersion > 0)) { qWarning("QAAC version couldn't be determined -> QAAC support will be disabled!"); - for(int i = 0; i < 2; i++) LAMEXP_DELETE(qaacBin[i]); + for(int i = 0; i < 4; 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()); qWarning("Minimum required QAAC version currently is: %s.\n", lamexp_version2string("v?.??", lamexp_toolver_qaacenc(), "N/A").toLatin1().constData()); - for(int i = 0; i < 2; i++) LAMEXP_DELETE(qaacBin[i]); + for(int i = 0; i < 4; i++) LAMEXP_DELETE(qaacBin[i]); return; } if(!(coreVersion > 0)) { qWarning("CoreAudioToolbox version couldn't be determined -> QAAC support will be disabled!"); - for(int i = 0; i < 2; i++) LAMEXP_DELETE(qaacBin[i]); + for(int i = 0; i < 4; 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()); qWarning("Minimum required CoreAudioToolbox version currently is: %s.\n", lamexp_version2string("v?.??", lamexp_toolver_coreaudio(), "N/A").toLatin1().constData()); - for(int i = 0; i < 2; i++) LAMEXP_DELETE(qaacBin[i]); + for(int i = 0; i < 4; i++) LAMEXP_DELETE(qaacBin[i]); + return; + } + + if(!(soxrFound && soxcFound)) + { + qWarning("libsoxr and/or libsoxconvolver not available -> QAAC support will be disabled!\n"); return; } lamexp_register_tool(qaacFileInfo[0].fileName(), qaacBin[0], qaacVersion); lamexp_register_tool(qaacFileInfo[1].fileName(), qaacBin[1], qaacVersion); + lamexp_register_tool(qaacFileInfo[2].fileName(), qaacBin[2], qaacVersion); + lamexp_register_tool(qaacFileInfo[3].fileName(), qaacBin[3], qaacVersion); } void InitializationThread::selfTest(void)