Improved initialization of the AAC encoders.
This commit is contained in:
parent
dbe91770e9
commit
b0af060ef6
@ -81,7 +81,7 @@
|
|||||||
<AdditionalIncludeDirectories>$(SolutionDir)\tmp\$(ProjectName);$(SolutionDir)\..\MUtilities\include;$(QTDIR)\include;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(SolutionDir)\..\Prerequisites\VisualLeakDetector\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)\tmp\$(ProjectName);$(SolutionDir)\..\MUtilities\include;$(QTDIR)\include;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(SolutionDir)\..\Prerequisites\VisualLeakDetector\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>_CONFIG_NAME=$(ConfigurationName);WIN32;_DEBUG;_CONSOLE;QT_GUI_LIB;QT_CORE_LIB;QT_THREAD_SUPPORT;QT_DLL;QT_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_CONFIG_NAME=$(ConfigurationName);WIN32;_DEBUG;_CONSOLE;QT_GUI_LIB;QT_CORE_LIB;QT_THREAD_SUPPORT;QT_DLL;QT_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<MinimalRebuild>false</MinimalRebuild>
|
<MinimalRebuild>false</MinimalRebuild>
|
||||||
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
|
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||||
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
|
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
|
||||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||||
|
@ -227,7 +227,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.<
|
|||||||
<p> <br />Since you usually do <strong>not</strong> want to <em>install</em> the complete QuickTime (or iTunes) software on your computer, please only <em>download</em> the QuickTime (or iTunes) setup package, but do <strong>not</strong> actually <em>run</em> the installer!</p>
|
<p> <br />Since you usually do <strong>not</strong> want to <em>install</em> the complete QuickTime (or iTunes) software on your computer, please only <em>download</em> the QuickTime (or iTunes) setup package, but do <strong>not</strong> actually <em>run</em> the installer!</p>
|
||||||
<p>Instead, open the QuickTimer setup program, i.e. <code>QuickTimeInstaller.exe</code>, with your favourite file archive software (we recommend using <a href="http://www.7-zip.org/">7-Zip</a> or <a href="http://www.rarlab.com/download.htm">WinRAR</a>) and <em>extract</em> the required <code>AppleApplicationSupport.msi</code> package.</p>
|
<p>Instead, open the QuickTimer setup program, i.e. <code>QuickTimeInstaller.exe</code>, with your favourite file archive software (we recommend using <a href="http://www.7-zip.org/">7-Zip</a> or <a href="http://www.rarlab.com/download.htm">WinRAR</a>) and <em>extract</em> the required <code>AppleApplicationSupport.msi</code> package.</p>
|
||||||
<p><img src="img/lamexp/setup_4c.png" alt="Figure" /></p>
|
<p><img src="img/lamexp/setup_4c.png" alt="Figure" /></p>
|
||||||
<p> <br />After the "Apple Application Support" setup package has been extracted, launch the installer by double-clicking on the <code>AppleApplicationSupport.msi</code> file and follow the installer's instructions.</p>
|
<p> <br />After the "Apple Application Support" setup package has been extracted, you can launch it by double-clicking on the <code>AppleApplicationSupport.msi</code> file. Then simply follow the installer's instructions.</p>
|
||||||
<p><img src="img/lamexp/setup_4d.png" alt="Figure" /></p>
|
<p><img src="img/lamexp/setup_4d.png" alt="Figure" /></p>
|
||||||
<p> <br />Once the QAAC encoder as well as the Apple AAC encoder libraries ("Apple Application Support") have been installed properly, simply <em>restart</em> LameXP in order to enable the AAC encoding support!</p>
|
<p> <br />Once the QAAC encoder as well as the Apple AAC encoder libraries ("Apple Application Support") have been installed properly, simply <em>restart</em> LameXP in order to enable the AAC encoding support!</p>
|
||||||
<h1 id="tutorial-step-by-step-guide"><span class="header-section-number">4</span> Tutorial (Step-by-Step Guide)</h1>
|
<h1 id="tutorial-step-by-step-guide"><span class="header-section-number">4</span> Tutorial (Step-by-Step Guide)</h1>
|
||||||
|
@ -263,7 +263,7 @@ Instead, open the QuickTimer setup program, i.e. ``QuickTimeInstaller.exe``, wit
|
|||||||
![Figure](img/lamexp/setup_4c.png)
|
![Figure](img/lamexp/setup_4c.png)
|
||||||
|
|
||||||
|
|
||||||
After the "Apple Application Support" setup package has been extracted, launch the installer by double-clicking on the ``AppleApplicationSupport.msi`` file and follow the installer's instructions.
|
After the "Apple Application Support" setup package has been extracted, you can launch it by double-clicking on the ``AppleApplicationSupport.msi`` file. Then simply follow the installer's instructions.
|
||||||
|
|
||||||
![Figure](img/lamexp/setup_4d.png)
|
![Figure](img/lamexp/setup_4d.png)
|
||||||
|
|
||||||
|
@ -34,8 +34,8 @@
|
|||||||
#define VER_LAMEXP_MINOR_HI 1
|
#define VER_LAMEXP_MINOR_HI 1
|
||||||
#define VER_LAMEXP_MINOR_LO 1
|
#define VER_LAMEXP_MINOR_LO 1
|
||||||
#define VER_LAMEXP_TYPE Beta
|
#define VER_LAMEXP_TYPE Beta
|
||||||
#define VER_LAMEXP_PATCH 11
|
#define VER_LAMEXP_PATCH 12
|
||||||
#define VER_LAMEXP_BUILD 1650
|
#define VER_LAMEXP_BUILD 1654
|
||||||
#define VER_LAMEXP_CONFG 1558
|
#define VER_LAMEXP_CONFG 1558
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
@ -51,8 +51,8 @@
|
|||||||
|
|
||||||
#define VER_LAMEXP_TOOL_NEROAAC 1540
|
#define VER_LAMEXP_TOOL_NEROAAC 1540
|
||||||
#define VER_LAMEXP_TOOL_FHGAACENC 20120806
|
#define VER_LAMEXP_TOOL_FHGAACENC 20120806
|
||||||
#define VER_LAMEXP_TOOL_QAAC 233
|
#define VER_LAMEXP_TOOL_QAAC 244
|
||||||
#define VER_LAMEXP_TOOL_COREAUDIO 7900
|
#define VER_LAMEXP_TOOL_COREAUDIO 7980
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Helper macros (aka: having fun with the C pre-processor)
|
// Helper macros (aka: having fun with the C pre-processor)
|
||||||
|
@ -184,14 +184,14 @@ bool QAACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInf
|
|||||||
|
|
||||||
if(!m_configCustomParams.isEmpty()) args << m_configCustomParams.split(" ", QString::SkipEmptyParts);
|
if(!m_configCustomParams.isEmpty()) args << m_configCustomParams.split(" ", QString::SkipEmptyParts);
|
||||||
|
|
||||||
if(!metaInfo.title().isEmpty()) args << "--title" << cleanTag(metaInfo.title());
|
if(!metaInfo.title().isEmpty()) args << "--title" << cleanTag(metaInfo.title());
|
||||||
if(!metaInfo.artist().isEmpty()) args << "--artist" << cleanTag(metaInfo.artist());
|
if(!metaInfo.artist().isEmpty()) args << "--artist" << cleanTag(metaInfo.artist());
|
||||||
if(!metaInfo.album().isEmpty()) args << "--album" << cleanTag(metaInfo.album());
|
if(!metaInfo.album().isEmpty()) args << "--album" << cleanTag(metaInfo.album());
|
||||||
if(!metaInfo.genre().isEmpty()) args << "--genre" << cleanTag(metaInfo.genre());
|
if(!metaInfo.genre().isEmpty()) args << "--genre" << cleanTag(metaInfo.genre());
|
||||||
if(!metaInfo.comment().isEmpty()) args << "--comment" << cleanTag( metaInfo.comment());
|
if(!metaInfo.comment().isEmpty()) args << "--comment" << cleanTag( metaInfo.comment());
|
||||||
if(metaInfo.year()) args << "--date" << QString::number(metaInfo.year());
|
if(metaInfo.year()) args << "--date" << QString::number(metaInfo.year());
|
||||||
if(metaInfo.position()) args << "--track" << QString::number(metaInfo.position());
|
if(metaInfo.position()) args << "--track" << QString::number(metaInfo.position());
|
||||||
if(!metaInfo.cover().isEmpty()) args << "--artwork" << metaInfo.cover();
|
if(!metaInfo.cover().isEmpty()) args << "--artwork" << metaInfo.cover();
|
||||||
|
|
||||||
args << "-d" << ".";
|
args << "-d" << ".";
|
||||||
args << "-o" << QDir::toNativeSeparators(outputFile);
|
args << "-o" << QDir::toNativeSeparators(outputFile);
|
||||||
|
@ -401,9 +401,9 @@ double InitializationThread::doInit(const size_t threadCount)
|
|||||||
initTranslations();
|
initTranslations();
|
||||||
|
|
||||||
//Look for AAC encoders
|
//Look for AAC encoders
|
||||||
initNeroAac();
|
initAacEnc_Nero();
|
||||||
initFhgAac();
|
initAacEnc_FHG();
|
||||||
initQAac();
|
initAacEnc_QAAC();
|
||||||
|
|
||||||
m_bSuccess = true;
|
m_bSuccess = true;
|
||||||
delay();
|
delay();
|
||||||
@ -412,7 +412,7 @@ double InitializationThread::doInit(const size_t threadCount)
|
|||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// PUBLIC FUNCTIONS
|
// INTERNAL FUNCTIONS
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void InitializationThread::delay(void)
|
void InitializationThread::delay(void)
|
||||||
@ -420,6 +420,10 @@ void InitializationThread::delay(void)
|
|||||||
MUtils::OS::sleep_ms(333);
|
MUtils::OS::sleep_ms(333);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
// Translation Support
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void InitializationThread::initTranslations(void)
|
void InitializationThread::initTranslations(void)
|
||||||
{
|
{
|
||||||
//Search for language files
|
//Search for language files
|
||||||
@ -484,21 +488,33 @@ void InitializationThread::initTranslations(void)
|
|||||||
qDebug("All registered.\n");
|
qDebug("All registered.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitializationThread::initNeroAac(void)
|
////////////////////////////////////////////////////////////
|
||||||
|
// AAC Encoder Detection
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void InitializationThread::initAacEnc_Nero(void)
|
||||||
{
|
{
|
||||||
const QString appPath = QDir(QCoreApplication::applicationDirPath()).canonicalPath();
|
const QString appPath = QDir(QCoreApplication::applicationDirPath()).canonicalPath();
|
||||||
|
|
||||||
QFileInfo neroFileInfo[3];
|
const QFileInfo neroFileInfo[3] =
|
||||||
neroFileInfo[0] = QFileInfo(QString("%1/neroAacEnc.exe").arg(appPath));
|
{
|
||||||
neroFileInfo[1] = QFileInfo(QString("%1/neroAacDec.exe").arg(appPath));
|
QFileInfo(QString("%1/neroAacEnc.exe").arg(appPath)),
|
||||||
neroFileInfo[2] = QFileInfo(QString("%1/neroAacTag.exe").arg(appPath));
|
QFileInfo(QString("%1/neroAacDec.exe").arg(appPath)),
|
||||||
|
QFileInfo(QString("%1/neroAacTag.exe").arg(appPath))
|
||||||
|
};
|
||||||
|
|
||||||
bool neroFilesFound = true;
|
bool neroFilesFound = true;
|
||||||
for(int i = 0; i < 3; i++) { if(!neroFileInfo[i].exists()) neroFilesFound = false; }
|
for(int i = 0; i < 3; i++)
|
||||||
|
{
|
||||||
|
if(!(neroFileInfo[i].exists() && neroFileInfo[i].isFile()))
|
||||||
|
{
|
||||||
|
neroFilesFound = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(!neroFilesFound)
|
if(!neroFilesFound)
|
||||||
{
|
{
|
||||||
qDebug("Nero encoder binaries not found -> AAC encoding support will be disabled!\n");
|
qDebug("Nero encoder binaries not found -> NeroAAC encoding support will be disabled!\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -506,7 +522,7 @@ void InitializationThread::initNeroAac(void)
|
|||||||
{
|
{
|
||||||
if(!MUtils::OS::is_executable_file(neroFileInfo[i].canonicalFilePath()))
|
if(!MUtils::OS::is_executable_file(neroFileInfo[i].canonicalFilePath()))
|
||||||
{
|
{
|
||||||
qDebug("%s executbale is invalid -> AAC encoding support will be disabled!\n", MUTILS_UTF8(neroFileInfo[i].fileName()));
|
qDebug("%s executbale is invalid -> NeroAAC encoding support will be disabled!\n", MUTILS_UTF8(neroFileInfo[i].fileName()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -514,20 +530,17 @@ void InitializationThread::initNeroAac(void)
|
|||||||
qDebug("Found Nero AAC encoder binary:\n%s\n", MUTILS_UTF8(neroFileInfo[0].canonicalFilePath()));
|
qDebug("Found Nero AAC encoder binary:\n%s\n", MUTILS_UTF8(neroFileInfo[0].canonicalFilePath()));
|
||||||
|
|
||||||
//Lock the Nero binaries
|
//Lock the Nero binaries
|
||||||
LockedFile *neroBin[3];
|
QScopedPointer<LockedFile> neroBin[3];
|
||||||
for(int i = 0; i < 3; i++) neroBin[i] = NULL;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
for(int i = 0; i < 3; i++)
|
for(int i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
neroBin[i] = new LockedFile(neroFileInfo[i].canonicalFilePath());
|
neroBin[i].reset(new LockedFile(neroFileInfo[i].canonicalFilePath()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(...)
|
catch(...)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < 3; i++) MUTILS_DELETE(neroBin[i]);
|
qWarning("Failed to get excluive lock to Nero encoder binary -> NeroAAC encoding support will be disabled!");
|
||||||
qWarning("Failed to get excluive lock to Nero encoder binary -> AAC encoding support will be disabled!");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -542,11 +555,14 @@ void InitializationThread::initNeroAac(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);
|
||||||
for(int i = 0; i < 3; i++) MUTILS_DELETE(neroBin[i]);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int neroVersion = 0;
|
bool neroSigFound = false;
|
||||||
|
quint32 neroVersion = 0;
|
||||||
|
|
||||||
|
QRegExp neroAacEncSig("Nero\\s+AAC\\s+Encoder", Qt::CaseInsensitive);
|
||||||
|
QRegExp neroAacEncVer("Package\\s+version:\\s+(\\d)\\.(\\d)\\.(\\d)\\.(\\d)", Qt::CaseInsensitive);
|
||||||
|
|
||||||
while(process.state() != QProcess::NotRunning)
|
while(process.state() != QProcess::NotRunning)
|
||||||
{
|
{
|
||||||
@ -554,61 +570,72 @@ void InitializationThread::initNeroAac(void)
|
|||||||
{
|
{
|
||||||
if(process.state() == QProcess::Running)
|
if(process.state() == QProcess::Running)
|
||||||
{
|
{
|
||||||
qWarning("Nero process time out -> killing!");
|
qWarning("NeroAAC process time out -> killing!");
|
||||||
process.kill();
|
process.kill();
|
||||||
process.waitForFinished(-1);
|
process.waitForFinished(-1);
|
||||||
for(int i = 0; i < 3; i++) MUTILS_DELETE(neroBin[i]);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while(process.canReadLine())
|
while(process.canReadLine())
|
||||||
{
|
{
|
||||||
QString line = QString::fromUtf8(process.readLine().constData()).simplified();
|
QString line = QString::fromUtf8(process.readLine().constData()).simplified();
|
||||||
QStringList tokens = line.split(" ", QString::SkipEmptyParts, Qt::CaseInsensitive);
|
if(neroAacEncSig.lastIndexIn(line) >= 0)
|
||||||
int index1 = tokens.indexOf("Package");
|
|
||||||
int index2 = tokens.indexOf("version:");
|
|
||||||
if(index1 >= 0 && index2 >= 0 && index1 + 1 == index2 && index2 < tokens.count() - 1)
|
|
||||||
{
|
{
|
||||||
QStringList versionTokens = tokens.at(index2 + 1).split(".", QString::SkipEmptyParts, Qt::CaseInsensitive);
|
neroSigFound = true;
|
||||||
if(versionTokens.count() == 4)
|
continue;
|
||||||
|
}
|
||||||
|
if(neroSigFound && (neroAacEncVer.lastIndexIn(line) >= 0))
|
||||||
|
{
|
||||||
|
quint32 tmp[4];
|
||||||
|
if(MUtils::regexp_parse_uint32(neroAacEncVer, tmp, 4))
|
||||||
{
|
{
|
||||||
neroVersion = 0;
|
neroVersion = (qBound(0U, tmp[0], 9U) * 1000U) + (qBound(0U, tmp[1], 9U) * 100U) + (qBound(0U, tmp[2], 9U) * 10U) + qBound(0U, tmp[3], 9U);
|
||||||
neroVersion += qMin(9, qMax(0, versionTokens.at(3).toInt()));
|
|
||||||
neroVersion += qMin(9, qMax(0, versionTokens.at(2).toInt())) * 10;
|
|
||||||
neroVersion += qMin(9, qMax(0, versionTokens.at(1).toInt())) * 100;
|
|
||||||
neroVersion += qMin(9, qMax(0, versionTokens.at(0).toInt())) * 1000;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!(neroVersion > 0))
|
if(neroVersion <= 0)
|
||||||
{
|
{
|
||||||
qWarning("Nero AAC version could not be determined -> AAC encoding support will be disabled!");
|
qWarning("NeroAAC version could not be determined -> NeroAAC encoding support will be disabled!");
|
||||||
for(int i = 0; i < 3; i++) MUTILS_DELETE(neroBin[i]);
|
return;
|
||||||
|
}
|
||||||
|
else if(neroVersion < lamexp_toolver_neroaac())
|
||||||
|
{
|
||||||
|
qWarning("NeroAAC version is too much outdated (%s) -> NeroAAC support will be disabled!", MUTILS_UTF8(lamexp_version2string("v?.?.?.?", neroVersion, "N/A")));
|
||||||
|
qWarning("Minimum required NeroAAC version currently is: %s\n", MUTILS_UTF8(lamexp_version2string("v?.?.?.?", lamexp_toolver_neroaac(), "N/A")));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qDebug("Enabled NeroAAC encoder %s.\n", MUTILS_UTF8(lamexp_version2string("v?.?.?.?", neroVersion, "N/A")));
|
||||||
|
|
||||||
for(int i = 0; i < 3; i++)
|
for(int i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
lamexp_tools_register(neroFileInfo[i].fileName(), neroBin[i], neroVersion);
|
lamexp_tools_register(neroFileInfo[i].fileName(), neroBin[i].take(), neroVersion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitializationThread::initFhgAac(void)
|
void InitializationThread::initAacEnc_FHG(void)
|
||||||
{
|
{
|
||||||
const QString appPath = QDir(QCoreApplication::applicationDirPath()).canonicalPath();
|
const QString appPath = QDir(QCoreApplication::applicationDirPath()).canonicalPath();
|
||||||
|
|
||||||
QFileInfo fhgFileInfo[5];
|
const QFileInfo fhgFileInfo[5] =
|
||||||
fhgFileInfo[0] = QFileInfo(QString("%1/fhgaacenc.exe").arg(appPath));
|
{
|
||||||
fhgFileInfo[1] = QFileInfo(QString("%1/enc_fhgaac.dll").arg(appPath));
|
QFileInfo(QString("%1/fhgaacenc.exe") .arg(appPath)),
|
||||||
fhgFileInfo[2] = QFileInfo(QString("%1/nsutil.dll").arg(appPath));
|
QFileInfo(QString("%1/enc_fhgaac.dll") .arg(appPath)),
|
||||||
fhgFileInfo[3] = QFileInfo(QString("%1/libmp4v2.dll").arg(appPath));
|
QFileInfo(QString("%1/nsutil.dll") .arg(appPath)),
|
||||||
fhgFileInfo[4] = QFileInfo(QString("%1/libsndfile-1.dll").arg(appPath));
|
QFileInfo(QString("%1/libmp4v2.dll") .arg(appPath)),
|
||||||
|
QFileInfo(QString("%1/libsndfile-1.dll").arg(appPath))
|
||||||
|
};
|
||||||
|
|
||||||
bool fhgFilesFound = true;
|
bool fhgFilesFound = true;
|
||||||
for(int i = 0; i < 5; i++) { if(!fhgFileInfo[i].exists()) fhgFilesFound = false; }
|
for(int i = 0; i < 5; i++)
|
||||||
|
{
|
||||||
|
if(!(fhgFileInfo[i].exists() && fhgFileInfo[i].isFile()))
|
||||||
|
{
|
||||||
|
fhgFilesFound = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(!fhgFilesFound)
|
if(!fhgFilesFound)
|
||||||
{
|
{
|
||||||
@ -626,19 +653,16 @@ void InitializationThread::initFhgAac(void)
|
|||||||
qDebug("Found FhgAacEnc enc_dll:\n%s\n", MUTILS_UTF8(fhgFileInfo[1].canonicalFilePath()));
|
qDebug("Found FhgAacEnc enc_dll:\n%s\n", MUTILS_UTF8(fhgFileInfo[1].canonicalFilePath()));
|
||||||
|
|
||||||
//Lock the FhgAacEnc binaries
|
//Lock the FhgAacEnc binaries
|
||||||
LockedFile *fhgBin[5];
|
QScopedPointer<LockedFile> fhgBin[5];
|
||||||
for(int i = 0; i < 5; i++) fhgBin[i] = NULL;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
for(int i = 0; i < 5; i++)
|
for(int i = 0; i < 5; i++)
|
||||||
{
|
{
|
||||||
fhgBin[i] = new LockedFile(fhgFileInfo[i].canonicalFilePath());
|
fhgBin[i].reset(new LockedFile(fhgFileInfo[i].canonicalFilePath()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(...)
|
catch(...)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < 5; i++) MUTILS_DELETE(fhgBin[i]);
|
|
||||||
qWarning("Failed to get excluive lock to FhgAacEnc binary -> FhgAacEnc support will be disabled!");
|
qWarning("Failed to get excluive lock to FhgAacEnc binary -> FhgAacEnc support will be disabled!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -654,12 +678,11 @@ void InitializationThread::initFhgAac(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);
|
||||||
for(int i = 0; i < 5; i++) MUTILS_DELETE(fhgBin[i]);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
quint32 fhgVersion = 0;
|
||||||
QRegExp fhgAacEncSig("fhgaacenc version (\\d+) by tmkk", Qt::CaseInsensitive);
|
QRegExp fhgAacEncSig("fhgaacenc version (\\d+) by tmkk", Qt::CaseInsensitive);
|
||||||
unsigned int fhgVersion = 0;
|
|
||||||
|
|
||||||
while(process.state() != QProcess::NotRunning)
|
while(process.state() != QProcess::NotRunning)
|
||||||
{
|
{
|
||||||
@ -669,7 +692,6 @@ void InitializationThread::initFhgAac(void)
|
|||||||
qWarning("FhgAacEnc process time out -> killing!");
|
qWarning("FhgAacEnc process time out -> killing!");
|
||||||
process.kill();
|
process.kill();
|
||||||
process.waitForFinished(-1);
|
process.waitForFinished(-1);
|
||||||
for(int i = 0; i < 5; i++) MUTILS_DELETE(fhgBin[i]);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
while(process.bytesAvailable() > 0)
|
while(process.bytesAvailable() > 0)
|
||||||
@ -677,45 +699,54 @@ void InitializationThread::initFhgAac(void)
|
|||||||
QString line = QString::fromUtf8(process.readLine().constData()).simplified();
|
QString line = QString::fromUtf8(process.readLine().constData()).simplified();
|
||||||
if(fhgAacEncSig.lastIndexIn(line) >= 0)
|
if(fhgAacEncSig.lastIndexIn(line) >= 0)
|
||||||
{
|
{
|
||||||
bool ok = false;
|
quint32 tmp;
|
||||||
unsigned int temp = fhgAacEncSig.cap(1).toUInt(&ok);
|
if(MUtils::regexp_parse_uint32(fhgAacEncSig, tmp))
|
||||||
if(ok) fhgVersion = temp;
|
{
|
||||||
|
fhgVersion = tmp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!(fhgVersion > 0))
|
if(fhgVersion <= 0)
|
||||||
{
|
{
|
||||||
qWarning("FhgAacEnc version couldn't be determined -> FhgAacEnc support will be disabled!");
|
qWarning("FhgAacEnc version couldn't be determined -> FhgAacEnc support will be disabled!");
|
||||||
for(int i = 0; i < 5; i++) MUTILS_DELETE(fhgBin[i]);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if(fhgVersion < lamexp_toolver_fhgaacenc())
|
else if(fhgVersion < lamexp_toolver_fhgaacenc())
|
||||||
{
|
{
|
||||||
qWarning("FhgAacEnc version is too much outdated (%s) -> FhgAacEnc support will be disabled!", lamexp_version2string("????-??-??", fhgVersion, "N/A").toLatin1().constData());
|
qWarning("FhgAacEnc version is too much outdated (%s) -> FhgAacEnc support will be disabled!", MUTILS_UTF8(lamexp_version2string("????-??-??", fhgVersion, "N/A")));
|
||||||
qWarning("Minimum required FhgAacEnc version currently is: %s\n", lamexp_version2string("????-??-??", lamexp_toolver_fhgaacenc(), "N/A").toLatin1().constData());
|
qWarning("Minimum required FhgAacEnc version currently is: %s\n", MUTILS_UTF8(lamexp_version2string("????-??-??", lamexp_toolver_fhgaacenc(), "N/A")));
|
||||||
for(int i = 0; i < 5; i++) MUTILS_DELETE(fhgBin[i]);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qDebug("Enabled FhgAacEnc %s.\n", MUTILS_UTF8(lamexp_version2string("????-??-??", fhgVersion, "N/A")));
|
||||||
|
|
||||||
for(int i = 0; i < 5; i++)
|
for(int i = 0; i < 5; i++)
|
||||||
{
|
{
|
||||||
lamexp_tools_register(fhgFileInfo[i].fileName(), fhgBin[i], fhgVersion);
|
lamexp_tools_register(fhgFileInfo[i].fileName(), fhgBin[i].take(), fhgVersion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitializationThread::initQAac(void)
|
void InitializationThread::initAacEnc_QAAC(void)
|
||||||
{
|
{
|
||||||
const QString appPath = QDir(QCoreApplication::applicationDirPath()).canonicalPath();
|
const QString appPath = QDir(QCoreApplication::applicationDirPath()).canonicalPath();
|
||||||
|
|
||||||
QFileInfo qaacFileInfo[4];
|
const QFileInfo qaacFileInfo[3] =
|
||||||
qaacFileInfo[0] = QFileInfo(QString("%1/qaac.exe").arg(appPath));
|
{
|
||||||
qaacFileInfo[1] = QFileInfo(QString("%1/libsoxr.dll").arg(appPath));
|
QFileInfo(QString("%1/qaac.exe") .arg(appPath)),
|
||||||
qaacFileInfo[2] = QFileInfo(QString("%1/libsoxconvolver.dll").arg(appPath));
|
QFileInfo(QString("%1/libsoxr.dll") .arg(appPath)),
|
||||||
qaacFileInfo[3] = QFileInfo(QString("%1/libgcc_s_sjlj-1.dll").arg(appPath));
|
QFileInfo(QString("%1/libsoxconvolver.dll").arg(appPath))
|
||||||
|
};
|
||||||
|
|
||||||
bool qaacFilesFound = true;
|
bool qaacFilesFound = true;
|
||||||
for(int i = 0; i < 4; i++) { if(!qaacFileInfo[i].exists()) qaacFilesFound = false; }
|
for(int i = 0; i < 3; i++)
|
||||||
|
{
|
||||||
|
if(!(qaacFileInfo[i].exists() && qaacFileInfo[i].isFile()))
|
||||||
|
{
|
||||||
|
qaacFilesFound = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(!qaacFilesFound)
|
if(!qaacFilesFound)
|
||||||
{
|
{
|
||||||
@ -732,26 +763,22 @@ void InitializationThread::initQAac(void)
|
|||||||
qDebug("Found QAAC encoder:\n%s\n", MUTILS_UTF8(qaacFileInfo[0].canonicalFilePath()));
|
qDebug("Found QAAC encoder:\n%s\n", MUTILS_UTF8(qaacFileInfo[0].canonicalFilePath()));
|
||||||
|
|
||||||
//Lock the required QAAC binaries
|
//Lock the required QAAC binaries
|
||||||
LockedFile *qaacBin[4];
|
QScopedPointer<LockedFile> qaacBin[3];
|
||||||
for(int i = 0; i < 4; i++) qaacBin[i] = NULL;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
for(int i = 0; i < 4; i++)
|
for(int i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
qaacBin[i] = new LockedFile(qaacFileInfo[i].canonicalFilePath());
|
qaacBin[i].reset(new LockedFile(qaacFileInfo[i].canonicalFilePath()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(...)
|
catch(...)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < 4; i++) MUTILS_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;
|
||||||
}
|
}
|
||||||
|
|
||||||
QProcess process;
|
QProcess process;
|
||||||
MUtils::init_process(process, qaacFileInfo[0].absolutePath());
|
MUtils::init_process(process, qaacFileInfo[0].absolutePath());
|
||||||
|
|
||||||
process.start(qaacFileInfo[0].canonicalFilePath(), QStringList() << "--check");
|
process.start(qaacFileInfo[0].canonicalFilePath(), QStringList() << "--check");
|
||||||
|
|
||||||
if(!process.waitForStarted())
|
if(!process.waitForStarted())
|
||||||
@ -760,17 +787,16 @@ 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);
|
||||||
for(int i = 0; i < 4; i++) MUTILS_DELETE(qaacBin[i]);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QRegExp qaacEncSig("qaac (\\d)\\.(\\d)(\\d)", Qt::CaseInsensitive);
|
QRegExp qaacEncSig("qaac (\\d)\\.(\\d+)", Qt::CaseInsensitive);
|
||||||
QRegExp coreEncSig("CoreAudioToolbox (\\d)\\.(\\d)\\.(\\d)\\.(\\d)", Qt::CaseInsensitive);
|
QRegExp coreEncSig("CoreAudioToolbox (\\d)\\.(\\d)\\.(\\d)\\.(\\d)", Qt::CaseInsensitive);
|
||||||
QRegExp soxrEncSig("libsoxr-\\d\\.\\d\\.\\d", Qt::CaseInsensitive);
|
QRegExp soxrEncSig("libsoxr-\\d\\.\\d\\.\\d", Qt::CaseInsensitive);
|
||||||
QRegExp soxcEncSig("libsoxconvolver \\d\\.\\d\\.\\d", Qt::CaseInsensitive);
|
QRegExp soxcEncSig("libsoxconvolver \\d\\.\\d\\.\\d", Qt::CaseInsensitive);
|
||||||
|
|
||||||
unsigned int qaacVersion = 0;
|
quint32 qaacVersion = 0;
|
||||||
unsigned int coreVersion = 0;
|
quint32 coreVersion = 0;
|
||||||
bool soxrFound = false;
|
bool soxrFound = false;
|
||||||
bool soxcFound = false;
|
bool soxcFound = false;
|
||||||
|
|
||||||
@ -782,7 +808,6 @@ 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);
|
||||||
for(int i = 0; i < 4; i++) MUTILS_DELETE(qaacBin[i]);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
while(process.bytesAvailable() > 0)
|
while(process.bytesAvailable() > 0)
|
||||||
@ -790,61 +815,52 @@ void InitializationThread::initQAac(void)
|
|||||||
QString line = QString::fromUtf8(process.readLine().constData()).simplified();
|
QString line = QString::fromUtf8(process.readLine().constData()).simplified();
|
||||||
if(qaacEncSig.lastIndexIn(line) >= 0)
|
if(qaacEncSig.lastIndexIn(line) >= 0)
|
||||||
{
|
{
|
||||||
unsigned int tmp[3] = {0, 0, 0};
|
quint32 tmp[2];
|
||||||
bool ok[3] = {false, false, false};
|
if(MUtils::regexp_parse_uint32(qaacEncSig, tmp, 2))
|
||||||
tmp[0] = qaacEncSig.cap(1).toUInt(&ok[0]);
|
|
||||||
tmp[1] = qaacEncSig.cap(2).toUInt(&ok[1]);
|
|
||||||
tmp[2] = qaacEncSig.cap(3).toUInt(&ok[2]);
|
|
||||||
if(ok[0] && ok[1] && ok[2])
|
|
||||||
{
|
{
|
||||||
qaacVersion = (qBound(0U, tmp[0], 9U) * 100) + (qBound(0U, tmp[1], 9U) * 10) + qBound(0U, tmp[2], 9U);
|
qaacVersion = (qBound(0U, tmp[0], 9U) * 100) + qBound(0U, tmp[1], 99U);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(coreEncSig.lastIndexIn(line) >= 0)
|
if(coreEncSig.lastIndexIn(line) >= 0)
|
||||||
{
|
{
|
||||||
unsigned int tmp[4] = {0, 0, 0, 0};
|
quint32 tmp[4];
|
||||||
bool ok[4] = {false, false, false, false};
|
if(MUtils::regexp_parse_uint32(coreEncSig, tmp, 4))
|
||||||
tmp[0] = coreEncSig.cap(1).toUInt(&ok[0]);
|
|
||||||
tmp[1] = coreEncSig.cap(2).toUInt(&ok[1]);
|
|
||||||
tmp[2] = coreEncSig.cap(3).toUInt(&ok[2]);
|
|
||||||
tmp[3] = coreEncSig.cap(4).toUInt(&ok[3]);
|
|
||||||
if(ok[0] && ok[1] && ok[2] && ok[3])
|
|
||||||
{
|
{
|
||||||
coreVersion = (qBound(0U, tmp[0], 9U) * 1000) + (qBound(0U, tmp[1], 9U) * 100) + (qBound(0U, tmp[2], 9U) * 10) + qBound(0U, tmp[3], 9U);
|
coreVersion = (qBound(0U, tmp[0], 9U) * 1000U) + (qBound(0U, tmp[1], 9U) * 100U) + (qBound(0U, tmp[2], 9U) * 10U) + qBound(0U, tmp[3], 9U);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(soxcEncSig.lastIndexIn(line) >= 0) { soxcFound = true; }
|
if(soxcEncSig.lastIndexIn(line) >= 0)
|
||||||
if(soxrEncSig.lastIndexIn(line) >= 0) { soxrFound = true; }
|
{
|
||||||
|
soxcFound = true;
|
||||||
|
}
|
||||||
|
if(soxrEncSig.lastIndexIn(line) >= 0)
|
||||||
|
{
|
||||||
|
soxrFound = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//qDebug("qaac %d, CoreAudioToolbox %d", qaacVersion, coreVersion);
|
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!");
|
||||||
for(int i = 0; i < 4; i++) MUTILS_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!", MUTILS_UTF8(lamexp_version2string("v?.??", qaacVersion, "N/A")));
|
||||||
qWarning("Minimum required QAAC version currently is: %s.\n", lamexp_version2string("v?.??", lamexp_toolver_qaacenc(), "N/A").toLatin1().constData());
|
qWarning("Minimum required QAAC version currently is: %s.\n", MUTILS_UTF8(lamexp_version2string("v?.??", lamexp_toolver_qaacenc(), "N/A")));
|
||||||
for(int i = 0; i < 4; i++) MUTILS_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!");
|
||||||
for(int i = 0; i < 4; i++) MUTILS_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 outdated (%s) -> QAAC support will be disabled!", MUTILS_UTF8(lamexp_version2string("v?.?.?.?", coreVersion, "N/A")));
|
||||||
qWarning("Minimum required CoreAudioToolbox version currently is: %s.\n", lamexp_version2string("v?.??", lamexp_toolver_coreaudio(), "N/A").toLatin1().constData());
|
qWarning("Minimum required CoreAudioToolbox version currently is: %s.\n", MUTILS_UTF8(lamexp_version2string("v?.?.?.?", lamexp_toolver_coreaudio(), "N/A")));
|
||||||
for(int i = 0; i < 4; i++) MUTILS_DELETE(qaacBin[i]);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -854,12 +870,18 @@ void InitializationThread::initQAac(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
lamexp_tools_register(qaacFileInfo[0].fileName(), qaacBin[0], qaacVersion);
|
qDebug("Enabled qaac encoder %s (using CoreAudioToolbox %s).\n", MUTILS_UTF8(lamexp_version2string("v?.??", qaacVersion, "N/A")), MUTILS_UTF8(lamexp_version2string("v?.?.?.?", coreVersion, "N/A")));
|
||||||
lamexp_tools_register(qaacFileInfo[1].fileName(), qaacBin[1], qaacVersion);
|
|
||||||
lamexp_tools_register(qaacFileInfo[2].fileName(), qaacBin[2], qaacVersion);
|
for(int i = 0; i < 3; i++)
|
||||||
lamexp_tools_register(qaacFileInfo[3].fileName(), qaacBin[3], qaacVersion);
|
{
|
||||||
|
lamexp_tools_register(qaacFileInfo[i].fileName(), qaacBin[i].take(), qaacVersion);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
// Self-Test Function
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void InitializationThread::selfTest(void)
|
void InitializationThread::selfTest(void)
|
||||||
{
|
{
|
||||||
const unsigned int cpu[4] = {CPU_TYPE_X86_GEN, CPU_TYPE_X86_SSE, CPU_TYPE_X64_GEN, CPU_TYPE_X64_SSE};
|
const unsigned int cpu[4] = {CPU_TYPE_X86_GEN, CPU_TYPE_X86_SSE, CPU_TYPE_X64_GEN, CPU_TYPE_X64_SSE};
|
||||||
|
@ -54,9 +54,9 @@ protected:
|
|||||||
private:
|
private:
|
||||||
void delay(void);
|
void delay(void);
|
||||||
void initTranslations(void);
|
void initTranslations(void);
|
||||||
void initNeroAac(void);
|
void initAacEnc_Nero(void);
|
||||||
void initFhgAac(void);
|
void initAacEnc_FHG(void);
|
||||||
void initQAac(void);
|
void initAacEnc_QAAC(void);
|
||||||
|
|
||||||
bool m_bSuccess;
|
bool m_bSuccess;
|
||||||
MUtils::CPUFetaures::cpu_info_t m_cpuFeatures;
|
MUtils::CPUFetaures::cpu_info_t m_cpuFeatures;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user