1 ///////////////////////////////////////////////////////////////////////////////
2 // LameXP - Audio Encoder Front-End
3 // Copyright (C) 2004-2012 LoRd_MuldeR <MuldeR2@GMX.de>
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License along
16 // with this program; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 // http://www.gnu.org/licenses/gpl-2.0.txt
20 ///////////////////////////////////////////////////////////////////////////////
22 #include "Thread_Initialization.h"
24 #include "LockedFile.h"
28 #include <QCoreApplication>
35 #include <QTextStream>
37 #include <QThreadPool>
41 #define PRINT_CPU_TYPE(X) case X: qDebug("Selected CPU is: " #X)
42 static const double g_allowedExtractDelay = 12.0;
44 ////////////////////////////////////////////////////////////
45 // ExtractorTask class
46 ////////////////////////////////////////////////////////////
48 class ExtractorTask : public QRunnable
51 ExtractorTask(const QDir &appDir, const QString &toolName, const QString &toolShortName, const QByteArray &toolHash, const unsigned int toolVersion)
53 QRunnable(), m_appDir(appDir), m_toolName(toolName), m_toolShortName(toolShortName), m_toolHash(toolHash), m_toolVersion(toolVersion)
58 static void clearFlags(void)
60 s_bAbort = s_bCustom = false;
64 static bool getAbort(void) { return s_bAbort; }
65 static bool getCustom(void) { return s_bCustom; }
66 static char *const getError(void) { return s_errMsg; }
73 LockedFile *lockedFile = NULL;
74 unsigned int version = m_toolVersion;
78 QFileInfo customTool(QString("%1/tools/%2/%3").arg(m_appDir.canonicalPath(), QString::number(lamexp_version_build()), m_toolShortName));
79 if(customTool.exists() && customTool.isFile())
81 qDebug("Setting up file: %s <- %s", m_toolShortName.toLatin1().constData(), m_appDir.relativeFilePath(customTool.canonicalFilePath()).toLatin1().constData());
82 lockedFile = new LockedFile(customTool.canonicalFilePath()); version = UINT_MAX; s_bCustom = true;
86 qDebug("Extracting file: %s -> %s", m_toolName.toLatin1().constData(), m_toolShortName.toLatin1().constData());
87 lockedFile = new LockedFile(QString(":/tools/%1").arg(m_toolName), QString("%1/lxp_%2").arg(lamexp_temp_folder2(), m_toolShortName), m_toolHash);
92 QMutexLocker lock(&s_mutex);
93 lamexp_register_tool(m_toolShortName, lockedFile, version);
99 qWarning("At least one of the required tools could not be initialized:\n%s", errorMsg);
100 if(s_mutex.tryLock())
102 if(!s_bAbort) { s_bAbort = true; strncpy_s(s_errMsg, 1024, errorMsg, _TRUNCATE); }
110 const QString m_toolName;
111 const QString m_toolShortName;
112 const QByteArray m_toolHash;
113 const unsigned int m_toolVersion;
115 static volatile bool s_bAbort;
116 static volatile bool s_bCustom;
117 static QMutex s_mutex;
118 static char s_errMsg[1024];
121 volatile bool ExtractorTask::s_bAbort = false;
122 volatile bool ExtractorTask::s_bCustom = false;
123 char ExtractorTask::s_errMsg[1024] = {'\0'};
124 QMutex ExtractorTask::s_mutex;
126 ////////////////////////////////////////////////////////////
128 ////////////////////////////////////////////////////////////
130 InitializationThread::InitializationThread(const lamexp_cpu_t *cpuFeatures)
133 memset(&m_cpuFeatures, 0, sizeof(lamexp_cpu_t));
134 m_slowIndicator = false;
138 memcpy(&m_cpuFeatures, cpuFeatures, sizeof(lamexp_cpu_t));
142 ////////////////////////////////////////////////////////////
144 ////////////////////////////////////////////////////////////
146 void InitializationThread::run()
152 unsigned int cpuSupport = 0;
153 if(m_cpuFeatures.sse && m_cpuFeatures.sse2 && m_cpuFeatures.intel)
155 cpuSupport = m_cpuFeatures.x64 ? CPU_TYPE_X64_SSE : CPU_TYPE_X86_SSE;
159 cpuSupport = m_cpuFeatures.x64 ? CPU_TYPE_X64_GEN : CPU_TYPE_X86_GEN;
162 //Hack to disable x64 on Wine, as x64 binaries won't run under Wine (tested with Wine 1.4 under Ubuntu 12.04 x64)
163 if(cpuSupport & CPU_TYPE_X64_ALL)
165 //DWORD osVerNo = lamexp_get_os_version();
166 //if((HIWORD(osVerNo) == 6) && (LOWORD(osVerNo) == 2))
167 if(lamexp_detect_wine())
169 qWarning("Running under Wine on a 64-Bit system. Going to disable all x64 support!\n");
170 cpuSupport = (cpuSupport == CPU_TYPE_X64_SSE) ? CPU_TYPE_X86_SSE : CPU_TYPE_X86_GEN;
174 //Print selected CPU type
177 PRINT_CPU_TYPE(CPU_TYPE_X86_GEN); break;
178 PRINT_CPU_TYPE(CPU_TYPE_X86_SSE); break;
179 PRINT_CPU_TYPE(CPU_TYPE_X64_GEN); break;
180 PRINT_CPU_TYPE(CPU_TYPE_X64_SSE); break;
181 default: throw "CPU support undefined!";
185 QMap<QString, QString> mapChecksum;
186 QMap<QString, unsigned int> mapVersion;
187 QMap<QString, unsigned int> mapCpuType;
190 for(int i = 0; i < INT_MAX; i++)
192 if(!g_lamexp_tools[i].pcName && !g_lamexp_tools[i].pcHash && !g_lamexp_tools[i].uiVersion)
196 else if(g_lamexp_tools[i].pcName && g_lamexp_tools[i].pcHash && g_lamexp_tools[i].uiVersion)
198 const QString currentTool = QString::fromLatin1(g_lamexp_tools[i].pcName);
199 mapChecksum.insert(currentTool, QString::fromLatin1(g_lamexp_tools[i].pcHash));
200 mapCpuType.insert(currentTool, g_lamexp_tools[i].uiCpuType);
201 mapVersion.insert(currentTool, g_lamexp_tools[i].uiVersion);
205 qFatal("Inconsistent checksum data detected. Take care!");
209 QDir toolsDir(":/tools/");
210 QList<QFileInfo> toolsList = toolsDir.entryInfoList(QStringList("*.*"), QDir::Files, QDir::Name);
211 QDir appDir = QDir(QCoreApplication::applicationDirPath()).canonicalPath();
213 QThreadPool *pool = new QThreadPool();
214 int idealThreadCount = QThread::idealThreadCount();
215 if(idealThreadCount > 0)
217 pool->setMaxThreadCount(idealThreadCount * 2);
220 ExtractorTask::clearFlags();
226 while(!toolsList.isEmpty())
230 QFileInfo currentTool = toolsList.takeFirst();
231 QString toolName = currentTool.fileName().toLower();
232 QString toolShortName = QString("%1.%2").arg(currentTool.baseName().toLower(), currentTool.suffix().toLower());
234 QByteArray toolHash = mapChecksum.take(toolName).toLatin1();
235 unsigned int toolCpuType = mapCpuType.take(toolName);
236 unsigned int toolVersion = mapVersion.take(toolName);
238 if(toolHash.size() != 96)
240 throw "The required checksum is missing, take care!";
243 if(toolCpuType & cpuSupport)
245 pool->start(new ExtractorTask(appDir, toolName, toolShortName, toolHash, toolVersion));
246 QThread::yieldCurrentThread();
249 catch(char *errorMsg)
251 qFatal("At least one of the required tools could not be initialized:\n%s", errorMsg);
256 //Wait for extrator threads to finish
260 //Make sure all files were extracted correctly
261 if(ExtractorTask::getAbort())
263 qFatal("At least one of the required tools could not be initialized:\n%s", ExtractorTask::getError());
267 //Make sure all files were extracted
268 if(!mapChecksum.isEmpty())
270 qFatal("At least one required tool could not be found:\n%s", toolsDir.filePath(mapChecksum.keys().first()).toLatin1().constData());
274 qDebug("All extracted.\n");
281 //Using any custom tools?
282 if(ExtractorTask::getCustom())
284 qWarning("Warning: Using custom tools, you might encounter unexpected problems!\n");
288 double delayExtract = static_cast<double>(timer.elapsed()) / 1000.0;
289 if(delayExtract > g_allowedExtractDelay)
291 m_slowIndicator = true;
292 qWarning("Extracting tools took %.3f seconds -> probably slow realtime virus scanner.", delayExtract);
293 qWarning("Please report performance problems to your anti-virus developer !!!\n");
296 //Register all translations
299 //Look for AAC encoders
308 ////////////////////////////////////////////////////////////
310 ////////////////////////////////////////////////////////////
312 void InitializationThread::delay(void)
314 const char *temp = "|/-\\";
315 printf("Thread is doing something important... ?\b", temp[4]);
317 for(int i = 0; i < 20; i++)
319 printf("%c\b", temp[i%4]);
325 void InitializationThread::initTranslations(void)
327 //Search for language files
328 QStringList qmFiles = QDir(":/localization").entryList(QStringList() << "LameXP_??.qm", QDir::Files, QDir::Name);
330 //Make sure we found at least one translation
331 if(qmFiles.count() < 1)
333 qFatal("Could not find any translation files!");
337 //Add all available translations
338 while(!qmFiles.isEmpty())
340 QString langId, langName;
341 unsigned int systemId = 0, country = 0;
342 QString qmFile = qmFiles.takeFirst();
344 QRegExp langIdExp("LameXP_(\\w\\w)\\.qm", Qt::CaseInsensitive);
345 if(langIdExp.indexIn(qmFile) >= 0)
347 langId = langIdExp.cap(1).toLower();
348 QResource langRes = QResource(QString(":/localization/%1.txt").arg(qmFile));
349 if(langRes.isValid() && langRes.size() > 0)
351 QByteArray data = QByteArray::fromRawData(reinterpret_cast<const char*>(langRes.data()), langRes.size());
352 QTextStream stream(&data, QIODevice::ReadOnly);
353 stream.setAutoDetectUnicode(false); stream.setCodec("UTF-8");
354 while(!stream.atEnd())
356 QStringList langInfo = stream.readLine().simplified().split(",", QString::SkipEmptyParts);
357 if(langInfo.count() == 3)
359 systemId = langInfo.at(0).trimmed().toUInt();
360 country = langInfo.at(1).trimmed().toUInt();
361 langName = langInfo.at(2).trimmed();
368 if(!(langId.isEmpty() || langName.isEmpty() || systemId == 0))
370 if(lamexp_translation_register(langId, qmFile, langName, systemId, country))
372 qDebug("Registering translation: %s = %s (%u) [%u]", qmFile.toUtf8().constData(), langName.toUtf8().constData(), systemId, country);
376 qWarning("Failed to register: %s", qmFile.toLatin1().constData());
381 qDebug("All registered.\n");
384 void InitializationThread::initNeroAac(void)
386 const QString appPath = QDir(QCoreApplication::applicationDirPath()).canonicalPath();
388 QFileInfo neroFileInfo[3];
389 neroFileInfo[0] = QFileInfo(QString("%1/neroAacEnc.exe").arg(appPath));
390 neroFileInfo[1] = QFileInfo(QString("%1/neroAacDec.exe").arg(appPath));
391 neroFileInfo[2] = QFileInfo(QString("%1/neroAacTag.exe").arg(appPath));
393 bool neroFilesFound = true;
394 for(int i = 0; i < 3; i++) { if(!neroFileInfo[i].exists()) neroFilesFound = false; }
396 //Lock the Nero binaries
399 qDebug("Nero encoder binaries not found -> AAC encoding support will be disabled!\n");
403 qDebug("Found Nero AAC encoder binary:\n%s\n", neroFileInfo[0].canonicalFilePath().toUtf8().constData());
405 LockedFile *neroBin[3];
406 for(int i = 0; i < 3; i++) neroBin[i] = NULL;
410 for(int i = 0; i < 3; i++)
412 neroBin[i] = new LockedFile(neroFileInfo[i].canonicalFilePath());
417 for(int i = 0; i < 3; i++) LAMEXP_DELETE(neroBin[i]);
418 qWarning("Failed to get excluive lock to Nero encoder binary -> AAC encoding support will be disabled!");
423 process.setProcessChannelMode(QProcess::MergedChannels);
424 process.setReadChannel(QProcess::StandardOutput);
425 process.start(neroFileInfo[0].canonicalFilePath(), QStringList() << "-help");
427 if(!process.waitForStarted())
429 qWarning("Nero process failed to create!");
430 qWarning("Error message: \"%s\"\n", process.errorString().toLatin1().constData());
432 process.waitForFinished(-1);
433 for(int i = 0; i < 3; i++) LAMEXP_DELETE(neroBin[i]);
437 unsigned int neroVersion = 0;
439 while(process.state() != QProcess::NotRunning)
441 if(!process.waitForReadyRead())
443 if(process.state() == QProcess::Running)
445 qWarning("Nero process time out -> killing!");
447 process.waitForFinished(-1);
448 for(int i = 0; i < 3; i++) LAMEXP_DELETE(neroBin[i]);
453 while(process.canReadLine())
455 QString line = QString::fromUtf8(process.readLine().constData()).simplified();
456 QStringList tokens = line.split(" ", QString::SkipEmptyParts, Qt::CaseInsensitive);
457 int index1 = tokens.indexOf("Package");
458 int index2 = tokens.indexOf("version:");
459 if(index1 >= 0 && index2 >= 0 && index1 + 1 == index2 && index2 < tokens.count() - 1)
461 QStringList versionTokens = tokens.at(index2 + 1).split(".", QString::SkipEmptyParts, Qt::CaseInsensitive);
462 if(versionTokens.count() == 4)
465 neroVersion += qMin(9, qMax(0, versionTokens.at(3).toInt()));
466 neroVersion += qMin(9, qMax(0, versionTokens.at(2).toInt())) * 10;
467 neroVersion += qMin(9, qMax(0, versionTokens.at(1).toInt())) * 100;
468 neroVersion += qMin(9, qMax(0, versionTokens.at(0).toInt())) * 1000;
474 if(!(neroVersion > 0))
476 qWarning("Nero AAC version could not be determined -> AAC encoding support will be disabled!");
477 for(int i = 0; i < 3; i++) LAMEXP_DELETE(neroBin[i]);
481 for(int i = 0; i < 3; i++)
483 lamexp_register_tool(neroFileInfo[i].fileName(), neroBin[i], neroVersion);
487 void InitializationThread::initFhgAac(void)
489 const QString appPath = QDir(QCoreApplication::applicationDirPath()).canonicalPath();
491 QFileInfo fhgFileInfo[5];
492 fhgFileInfo[0] = QFileInfo(QString("%1/fhgaacenc.exe").arg(appPath));
493 fhgFileInfo[1] = QFileInfo(QString("%1/enc_fhgaac.dll").arg(appPath));
494 fhgFileInfo[2] = QFileInfo(QString("%1/nsutil.dll").arg(appPath));
495 fhgFileInfo[3] = QFileInfo(QString("%1/libmp4v2.dll").arg(appPath));
496 fhgFileInfo[4] = QFileInfo(QString("%1/libsndfile-1.dll").arg(appPath));
498 bool fhgFilesFound = true;
499 for(int i = 0; i < 5; i++) { if(!fhgFileInfo[i].exists()) fhgFilesFound = false; }
501 //Lock the FhgAacEnc binaries
504 qDebug("FhgAacEnc binaries not found -> FhgAacEnc support will be disabled!\n");
508 qDebug("Found FhgAacEnc cli_exe:\n%s\n", fhgFileInfo[0].canonicalFilePath().toUtf8().constData());
509 qDebug("Found FhgAacEnc enc_dll:\n%s\n", fhgFileInfo[1].canonicalFilePath().toUtf8().constData());
511 LockedFile *fhgBin[5];
512 for(int i = 0; i < 5; i++) fhgBin[i] = NULL;
516 for(int i = 0; i < 5; i++)
518 fhgBin[i] = new LockedFile(fhgFileInfo[i].canonicalFilePath());
523 for(int i = 0; i < 5; i++) LAMEXP_DELETE(fhgBin[i]);
524 qWarning("Failed to get excluive lock to FhgAacEnc binary -> FhgAacEnc support will be disabled!");
529 process.setProcessChannelMode(QProcess::MergedChannels);
530 process.setReadChannel(QProcess::StandardOutput);
531 process.start(fhgFileInfo[0].canonicalFilePath(), QStringList() << "--version");
533 if(!process.waitForStarted())
535 qWarning("FhgAacEnc process failed to create!");
536 qWarning("Error message: \"%s\"\n", process.errorString().toLatin1().constData());
538 process.waitForFinished(-1);
539 for(int i = 0; i < 5; i++) LAMEXP_DELETE(fhgBin[i]);
543 QRegExp fhgAacEncSig("fhgaacenc version (\\d+) by tmkk", Qt::CaseInsensitive);
544 unsigned int fhgVersion = 0;
546 while(process.state() != QProcess::NotRunning)
548 process.waitForReadyRead();
549 if(!process.bytesAvailable() && process.state() == QProcess::Running)
551 qWarning("FhgAacEnc process time out -> killing!");
553 process.waitForFinished(-1);
554 for(int i = 0; i < 5; i++) LAMEXP_DELETE(fhgBin[i]);
557 while(process.bytesAvailable() > 0)
559 QString line = QString::fromUtf8(process.readLine().constData()).simplified();
560 if(fhgAacEncSig.lastIndexIn(line) >= 0)
563 unsigned int temp = fhgAacEncSig.cap(1).toUInt(&ok);
564 if(ok) fhgVersion = temp;
569 if(!(fhgVersion > 0))
571 qWarning("FhgAacEnc version couldn't be determined -> FhgAacEnc support will be disabled!");
572 for(int i = 0; i < 5; i++) LAMEXP_DELETE(fhgBin[i]);
575 else if(fhgVersion < lamexp_toolver_fhgaacenc())
577 qWarning("FhgAacEnc version is too much outdated (%s) -> FhgAacEnc support will be disabled!", lamexp_version2string("????-??-??", fhgVersion, "N/A").toLatin1().constData());
578 qWarning("Minimum required FhgAacEnc version currently is: %s\n", lamexp_version2string("????-??-??", lamexp_toolver_fhgaacenc(), "N/A").toLatin1().constData());
579 for(int i = 0; i < 5; i++) LAMEXP_DELETE(fhgBin[i]);
583 for(int i = 0; i < 5; i++)
585 lamexp_register_tool(fhgFileInfo[i].fileName(), fhgBin[i], fhgVersion);
589 void InitializationThread::initQAac(void)
591 const QString appPath = QDir(QCoreApplication::applicationDirPath()).canonicalPath();
593 QFileInfo qaacFileInfo[2];
594 qaacFileInfo[0] = QFileInfo(QString("%1/qaac.exe").arg(appPath));
595 qaacFileInfo[1] = QFileInfo(QString("%1/libsoxrate.dll").arg(appPath));
597 bool qaacFilesFound = true;
598 for(int i = 0; i < 2; i++) { if(!qaacFileInfo[i].exists()) qaacFilesFound = false; }
600 //Lock the QAAC binaries
603 qDebug("QAAC binaries not found -> QAAC support will be disabled!\n");
607 qDebug("Found QAAC encoder:\n%s\n", qaacFileInfo[0].canonicalFilePath().toUtf8().constData());
609 LockedFile *qaacBin[2];
610 for(int i = 0; i < 2; i++) qaacBin[i] = NULL;
614 for(int i = 0; i < 2; i++)
616 qaacBin[i] = new LockedFile(qaacFileInfo[i].canonicalFilePath());
621 for(int i = 0; i < 2; i++) LAMEXP_DELETE(qaacBin[i]);
622 qWarning("Failed to get excluive lock to QAAC binary -> QAAC support will be disabled!");
627 process.setProcessChannelMode(QProcess::MergedChannels);
628 process.setReadChannel(QProcess::StandardOutput);
629 process.start(qaacFileInfo[0].canonicalFilePath(), QStringList() << "--check");
631 if(!process.waitForStarted())
633 qWarning("QAAC process failed to create!");
634 qWarning("Error message: \"%s\"\n", process.errorString().toLatin1().constData());
636 process.waitForFinished(-1);
637 for(int i = 0; i < 2; i++) LAMEXP_DELETE(qaacBin[i]);
641 QRegExp qaacEncSig("qaac (\\d)\\.(\\d)(\\d)", Qt::CaseInsensitive);
642 QRegExp coreEncSig("CoreAudioToolbox (\\d)\\.(\\d)\\.(\\d)\\.(\\d)", Qt::CaseInsensitive);
643 unsigned int qaacVersion = 0;
644 unsigned int coreVersion = 0;
646 while(process.state() != QProcess::NotRunning)
648 process.waitForReadyRead();
649 if(!process.bytesAvailable() && process.state() == QProcess::Running)
651 qWarning("QAAC process time out -> killing!");
653 process.waitForFinished(-1);
654 for(int i = 0; i < 2; i++) LAMEXP_DELETE(qaacBin[i]);
657 while(process.bytesAvailable() > 0)
659 QString line = QString::fromUtf8(process.readLine().constData()).simplified();
660 if(qaacEncSig.lastIndexIn(line) >= 0)
662 unsigned int tmp[3] = {0, 0, 0};
663 bool ok[3] = {false, false, false};
664 tmp[0] = qaacEncSig.cap(1).toUInt(&ok[0]);
665 tmp[1] = qaacEncSig.cap(2).toUInt(&ok[1]);
666 tmp[2] = qaacEncSig.cap(3).toUInt(&ok[2]);
667 if(ok[0] && ok[1] && ok[2])
669 qaacVersion = (qBound(0U, tmp[0], 9U) * 100) + (qBound(0U, tmp[1], 9U) * 10) + qBound(0U, tmp[2], 9U);
672 if(coreEncSig.lastIndexIn(line) >= 0)
674 unsigned int tmp[4] = {0, 0, 0, 0};
675 bool ok[4] = {false, false, false, false};
676 tmp[0] = coreEncSig.cap(1).toUInt(&ok[0]);
677 tmp[1] = coreEncSig.cap(2).toUInt(&ok[1]);
678 tmp[2] = coreEncSig.cap(3).toUInt(&ok[2]);
679 tmp[3] = coreEncSig.cap(4).toUInt(&ok[3]);
680 if(ok[0] && ok[1] && ok[2] && ok[3])
682 coreVersion = (qBound(0U, tmp[0], 9U) * 1000) + (qBound(0U, tmp[1], 9U) * 100) + (qBound(0U, tmp[2], 9U) * 10) + qBound(0U, tmp[3], 9U);
688 //qDebug("qaac %d, CoreAudioToolbox %d", qaacVersion, coreVersion);
690 if(!(qaacVersion > 0))
692 qWarning("QAAC version couldn't be determined -> QAAC support will be disabled!");
693 for(int i = 0; i < 2; i++) LAMEXP_DELETE(qaacBin[i]);
696 else if(qaacVersion < lamexp_toolver_qaacenc())
698 qWarning("QAAC version is too much outdated (%s) -> QAAC support will be disabled!", lamexp_version2string("v?.??", qaacVersion, "N/A").toLatin1().constData());
699 qWarning("Minimum required QAAC version currently is: %s.\n", lamexp_version2string("v?.??", lamexp_toolver_qaacenc(), "N/A").toLatin1().constData());
700 for(int i = 0; i < 2; i++) LAMEXP_DELETE(qaacBin[i]);
704 if(!(coreVersion > 0))
706 qWarning("CoreAudioToolbox version couldn't be determined -> QAAC support will be disabled!");
707 for(int i = 0; i < 2; i++) LAMEXP_DELETE(qaacBin[i]);
710 else if(coreVersion < lamexp_toolver_coreaudio())
712 qWarning("CoreAudioToolbox version is too much outdated (%s) -> QAAC support will be disabled!", lamexp_version2string("v?.?.?.?", coreVersion, "N/A").toLatin1().constData());
713 qWarning("Minimum required CoreAudioToolbox version currently is: %s.\n", lamexp_version2string("v?.??", lamexp_toolver_coreaudio(), "N/A").toLatin1().constData());
714 for(int i = 0; i < 2; i++) LAMEXP_DELETE(qaacBin[i]);
718 lamexp_register_tool(qaacFileInfo[0].fileName(), qaacBin[0], qaacVersion);
719 lamexp_register_tool(qaacFileInfo[1].fileName(), qaacBin[1], qaacVersion);
722 void InitializationThread::selfTest(void)
724 const unsigned int cpu[4] = {CPU_TYPE_X86_GEN, CPU_TYPE_X86_SSE, CPU_TYPE_X64_GEN, CPU_TYPE_X64_SSE};
726 for(size_t k = 0; k < 4; k++)
731 PRINT_CPU_TYPE(CPU_TYPE_X86_GEN); break;
732 PRINT_CPU_TYPE(CPU_TYPE_X86_SSE); break;
733 PRINT_CPU_TYPE(CPU_TYPE_X64_GEN); break;
734 PRINT_CPU_TYPE(CPU_TYPE_X64_SSE); break;
735 default: throw "CPU support undefined!";
738 for(int i = 0; i < INT_MAX; i++)
740 if(!g_lamexp_tools[i].pcName && !g_lamexp_tools[i].pcHash && !g_lamexp_tools[i].uiVersion)
744 if(g_lamexp_tools[i].uiCpuType & cpu[k])
746 qDebug("%02i -> %s", ++n, g_lamexp_tools[i].pcName);
751 qFatal("Tool count mismatch !!!");
757 ////////////////////////////////////////////////////////////
759 ////////////////////////////////////////////////////////////