Added experimental(!) support for FhgAacEnc. Replaces the Nero AAC encoder, if available.
This commit is contained in:
parent
12828f386e
commit
84883ab519
@ -131,11 +131,13 @@ copy "$(QTDIR)\plugins\imageformats\q????d4.dll" "$(TargetDir)imageformats\"
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>
|
||||
</DebugInformationFormat>
|
||||
<CreateHotpatchableImage>false</CreateHotpatchableImage>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<OpenMPSupport>false</OpenMPSupport>
|
||||
<DebugInformationFormat>
|
||||
</DebugInformationFormat>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<CompileAsManaged>false</CompileAsManaged>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalOptions>"/MANIFESTDEPENDENCY:type=%27win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27 processorArchitecture=%27*%27" %(AdditionalOptions)</AdditionalOptions>
|
||||
@ -157,6 +159,11 @@ copy "$(QTDIR)\plugins\imageformats\q????d4.dll" "$(TargetDir)imageformats\"
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<MinimumRequiredVersion>5.0</MinimumRequiredVersion>
|
||||
<EntryPointSymbol>lamexp_crt_startup</EntryPointSymbol>
|
||||
<MapFileName>
|
||||
</MapFileName>
|
||||
<TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors>
|
||||
<CreateHotPatchableImage>
|
||||
</CreateHotPatchableImage>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Message>Copy plugin DLL%27s</Message>
|
||||
@ -196,11 +203,12 @@ del "$(TargetDir)imageformats\q???d4.dll"
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>
|
||||
</DebugInformationFormat>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<CreateHotpatchableImage>false</CreateHotpatchableImage>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<OpenMPSupport>false</OpenMPSupport>
|
||||
<CompileAsManaged>false</CompileAsManaged>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalOptions>"/MANIFESTDEPENDENCY:type=%27win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27 processorArchitecture=%27*%27" %(AdditionalOptions)</AdditionalOptions>
|
||||
@ -208,10 +216,10 @@ del "$(TargetDir)imageformats\q???d4.dll"
|
||||
<ShowProgress>LinkVerboseLib</ShowProgress>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)\etc\Prerequisites\qt4_static\lib;$(SolutionDir)\etc\Prerequisites\qt4_static\plugins\imageformats;$(SolutionDir)\etc\Prerequisites\EncodePointer\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AssemblyDebug>
|
||||
</AssemblyDebug>
|
||||
<MapExports>false</MapExports>
|
||||
<MapExports>true</MapExports>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
@ -220,6 +228,10 @@ del "$(TargetDir)imageformats\q???d4.dll"
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<MinimumRequiredVersion>5.0</MinimumRequiredVersion>
|
||||
<EntryPointSymbol>lamexp_crt_startup</EntryPointSymbol>
|
||||
<GenerateMapFile>true</GenerateMapFile>
|
||||
<MapFileName>
|
||||
</MapFileName>
|
||||
<TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>
|
||||
@ -258,6 +270,7 @@ del "$(TargetDir)imageformats\q???d4.dll"
|
||||
<ClCompile Include="src\Dialog_Update.cpp" />
|
||||
<ClCompile Include="src\Dialog_WorkingBanner.cpp" />
|
||||
<ClCompile Include="src\Encoder_AAC.cpp" />
|
||||
<ClCompile Include="src\Encoder_AAC_FHG.cpp" />
|
||||
<ClCompile Include="src\Encoder_Abstract.cpp" />
|
||||
<ClCompile Include="src\Encoder_AC3.cpp" />
|
||||
<ClCompile Include="src\Encoder_FLAC.cpp" />
|
||||
@ -305,6 +318,7 @@ del "$(TargetDir)imageformats\q???d4.dll"
|
||||
<ClCompile Include="tmp\MOC_Dialog_Update.cpp" />
|
||||
<ClCompile Include="tmp\MOC_Dialog_WorkingBanner.cpp" />
|
||||
<ClCompile Include="tmp\MOC_Encoder_AAC.cpp" />
|
||||
<ClCompile Include="tmp\MOC_Encoder_AAC_FHG.cpp" />
|
||||
<ClCompile Include="tmp\MOC_Encoder_Abstract.cpp" />
|
||||
<ClCompile Include="tmp\MOC_Encoder_AC3.cpp" />
|
||||
<ClCompile Include="tmp\MOC_Encoder_FLAC.cpp" />
|
||||
@ -382,6 +396,17 @@ del "$(TargetDir)imageformats\q???d4.dll"
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\MOC_%(Filename).cpp;%(Outputs)</Outputs>
|
||||
</CustomBuild>
|
||||
<ClInclude Include="src\Decoder_Avisynth.h" />
|
||||
<CustomBuild Include="src\Encoder_AAC_FHG.h">
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\MOC_%(Filename).cpp" "%(FullPath)"</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\MOC_%(Filename).cpp" "%(FullPath)"</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\MOC_%(Filename).cpp" "%(FullPath)"</Command>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">MOC "$(SolutionDir)tmp\MOC_%(Filename).cpp"</Message>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">MOC "$(SolutionDir)tmp\MOC_%(Filename).cpp"</Message>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MOC "$(SolutionDir)tmp\MOC_%(Filename).cpp"</Message>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)tmp\MOC_%(Filename).cpp;%(Outputs)</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">$(SolutionDir)tmp\MOC_%(Filename).cpp;%(Outputs)</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\MOC_%(Filename).cpp;%(Outputs)</Outputs>
|
||||
</CustomBuild>
|
||||
<ClInclude Include="tmp\UIC_CueSheetImport.h" />
|
||||
<ClInclude Include="tmp\UIC_DropBox.h" />
|
||||
<ClInclude Include="tmp\UIC_LogViewDialog.h" />
|
||||
|
@ -310,6 +310,12 @@
|
||||
<ClCompile Include="src\Decoder_Avisynth.cpp">
|
||||
<Filter>Source Files\Decoders</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Encoder_AAC_FHG.cpp">
|
||||
<Filter>Source Files\Encoders</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="tmp\MOC_Encoder_AAC_FHG.cpp">
|
||||
<Filter>Generated Files\MOC</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="src\Config.h">
|
||||
@ -584,6 +590,9 @@
|
||||
<CustomBuild Include="src\Thread_CueSplitter.h">
|
||||
<Filter>Header Files\Threads</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="src\Encoder_AAC_FHG.h">
|
||||
<Filter>Header Files\Encoders</Filter>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="res\MainIcon.ico" />
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -29,8 +29,8 @@
|
||||
#define VER_LAMEXP_MINOR_HI 0
|
||||
#define VER_LAMEXP_MINOR_LO 3
|
||||
#define VER_LAMEXP_TYPE Alpha
|
||||
#define VER_LAMEXP_PATCH 12
|
||||
#define VER_LAMEXP_BUILD 648
|
||||
#define VER_LAMEXP_PATCH 13
|
||||
#define VER_LAMEXP_BUILD 652
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Tools versions
|
||||
|
@ -86,6 +86,7 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
|
||||
m_metaData(metaInfo),
|
||||
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_accepted(false),
|
||||
m_firstTimeShown(true),
|
||||
m_OutputFolderViewInitialized(false)
|
||||
@ -200,10 +201,10 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
|
||||
m_modeButtonGroup->addButton(radioButtonModeQuality, SettingsModel::VBRMode);
|
||||
m_modeButtonGroup->addButton(radioButtonModeAverageBitrate, SettingsModel::ABRMode);
|
||||
m_modeButtonGroup->addButton(radioButtonConstBitrate, SettingsModel::CBRMode);
|
||||
radioButtonEncoderAAC->setEnabled(m_neroEncoderAvailable);
|
||||
radioButtonEncoderAAC->setEnabled(m_neroEncoderAvailable || m_fhgEncoderAvailable);
|
||||
radioButtonEncoderMP3->setChecked(m_settings->compressionEncoder() == SettingsModel::MP3Encoder);
|
||||
radioButtonEncoderVorbis->setChecked(m_settings->compressionEncoder() == SettingsModel::VorbisEncoder);
|
||||
radioButtonEncoderAAC->setChecked((m_settings->compressionEncoder() == SettingsModel::AACEncoder) && m_neroEncoderAvailable);
|
||||
radioButtonEncoderAAC->setChecked((m_settings->compressionEncoder() == SettingsModel::AACEncoder) && (m_neroEncoderAvailable || m_fhgEncoderAvailable));
|
||||
radioButtonEncoderAC3->setChecked(m_settings->compressionEncoder() == SettingsModel::AC3Encoder);
|
||||
radioButtonEncoderFLAC->setChecked(m_settings->compressionEncoder() == SettingsModel::FLACEncoder);
|
||||
radioButtonEncoderPCM->setChecked(m_settings->compressionEncoder() == SettingsModel::PCMEncoder);
|
||||
@ -988,7 +989,7 @@ void MainWindow::windowShown(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
if(m_settings->neroAacNotificationsEnabled())
|
||||
if(m_settings->neroAacNotificationsEnabled() && (!m_fhgEncoderAvailable))
|
||||
{
|
||||
QString appPath = QDir(QCoreApplication::applicationDirPath()).canonicalPath();
|
||||
if(appPath.isEmpty()) appPath = QCoreApplication::applicationDirPath();
|
||||
@ -1007,32 +1008,6 @@ void MainWindow::windowShown(void)
|
||||
}
|
||||
}
|
||||
|
||||
//Check for WMA support
|
||||
//if(m_settings->wmaDecoderNotificationsEnabled())
|
||||
//{
|
||||
// if(!lamexp_check_tool("wmawav.exe"))
|
||||
// {
|
||||
// QString messageText;
|
||||
// messageText += QString("<nobr>%1</nobr><br>").arg(tr("LameXP has detected that the WMA File Decoder component is not currently installed on your system.").replace("-", "−"));
|
||||
// messageText += QString("<nobr>%1</nobr><br><br>").arg(tr("You won't be able to process WMA files as input unless the WMA File Decoder component is installed!").replace("-", "−"));
|
||||
// messageText += QString("<nobr>%1</nobr>").arg(tr("Do you want to download and install the WMA File Decoder component now?").replace("-", "−"));
|
||||
// int result = QMessageBox::information(this, tr("WMA Decoder Missing"), messageText, tr("Download && Install"), tr("Don't Show Again"), tr("Postpone"));
|
||||
// if(result == 0)
|
||||
// {
|
||||
// if(installWMADecoder())
|
||||
// {
|
||||
// QApplication::quit();
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// else if(result == 1)
|
||||
// {
|
||||
// m_settings->wmaDecoderNotificationsEnabled(false);
|
||||
// actionDisableWmaDecoderNotifications->setChecked(!m_settings->wmaDecoderNotificationsEnabled());
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
//Add files from the command-line
|
||||
for(int i = 0; i < arguments.count() - 1; i++)
|
||||
{
|
||||
|
@ -154,6 +154,7 @@ private:
|
||||
bool m_OutputFolderViewInitialized;
|
||||
|
||||
const bool m_neroEncoderAvailable;
|
||||
const bool m_fhgEncoderAvailable;
|
||||
|
||||
WorkingBanner *m_banner;
|
||||
QStringList *m_delayedFileList;
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "Encoder_MP3.h"
|
||||
#include "Encoder_Vorbis.h"
|
||||
#include "Encoder_AAC.h"
|
||||
#include "Encoder_AAC_FHG.h"
|
||||
#include "Encoder_AC3.h"
|
||||
#include "Encoder_FLAC.h"
|
||||
#include "Encoder_Wave.h"
|
||||
@ -594,6 +595,8 @@ void ProcessingDialog::startNextJob(void)
|
||||
}
|
||||
break;
|
||||
case SettingsModel::AACEncoder:
|
||||
{
|
||||
if(lamexp_lookup_tool("fhgaacenc.exe").isEmpty() || lamexp_lookup_tool("enc_fhgaac.dll").isEmpty())
|
||||
{
|
||||
AACEncoder *aacEncoder = new AACEncoder();
|
||||
aacEncoder->setBitrate(m_settings->compressionBitrate());
|
||||
@ -603,6 +606,15 @@ void ProcessingDialog::startNextJob(void)
|
||||
aacEncoder->setCustomParams(m_settings->customParametersNeroAAC());
|
||||
encoder = aacEncoder;
|
||||
}
|
||||
else
|
||||
{
|
||||
FHGAACEncoder *aacEncoder = new FHGAACEncoder();
|
||||
aacEncoder->setBitrate(m_settings->compressionBitrate());
|
||||
aacEncoder->setRCMode(m_settings->compressionRCMode());
|
||||
aacEncoder->setProfile(m_settings->neroAACProfile());
|
||||
encoder = aacEncoder;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SettingsModel::AC3Encoder:
|
||||
{
|
||||
|
176
src/Encoder_AAC_FHG.cpp
Normal file
176
src/Encoder_AAC_FHG.cpp
Normal file
@ -0,0 +1,176 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// LameXP - Audio Encoder Front-End
|
||||
// Copyright (C) 2004-2011 LoRd_MuldeR <MuldeR2@GMX.de>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
//
|
||||
// http://www.gnu.org/licenses/gpl-2.0.txt
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "Encoder_AAC_FHG.h"
|
||||
|
||||
#include "Global.h"
|
||||
#include "Model_Settings.h"
|
||||
|
||||
#include <QProcess>
|
||||
#include <QDir>
|
||||
|
||||
#define max(a,b) (((a) > (b)) ? (a) : (b))
|
||||
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
||||
|
||||
FHGAACEncoder::FHGAACEncoder(void)
|
||||
:
|
||||
m_binary_enc(lamexp_lookup_tool("fhgaacenc.exe")),
|
||||
m_binary_dll(lamexp_lookup_tool("enc_fhgaac.dll"))
|
||||
{
|
||||
if(m_binary_enc.isEmpty() || m_binary_dll.isEmpty())
|
||||
{
|
||||
throw "Error initializing FhgAacEnc. Tool 'fhgaacenc.exe' is not registred!";
|
||||
}
|
||||
|
||||
m_configProfile = 0;
|
||||
}
|
||||
|
||||
FHGAACEncoder::~FHGAACEncoder(void)
|
||||
{
|
||||
}
|
||||
|
||||
bool FHGAACEncoder::encode(const QString &sourceFile, const AudioFileModel &metaInfo, const QString &outputFile, volatile bool *abortFlag)
|
||||
{
|
||||
QProcess process;
|
||||
QStringList args;
|
||||
|
||||
switch(m_configRCMode)
|
||||
{
|
||||
case SettingsModel::VBRMode:
|
||||
args << "--vbr" << QString::number(max(1, min(5, m_configBitrate)));
|
||||
break;
|
||||
case SettingsModel::CBRMode:
|
||||
args << "--cbr" << QString::number(max(32, min(500, (m_configBitrate * 8))));
|
||||
break;
|
||||
case SettingsModel::ABRMode:
|
||||
qWarning("FhgAacEnc does not support ABR mode -> failure!");
|
||||
emit messageLogged("\nTHIS ENCODER DOES NOT SUPPORT AN \"ABR\" MODE !!!");
|
||||
return false;
|
||||
break;
|
||||
default:
|
||||
throw "Bad rate-control mode!";
|
||||
break;
|
||||
}
|
||||
|
||||
switch(m_configProfile)
|
||||
{
|
||||
case 1:
|
||||
args << "--profile" << "lc"; //Forces use of LC AAC profile
|
||||
break;
|
||||
case 2:
|
||||
args << "--profile" << "he"; //Forces use of HE AAC profile
|
||||
break;
|
||||
case 3:
|
||||
args << "--profile" << "hev2"; //Forces use of HEv2 AAC profile
|
||||
break;
|
||||
}
|
||||
|
||||
args << "--dll" << m_binary_dll;
|
||||
|
||||
args << QDir::toNativeSeparators(sourceFile);
|
||||
args << QDir::toNativeSeparators(outputFile);
|
||||
|
||||
if(!startProcess(process, m_binary_enc, args))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool bTimeout = false;
|
||||
bool bAborted = false;
|
||||
|
||||
QRegExp regExp("Progress:\\s*(\\d+)%");
|
||||
|
||||
while(process.state() != QProcess::NotRunning)
|
||||
{
|
||||
if(*abortFlag)
|
||||
{
|
||||
process.kill();
|
||||
bAborted = true;
|
||||
emit messageLogged("\nABORTED BY USER !!!");
|
||||
break;
|
||||
}
|
||||
process.waitForReadyRead(m_processTimeoutInterval);
|
||||
if(!process.bytesAvailable() && process.state() == QProcess::Running)
|
||||
{
|
||||
process.kill();
|
||||
qWarning("FhgAacEnc process timed out <-- killing!");
|
||||
emit messageLogged("\nPROCESS TIMEOUT !!!");
|
||||
bTimeout = true;
|
||||
break;
|
||||
}
|
||||
while(process.bytesAvailable() > 0)
|
||||
{
|
||||
QByteArray line = process.readLine();
|
||||
QString text = QString::fromUtf8(line.constData()).simplified();
|
||||
if(regExp.lastIndexIn(text) >= 0)
|
||||
{
|
||||
bool ok = false;
|
||||
int progress = regExp.cap(1).toInt(&ok);
|
||||
if(ok) emit statusUpdated(progress);
|
||||
}
|
||||
else if(!text.isEmpty())
|
||||
{
|
||||
emit messageLogged(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
process.waitForFinished();
|
||||
if(process.state() != QProcess::NotRunning)
|
||||
{
|
||||
process.kill();
|
||||
process.waitForFinished(-1);
|
||||
}
|
||||
|
||||
emit statusUpdated(100);
|
||||
emit messageLogged(QString().sprintf("\nExited with code: 0x%04X", process.exitCode()));
|
||||
|
||||
if(bTimeout || bAborted || process.exitStatus() != QProcess::NormalExit)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QString FHGAACEncoder::extension(void)
|
||||
{
|
||||
return "mp4";
|
||||
}
|
||||
|
||||
bool FHGAACEncoder::isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion)
|
||||
{
|
||||
if(containerType.compare("Wave", Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
if(formatType.compare("PCM", Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void FHGAACEncoder::setProfile(int profile)
|
||||
{
|
||||
m_configProfile = profile;
|
||||
}
|
47
src/Encoder_AAC_FHG.h
Normal file
47
src/Encoder_AAC_FHG.h
Normal file
@ -0,0 +1,47 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// LameXP - Audio Encoder Front-End
|
||||
// Copyright (C) 2004-2011 LoRd_MuldeR <MuldeR2@GMX.de>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
//
|
||||
// http://www.gnu.org/licenses/gpl-2.0.txt
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Encoder_Abstract.h"
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class FHGAACEncoder : public AbstractEncoder
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FHGAACEncoder(void);
|
||||
~FHGAACEncoder(void);
|
||||
|
||||
virtual bool encode(const QString &sourceFile, const AudioFileModel &metaInfo, const QString &outputFile, volatile bool *abortFlag);
|
||||
virtual bool isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion);
|
||||
virtual QString extension(void);
|
||||
|
||||
//Advanced options
|
||||
virtual void setProfile(int profile);
|
||||
|
||||
private:
|
||||
const QString m_binary_enc;
|
||||
const QString m_binary_dll;
|
||||
int m_configProfile;
|
||||
};
|
@ -233,9 +233,12 @@ void InitializationThread::run()
|
||||
//Register all translations
|
||||
initTranslations();
|
||||
|
||||
//Look for Nero encoder
|
||||
//Look for Nero AAC encoder
|
||||
initNeroAac();
|
||||
|
||||
//Look for FHG AAC encoder
|
||||
initFhgAac();
|
||||
|
||||
delay();
|
||||
m_bSuccess = true;
|
||||
}
|
||||
@ -410,6 +413,105 @@ void InitializationThread::initNeroAac(void)
|
||||
}
|
||||
}
|
||||
|
||||
void InitializationThread::initFhgAac(void)
|
||||
{
|
||||
const QString appPath = QDir(QCoreApplication::applicationDirPath()).canonicalPath();
|
||||
|
||||
QFileInfo fhgFileInfo[4];
|
||||
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));
|
||||
|
||||
bool fhgFilesFound = true;
|
||||
for(int i = 0; i < 4; 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;
|
||||
}
|
||||
|
||||
qDebug("Found FhgAacEnc executable:\n%s\n", fhgFileInfo[0].canonicalFilePath().toUtf8().constData());
|
||||
qDebug("Found FhgAacEnc enclibrary:\n%s\n", fhgFileInfo[1].canonicalFilePath().toUtf8().constData());
|
||||
|
||||
LockedFile *fhgBin[4];
|
||||
for(int i = 0; i < 4; i++) fhgBin[i] = NULL;
|
||||
|
||||
try
|
||||
{
|
||||
for(int i = 0; i < 4; i++)
|
||||
{
|
||||
fhgBin[i] = new LockedFile(fhgFileInfo[i].canonicalFilePath());
|
||||
}
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
for(int i = 0; i < 4; i++) LAMEXP_DELETE(fhgBin[i]);
|
||||
qWarning("Failed to get excluive lock to FhgAacEnc binary -> FhgAacEnc support will be disabled!");
|
||||
return;
|
||||
}
|
||||
|
||||
QProcess process;
|
||||
process.setProcessChannelMode(QProcess::MergedChannels);
|
||||
process.setReadChannel(QProcess::StandardOutput);
|
||||
process.start(fhgFileInfo[0].canonicalFilePath(), QStringList() << "--version");
|
||||
|
||||
if(!process.waitForStarted())
|
||||
{
|
||||
qWarning("FhgAacEnc process failed to create!");
|
||||
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]);
|
||||
return;
|
||||
}
|
||||
|
||||
QRegExp fhgAacEncSig("fhgaacenc version (\\d+) by tmkk", Qt::CaseInsensitive);
|
||||
unsigned int fhgVersion = 0;
|
||||
|
||||
while(process.state() != QProcess::NotRunning)
|
||||
{
|
||||
process.waitForReadyRead();
|
||||
if(!process.bytesAvailable() && process.state() == QProcess::Running)
|
||||
{
|
||||
qWarning("FhgAacEnc process time out -> killing!");
|
||||
process.kill();
|
||||
process.waitForFinished(-1);
|
||||
for(int i = 0; i < 4; i++) LAMEXP_DELETE(fhgBin[i]);
|
||||
return;
|
||||
}
|
||||
while(process.bytesAvailable() > 0)
|
||||
{
|
||||
QString line = QString::fromUtf8(process.readLine().constData()).simplified();
|
||||
if(fhgAacEncSig.lastIndexIn(line) >= 0)
|
||||
{
|
||||
bool ok = false;
|
||||
unsigned int temp = fhgAacEncSig.cap(1).toUInt(&ok);
|
||||
if(ok) fhgVersion = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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]);
|
||||
return;
|
||||
}
|
||||
else if(fhgVersion < 20110819)
|
||||
{
|
||||
qWarning("FhgAacEnc version is too much outdated -> FhgAacEnc support will be disabled!");
|
||||
for(int i = 0; i < 4; i++) LAMEXP_DELETE(fhgBin[i]);
|
||||
return;
|
||||
}
|
||||
|
||||
for(int i = 0; i < 4; i++)
|
||||
{
|
||||
lamexp_register_tool(fhgFileInfo[i].fileName(), fhgBin[i], fhgVersion);
|
||||
}
|
||||
}
|
||||
|
||||
//void InitializationThread::initWmaDec(void)
|
||||
//{
|
||||
|
@ -42,6 +42,7 @@ private:
|
||||
void delay(void);
|
||||
void initTranslations(void);
|
||||
void initNeroAac(void);
|
||||
void initFhgAac(void);
|
||||
|
||||
bool m_bSuccess;
|
||||
lamexp_cpu_t m_cpuFeatures;
|
||||
|
Loading…
Reference in New Issue
Block a user