diff --git a/doc/FAQ.html b/doc/FAQ.html
index d689de79..8c1cca4d 100644
--- a/doc/FAQ.html
+++ b/doc/FAQ.html
@@ -402,8 +402,8 @@ available as a free download (you don't need to buy the "Pro" version!) from the
http://download.nullsoft.com/winamp/client/winamp5623_full_emusic-7plus_all.exe
In order to enable the FHG AAC Encoder support you will also need the 'FHG AAC Encoder Add-in' for LameXP:
+http://www.mediafire.com/file/ni7w4323pqub9x3/LameXP.fhgaacenc-addin.2012-08-06.zip
+http://mulder.brhack.net/public/add-in/LameXP.fhgaacenc-addin.2012-08-06.zip
Please follow the install instructions that are included with the 'FHG AAC 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.
diff --git a/etc/Patches/fhgaacenc-Git20120806-DLLPath.diff b/etc/Patches/fhgaacenc-Git20120806-DLLPath.diff
new file mode 100644
index 00000000..b3c92f98
--- /dev/null
+++ b/etc/Patches/fhgaacenc-Git20120806-DLLPath.diff
@@ -0,0 +1,146 @@
+ fhgaacenc.sln | 6 ++---
+ fhgaacenc/common.h | 3 ++-
+ fhgaacenc/fhgaacenc.cpp | 67 +++++++++++++++++++++++++++++++++++++++--------
+ 3 files changed, 61 insertions(+), 15 deletions(-)
+
+diff --git a/fhgaacenc/common.h b/fhgaacenc/common.h
+index e7221be..b7d1bf7 100644
+--- a/fhgaacenc/common.h
++++ b/fhgaacenc/common.h
+@@ -6,7 +6,7 @@
+
+ #pragma once
+
+-#define VERSION 20120624
++#define VERSION 20120806
+
+ #ifdef _MSC_VER
+ #define fseeko _fseeki64
+@@ -34,6 +34,7 @@ typedef struct
+ {
+ _TCHAR *inFile;
+ _TCHAR *outFile;
++ _TCHAR *dllFile;
+ codecMode mode;
+ int modeQuality;
+ codecProfile profile;
+diff --git a/fhgaacenc/fhgaacenc.cpp b/fhgaacenc/fhgaacenc.cpp
+index 1ee1036..a817f17 100644
+--- a/fhgaacenc/fhgaacenc.cpp
++++ b/fhgaacenc/fhgaacenc.cpp
+@@ -8,6 +8,8 @@
+ #include "common.h"
+ #include "FhGAACEncoder.h"
+
++typedef BOOL (WINAPI *SetDllDirectoryFun)(__in_opt LPCWSTR lpPathName);
++
+ bool getPathForWinAmp(_TCHAR *path, unsigned int length)
+ {
+ if(!path) return false;
+@@ -45,6 +47,7 @@ static void printUsage(void)
+ fprintf(stderr," Other options \n");
+ fprintf(stderr,"\t--ignorelength : ignore the size of data chunk when encoding from pipe\n");
+ fprintf(stderr,"\t--quiet : don't print the progress\n");
++ fprintf(stderr,"\t--dll : overwrite path to the \"enc_fhgaac.dll\" library\n");
+ }
+
+ static void replaceSlashWithBackSlash(_TCHAR *str)
+@@ -60,6 +63,11 @@ static int parseArguments(int argc, _TCHAR* argv[], encodingParameters *params)
+ int i;
+ for(i=1;iquiet = true;
++ else if(!_tcscmp(argv[i],_T("--dll"))) {
++ if(++idllFile = argv[i];
++ }
++ }
+ else if(!_tcscmp(argv[i],_T("--cbr"))) {
+ params->mode = kModeCBR;
+ if(++i1)fprintf(stderr,"Error while parsing arguments\n");
+ printUsage();
+ return 0;
+ }
+
+- HMODULE h = LoadLibrary(_T("enc_fhgaac.dll"));
++ fprintf(stderr,"fhgaacenc version %d by tmkk\n\n", VERSION);
++
++ SetDllDirectoryFun SetDllDirectoryPtr = NULL;
++ HMODULE hKernel32 = GetModuleHandle(L"kernel32.dll");
++ if(hKernel32 != NULL)
++ {
++ SetDllDirectoryPtr = (SetDllDirectoryFun) GetProcAddress(hKernel32, "SetDllDirectoryW");
++ if(SetDllDirectoryPtr != NULL) SetDllDirectoryPtr(L"");
++ }
++
++ if((params.dllFile != NULL) && (SetDllDirectoryPtr != NULL))
++ {
++ _TCHAR tmp[MAX_PATH+1];
++ wcsncpy(tmp, params.dllFile, MAX_PATH+1);
++ tmp[MAX_PATH] = L'\0';
++ size_t len = wcslen(tmp);
++ if(len > 0)
++ {
++ for(size_t i = len-1; i > 0; i--)
++ {
++ if((tmp[i] == L'\\') || (tmp[i] == L'/')) { tmp[i] = L'\0'; break; }
++ }
++ }
++ if(wcslen(tmp) > 0) SetDllDirectoryPtr(tmp);
++ }
++
++ HMODULE h = LoadLibrary((params.dllFile != NULL) ? params.dllFile : _T("enc_fhgaac.dll"));
+ if(!h) {
+ _TCHAR tmp[MAX_PATH+1];
+ if(getPathForWinAmp(tmp,MAX_PATH+1)) {
+- SetDllDirectory(tmp);
++ if(SetDllDirectoryPtr != NULL) SetDllDirectoryPtr(tmp);
+ _sntprintf_s(tmp,MAX_PATH+1,_TRUNCATE,_T("%s\\Plugins\\enc_fhgaac.dll"),tmp);
+ h = LoadLibrary(tmp);
+ }
+@@ -130,6 +173,16 @@ int _tmain(int argc, _TCHAR* argv[])
+ }
+ }
+
++ if(h)
++ {
++ _TCHAR tmp[MAX_PATH+1];
++ DWORD ret = GetModuleFileName(h, tmp, MAX_PATH+1);
++ if((ret > 0) && ret <= MAX_PATH)
++ {
++ fwprintf(stderr, L"Using encoder DLL:\n%s\n\n", tmp);
++ }
++ }
++
+ FhGAACEncoder *fhgenc = new FhGAACEncoder();
+
+ *(void **)&(fhgenc->createAudio3) = (void *)GetProcAddress(h, "CreateAudio3");
+@@ -147,14 +200,6 @@ int _tmain(int argc, _TCHAR* argv[])
+ return 0;
+ }
+
+- encodingParameters params;
+- memset(¶ms,0,sizeof(encodingParameters));
+- params.modeQuality = 4;
+- if(parseArguments(argc, argv, ¶ms)) {
+- if(argc>1)fprintf(stderr,"Error while parsing arguments\n");
+- printUsage();
+- return 0;
+- }
+ /*
+ if(params.mode == kModeVBR && params.adtsMode) {
+ fprintf(stderr,"Error: only CBR is supported in ADTS AAC encoder.\n");
diff --git a/src/Config.h b/src/Config.h
index 7a0b42eb..db8de38c 100644
--- a/src/Config.h
+++ b/src/Config.h
@@ -37,7 +37,7 @@
///////////////////////////////////////////////////////////////////////////////
#define VER_LAMEXP_TOOL_NEROAAC 1540
-#define VER_LAMEXP_TOOL_FHGAACENC 20110822
+#define VER_LAMEXP_TOOL_FHGAACENC 20120806
#define VER_LAMEXP_TOOL_QAAC 139
#define VER_LAMEXP_TOOL_COREAUDIO 7710
diff --git a/src/Thread_Initialization.cpp b/src/Thread_Initialization.cpp
index 7b1c0d58..b432ba5e 100644
--- a/src/Thread_Initialization.cpp
+++ b/src/Thread_Initialization.cpp
@@ -489,14 +489,15 @@ void InitializationThread::initFhgAac(void)
{
const QString appPath = QDir(QCoreApplication::applicationDirPath()).canonicalPath();
- QFileInfo fhgFileInfo[4];
+ QFileInfo fhgFileInfo[5];
fhgFileInfo[0] = QFileInfo(QString("%1/fhgaacenc.exe").arg(appPath));
fhgFileInfo[1] = QFileInfo(QString("%1/enc_fhgaac.dll").arg(appPath));
fhgFileInfo[2] = QFileInfo(QString("%1/nsutil.dll").arg(appPath));
fhgFileInfo[3] = QFileInfo(QString("%1/libmp4v2.dll").arg(appPath));
+ fhgFileInfo[4] = QFileInfo(QString("%1/libsndfile-1.dll").arg(appPath));
bool fhgFilesFound = true;
- for(int i = 0; i < 4; i++) { if(!fhgFileInfo[i].exists()) fhgFilesFound = false; }
+ for(int i = 0; i < 5; i++) { if(!fhgFileInfo[i].exists()) fhgFilesFound = false; }
//Lock the FhgAacEnc binaries
if(!fhgFilesFound)
@@ -508,19 +509,19 @@ void InitializationThread::initFhgAac(void)
qDebug("Found FhgAacEnc cli_exe:\n%s\n", fhgFileInfo[0].canonicalFilePath().toUtf8().constData());
qDebug("Found FhgAacEnc enc_dll:\n%s\n", fhgFileInfo[1].canonicalFilePath().toUtf8().constData());
- LockedFile *fhgBin[4];
- for(int i = 0; i < 4; i++) fhgBin[i] = NULL;
+ LockedFile *fhgBin[5];
+ for(int i = 0; i < 5; i++) fhgBin[i] = NULL;
try
{
- for(int i = 0; i < 4; i++)
+ for(int i = 0; i < 5; i++)
{
fhgBin[i] = new LockedFile(fhgFileInfo[i].canonicalFilePath());
}
}
catch(...)
{
- for(int i = 0; i < 4; i++) LAMEXP_DELETE(fhgBin[i]);
+ for(int i = 0; i < 5; i++) LAMEXP_DELETE(fhgBin[i]);
qWarning("Failed to get excluive lock to FhgAacEnc binary -> FhgAacEnc support will be disabled!");
return;
}
@@ -536,7 +537,7 @@ void InitializationThread::initFhgAac(void)
qWarning("Error message: \"%s\"\n", process.errorString().toLatin1().constData());
process.kill();
process.waitForFinished(-1);
- for(int i = 0; i < 4; i++) LAMEXP_DELETE(fhgBin[i]);
+ for(int i = 0; i < 5; i++) LAMEXP_DELETE(fhgBin[i]);
return;
}
@@ -551,7 +552,7 @@ void InitializationThread::initFhgAac(void)
qWarning("FhgAacEnc process time out -> killing!");
process.kill();
process.waitForFinished(-1);
- for(int i = 0; i < 4; i++) LAMEXP_DELETE(fhgBin[i]);
+ for(int i = 0; i < 5; i++) LAMEXP_DELETE(fhgBin[i]);
return;
}
while(process.bytesAvailable() > 0)
@@ -569,17 +570,18 @@ void InitializationThread::initFhgAac(void)
if(!(fhgVersion > 0))
{
qWarning("FhgAacEnc version couldn't be determined -> FhgAacEnc support will be disabled!");
- for(int i = 0; i < 4; i++) LAMEXP_DELETE(fhgBin[i]);
+ for(int i = 0; i < 5; i++) LAMEXP_DELETE(fhgBin[i]);
return;
}
else if(fhgVersion < lamexp_toolver_fhgaacenc())
{
- qWarning("FhgAacEnc version is too much outdated -> FhgAacEnc support will be disabled!");
- for(int i = 0; i < 4; i++) LAMEXP_DELETE(fhgBin[i]);
+ qWarning("FhgAacEnc version is too much outdated (%s) -> FhgAacEnc support will be disabled!", lamexp_version2string("????-??-??", fhgVersion, "N/A").toLatin1().constData());
+ qWarning("Minimum required FhgAacEnc version currently is: %s\n", lamexp_version2string("????-??-??", lamexp_toolver_fhgaacenc(), "N/A").toLatin1().constData());
+ for(int i = 0; i < 5; i++) LAMEXP_DELETE(fhgBin[i]);
return;
}
- for(int i = 0; i < 4; i++)
+ for(int i = 0; i < 5; i++)
{
lamexp_register_tool(fhgFileInfo[i].fileName(), fhgBin[i], fhgVersion);
}