Implemented AbstractEncoderInfo for some more encoders. Remaining encoders not yet working.

This commit is contained in:
LoRd_MuldeR 2013-10-02 19:17:33 +02:00
parent 6c9e3c562f
commit d76c4a1702
14 changed files with 344 additions and 110 deletions

View File

@ -34,7 +34,7 @@
#define VER_LAMEXP_MINOR_LO 9 #define VER_LAMEXP_MINOR_LO 9
#define VER_LAMEXP_TYPE Alpha #define VER_LAMEXP_TYPE Alpha
#define VER_LAMEXP_PATCH 1 #define VER_LAMEXP_PATCH 1
#define VER_LAMEXP_BUILD 1343 #define VER_LAMEXP_BUILD 1345
#define VER_LAMEXP_CONFG 1338 #define VER_LAMEXP_CONFG 1338
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

View File

@ -180,7 +180,6 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
m_metaData(metaInfo), m_metaData(metaInfo),
m_settings(settingsModel), m_settings(settingsModel),
m_fileSystemModel(NULL), m_fileSystemModel(NULL),
m_aacEncoder(SettingsModel::getAacEncoder()),
m_accepted(false), m_accepted(false),
m_firstTimeShown(true), m_firstTimeShown(true),
m_outputFolderViewCentering(false), m_outputFolderViewCentering(false),
@ -351,7 +350,8 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
m_encoderButtonGroup->addButton(ui->radioButtonEncoderDCA, SettingsModel::DCAEncoder); m_encoderButtonGroup->addButton(ui->radioButtonEncoderDCA, SettingsModel::DCAEncoder);
m_encoderButtonGroup->addButton(ui->radioButtonEncoderPCM, SettingsModel::PCMEncoder); m_encoderButtonGroup->addButton(ui->radioButtonEncoderPCM, SettingsModel::PCMEncoder);
ui->radioButtonEncoderAAC->setEnabled(m_aacEncoder > SettingsModel::AAC_ENCODER_NONE); const int aacEncoder = EncoderRegistry::getAacEncoder();
ui->radioButtonEncoderAAC->setEnabled(aacEncoder > SettingsModel::AAC_ENCODER_NONE);
m_modeButtonGroup = new QButtonGroup(this); m_modeButtonGroup = new QButtonGroup(this);
m_modeButtonGroup->addButton(ui->radioButtonModeQuality, SettingsModel::VBRMode); m_modeButtonGroup->addButton(ui->radioButtonModeQuality, SettingsModel::VBRMode);
@ -412,7 +412,7 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
SET_CHECKBOX_STATE(ui->checkBoxRenameOutput, m_settings->renameOutputFilesEnabled()); SET_CHECKBOX_STATE(ui->checkBoxRenameOutput, m_settings->renameOutputFilesEnabled());
SET_CHECKBOX_STATE(ui->checkBoxForceStereoDownmix, m_settings->forceStereoDownmix()); SET_CHECKBOX_STATE(ui->checkBoxForceStereoDownmix, m_settings->forceStereoDownmix());
SET_CHECKBOX_STATE(ui->checkBoxOpusDisableResample, m_settings->opusDisableResample()); SET_CHECKBOX_STATE(ui->checkBoxOpusDisableResample, m_settings->opusDisableResample());
ui->checkBoxNeroAAC2PassMode->setEnabled(m_aacEncoder == SettingsModel::AAC_ENCODER_NERO); ui->checkBoxNeroAAC2PassMode->setEnabled(aacEncoder == SettingsModel::AAC_ENCODER_NERO);
ui->lineEditCustomParamLAME->setText(m_settings->customParametersLAME()); ui->lineEditCustomParamLAME->setText(m_settings->customParametersLAME());
ui->lineEditCustomParamOggEnc->setText(m_settings->customParametersOggEnc()); ui->lineEditCustomParamOggEnc->setText(m_settings->customParametersOggEnc());
@ -955,6 +955,8 @@ void MainWindow::changeEvent(QEvent *e)
{ {
if(e->type() == QEvent::LanguageChange) if(e->type() == QEvent::LanguageChange)
{ {
qWarning("\nMainWindow::changeEvent()\n");
int comboBoxIndex[8]; int comboBoxIndex[8];
//Backup combobox indices, as retranslateUi() resets //Backup combobox indices, as retranslateUi() resets
@ -1357,7 +1359,8 @@ void MainWindow::windowShown(void)
} }
//Check for AAC support //Check for AAC support
if(m_aacEncoder == SettingsModel::AAC_ENCODER_NERO) const int aacEncoder = EncoderRegistry::getAacEncoder();
if(aacEncoder == SettingsModel::AAC_ENCODER_NERO)
{ {
if(m_settings->neroAacNotificationsEnabled()) if(m_settings->neroAacNotificationsEnabled())
{ {
@ -1375,7 +1378,7 @@ void MainWindow::windowShown(void)
} }
else else
{ {
if(m_settings->neroAacNotificationsEnabled() && (m_aacEncoder <= SettingsModel::AAC_ENCODER_NONE)) if(m_settings->neroAacNotificationsEnabled() && (aacEncoder <= SettingsModel::AAC_ENCODER_NONE))
{ {
QString appPath = QDir(QCoreApplication::applicationDirPath()).canonicalPath(); QString appPath = QDir(QCoreApplication::applicationDirPath()).canonicalPath();
if(appPath.isEmpty()) appPath = QCoreApplication::applicationDirPath(); if(appPath.isEmpty()) appPath = QCoreApplication::applicationDirPath();
@ -3289,18 +3292,25 @@ void MainWindow::playlistEnabledChanged(void)
*/ */
void MainWindow::updateEncoder(int id) void MainWindow::updateEncoder(int id)
{ {
qWarning("\nupdateEncoder(%d)", id);
m_settings->compressionEncoder(id); m_settings->compressionEncoder(id);
const AbstractEncoderInfo *info = EncoderRegistry::getEncoderInfo(id); const AbstractEncoderInfo *info = EncoderRegistry::getEncoderInfo(id);
qWarning("info->isModeSupported(SettingsModel::VBRMode) = %s", info->isModeSupported(SettingsModel::VBRMode) ? "YES" : "NO");
qWarning("info->isModeSupported(SettingsModel::ABRMode) = %s", info->isModeSupported(SettingsModel::ABRMode) ? "YES" : "NO");
qWarning("info->isModeSupported(SettingsModel::CBRMode) = %s", info->isModeSupported(SettingsModel::CBRMode) ? "YES" : "NO");
//Update UI controls //Update UI controls
ui->radioButtonModeQuality->setEnabled(info->isModeSupported(SettingsModel::VBRMode)); ui->radioButtonModeQuality->setEnabled(info->isModeSupported(SettingsModel::VBRMode));
ui->radioButtonModeAverageBitrate->setEnabled(info->isModeSupported(SettingsModel::ABRMode)); ui->radioButtonModeAverageBitrate->setEnabled(info->isModeSupported(SettingsModel::ABRMode));
ui->radioButtonConstBitrate->setEnabled(info->isModeSupported(SettingsModel::CBRMode)); ui->radioButtonConstBitrate->setEnabled(info->isModeSupported(SettingsModel::CBRMode));
//Initialize checkbox state //Initialize checkbox state
if(ui->radioButtonConstBitrate->isEnabled()) ui->radioButtonConstBitrate->setChecked(true);
if(ui->radioButtonModeAverageBitrate->isEnabled()) ui->radioButtonModeAverageBitrate->setChecked(true);
if(ui->radioButtonModeQuality->isEnabled()) ui->radioButtonModeQuality->setChecked(true); if(ui->radioButtonModeQuality->isEnabled()) ui->radioButtonModeQuality->setChecked(true);
else if(ui->radioButtonModeAverageBitrate->isEnabled()) ui->radioButtonModeAverageBitrate->setChecked(true);
else if(ui->radioButtonConstBitrate->isEnabled()) ui->radioButtonConstBitrate->setChecked(true);
else throw "It appears that the encoder does not support *any* RC mode!";
//Apply current RC mode //Apply current RC mode
const int currentRCMode = EncoderRegistry::loadEncoderMode(m_settings, id); const int currentRCMode = EncoderRegistry::loadEncoderMode(m_settings, id);
@ -3884,7 +3894,7 @@ void MainWindow::customParamsHelpRequested(QWidget *obj, QEvent *event)
else if(obj == ui->helpCustomParamOggEnc) showCustomParamsHelpScreen("oggenc2.exe", "--help"); else if(obj == ui->helpCustomParamOggEnc) showCustomParamsHelpScreen("oggenc2.exe", "--help");
else if(obj == ui->helpCustomParamNeroAAC) else if(obj == ui->helpCustomParamNeroAAC)
{ {
switch(m_aacEncoder) switch(EncoderRegistry::getAacEncoder())
{ {
case SettingsModel::AAC_ENCODER_QAAC: showCustomParamsHelpScreen("qaac.exe", "--help"); break; case SettingsModel::AAC_ENCODER_QAAC: showCustomParamsHelpScreen("qaac.exe", "--help"); break;
case SettingsModel::AAC_ENCODER_FHG : showCustomParamsHelpScreen("fhgaacenc.exe", ""); break; case SettingsModel::AAC_ENCODER_FHG : showCustomParamsHelpScreen("fhgaacenc.exe", ""); break;

View File

@ -228,6 +228,4 @@ private:
CustomEventFilter *m_evenFilterOutputFolderMouse; CustomEventFilter *m_evenFilterOutputFolderMouse;
CustomEventFilter *m_evenFilterOutputFolderView; CustomEventFilter *m_evenFilterOutputFolderView;
CustomEventFilter *m_evenFilterCompressionTab; CustomEventFilter *m_evenFilterCompressionTab;
const int m_aacEncoder;
}; };

View File

@ -32,9 +32,11 @@ static const int g_lameAgorithmQualityLUT[5] = {9, 7, 3, 0, INT_MAX};
static const int g_mp3BitrateLUT[15] = {32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, -1}; static const int g_mp3BitrateLUT[15] = {32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, -1};
static const int g_lameVBRQualityLUT[11] = {9, 8, 7, 6, 5, 4, 3, 2, 1, 0, INT_MAX}; static const int g_lameVBRQualityLUT[11] = {9, 8, 7, 6, 5, 4, 3, 2, 1, 0, INT_MAX};
///////////////////////////////////////////////////////////////////////////////
// Encoder Info
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
class : public AbstractEncoderInfo class MP3EncoderInfo : public AbstractEncoderInfo
{ {
virtual bool isModeSupported(int mode) const virtual bool isModeSupported(int mode) const
{ {
@ -43,8 +45,8 @@ class : public AbstractEncoderInfo
case SettingsModel::VBRMode: case SettingsModel::VBRMode:
case SettingsModel::ABRMode: case SettingsModel::ABRMode:
case SettingsModel::CBRMode: case SettingsModel::CBRMode:
return true; return true;
break; break;
default: default:
throw "Bad RC mode specified!"; throw "Bad RC mode specified!";
} }
@ -71,11 +73,11 @@ class : public AbstractEncoderInfo
switch(mode) switch(mode)
{ {
case SettingsModel::VBRMode: case SettingsModel::VBRMode:
return g_lameVBRQualityLUT[index]; return g_lameVBRQualityLUT[qBound(0, index, 9)];
break; break;
case SettingsModel::ABRMode: case SettingsModel::ABRMode:
case SettingsModel::CBRMode: case SettingsModel::CBRMode:
return g_mp3BitrateLUT[index]; return g_mp3BitrateLUT[qBound(0, index, 13)];
break; break;
default: default:
throw "Bad RC mode specified!"; throw "Bad RC mode specified!";
@ -105,9 +107,12 @@ class : public AbstractEncoderInfo
static const char* s_description = "LAME MP3 Encoder"; static const char* s_description = "LAME MP3 Encoder";
return s_description; return s_description;
} }
} };
g_mp3EncoderInfo;
static const MP3EncoderInfo g_mp3EncoderInfo;
///////////////////////////////////////////////////////////////////////////////
// Encoder implementation
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
MP3Encoder::MP3Encoder(void) MP3Encoder::MP3Encoder(void)

View File

@ -28,6 +28,83 @@
#include <QDir> #include <QDir>
#include <QUUid> #include <QUUid>
///////////////////////////////////////////////////////////////////////////////
// Encoder Info
///////////////////////////////////////////////////////////////////////////////
class OpusEncoderInfo : public AbstractEncoderInfo
{
virtual bool isModeSupported(int mode) const
{
switch(mode)
{
case SettingsModel::VBRMode:
case SettingsModel::ABRMode:
case SettingsModel::CBRMode:
return true;
break;
default:
throw "Bad RC mode specified!";
}
}
virtual int valueCount(int mode) const
{
switch(mode)
{
case SettingsModel::VBRMode:
case SettingsModel::ABRMode:
case SettingsModel::CBRMode:
return 32;
break;
default:
throw "Bad RC mode specified!";
}
}
virtual int valueAt(int mode, int index) const
{
switch(mode)
{
case SettingsModel::VBRMode:
case SettingsModel::ABRMode:
case SettingsModel::CBRMode:
return qBound(8, (index + 1) * 8, 256);
break;
default:
throw "Bad RC mode specified!";
}
}
virtual int valueType(int mode) const
{
switch(mode)
{
case SettingsModel::VBRMode:
case SettingsModel::ABRMode:
return TYPE_APPROX_BITRATE;
break;
case SettingsModel::CBRMode:
return TYPE_BITRATE;
break;
default:
throw "Bad RC mode specified!";
}
}
virtual const char *description(void) const
{
static const char* s_description = "Opus-Tools OpusEnc (libopus)";
return s_description;
}
};
static const OpusEncoderInfo g_opusEncoderInfo;
///////////////////////////////////////////////////////////////////////////////
// Encoder implementation
///////////////////////////////////////////////////////////////////////////////
OpusEncoder::OpusEncoder(void) OpusEncoder::OpusEncoder(void)
: :
m_binary(lamexp_lookup_tool("opusenc.exe")) m_binary(lamexp_lookup_tool("opusenc.exe"))
@ -69,16 +146,6 @@ bool OpusEncoder::encode(const QString &sourceFile, const AudioFileModel &metaIn
break; break;
} }
//switch(m_configOptimizeFor)
//{
//case 0:
// args << "--music";
// break;
//case 1:
// args << "--speech";
// break;
//}
args << "--comp" << QString::number(m_configEncodeComplexity); args << "--comp" << QString::number(m_configEncodeComplexity);
switch(m_configFrameSize) switch(m_configFrameSize)
@ -103,7 +170,7 @@ bool OpusEncoder::encode(const QString &sourceFile, const AudioFileModel &metaIn
break; break;
} }
args << QString("--bitrate") << QString::number(qMax(0, qMin(500, m_configBitrate * 8))); args << QString("--bitrate") << QString::number(qBound(8, (m_configBitrate + 1) * 8, 256));
if(!metaInfo.fileName().isEmpty()) args << "--title" << cleanTag(metaInfo.fileName()); if(!metaInfo.fileName().isEmpty()) args << "--title" << cleanTag(metaInfo.fileName());
if(!metaInfo.fileArtist().isEmpty()) args << "--artist" << cleanTag(metaInfo.fileArtist()); if(!metaInfo.fileArtist().isEmpty()) args << "--artist" << cleanTag(metaInfo.fileArtist());
@ -234,3 +301,8 @@ const bool OpusEncoder::needsTimingInfo(void)
{ {
return true; return true;
} }
const AbstractEncoderInfo *OpusEncoder::getEncoderInfo(void)
{
return &g_opusEncoderInfo;
}

View File

@ -45,6 +45,9 @@ public:
virtual void setEncodeComplexity(int complexity); virtual void setEncodeComplexity(int complexity);
virtual void setFrameSize(int frameSize); virtual void setFrameSize(int frameSize);
//Encoder info
static const AbstractEncoderInfo *getEncoderInfo(void);
private: private:
const QString m_binary; const QString m_binary;

View File

@ -27,6 +27,91 @@
#include <QProcess> #include <QProcess>
#include <QDir> #include <QDir>
///////////////////////////////////////////////////////////////////////////////
// Encoder Info
///////////////////////////////////////////////////////////////////////////////
class VorbisEncoderInfo : public AbstractEncoderInfo
{
virtual bool isModeSupported(int mode) const
{
switch(mode)
{
case SettingsModel::VBRMode:
case SettingsModel::ABRMode:
return true;
break;
case SettingsModel::CBRMode:
return false;
break;
default:
throw "Bad RC mode specified!";
}
}
virtual int valueCount(int mode) const
{
switch(mode)
{
case SettingsModel::VBRMode:
return 12;
break;
case SettingsModel::ABRMode:
case SettingsModel::CBRMode:
return 60;
break;
default:
throw "Bad RC mode specified!";
}
}
virtual int valueAt(int mode, int index) const
{
switch(mode)
{
case SettingsModel::VBRMode:
return qBound(-2, index - 2, 10);
break;
case SettingsModel::ABRMode:
case SettingsModel::CBRMode:
return qBound(32, (index + 4) * 8, 500);
break;
default:
throw "Bad RC mode specified!";
}
}
virtual int valueType(int mode) const
{
switch(mode)
{
case SettingsModel::VBRMode:
return TYPE_QUALITY_LEVEL;
break;
case SettingsModel::ABRMode:
return TYPE_APPROX_BITRATE;
break;
case SettingsModel::CBRMode:
return TYPE_BITRATE;
break;
default:
throw "Bad RC mode specified!";
}
}
virtual const char *description(void) const
{
static const char* s_description = "OggEnc2 Vorbis Encoder (aoTuV)";
return s_description;
}
};
static const VorbisEncoderInfo g_vorbisEncoderInfo;
///////////////////////////////////////////////////////////////////////////////
// Encoder implementation
///////////////////////////////////////////////////////////////////////////////
VorbisEncoder::VorbisEncoder(void) VorbisEncoder::VorbisEncoder(void)
: :
m_binary(lamexp_lookup_tool("oggenc2.exe")) m_binary(lamexp_lookup_tool("oggenc2.exe"))
@ -54,10 +139,10 @@ bool VorbisEncoder::encode(const QString &sourceFile, const AudioFileModel &meta
switch(m_configRCMode) switch(m_configRCMode)
{ {
case SettingsModel::VBRMode: case SettingsModel::VBRMode:
args << "-q" << QString::number(qMax(-2, qMin(10, m_configBitrate))); args << "-q" << QString::number(qBound(-2, m_configBitrate - 2, 10));
break; break;
case SettingsModel::ABRMode: case SettingsModel::ABRMode:
args << "-b" << QString::number(qMax(32, qMin(500, (m_configBitrate * 8)))); args << "-b" << QString::number(qBound(32, (m_configBitrate + 4) * 8, 500));
break; break;
default: default:
throw "Bad rate-control mode!"; throw "Bad rate-control mode!";
@ -66,8 +151,8 @@ bool VorbisEncoder::encode(const QString &sourceFile, const AudioFileModel &meta
if((m_configBitrateMaximum > 0) && (m_configBitrateMinimum > 0) && (m_configBitrateMinimum <= m_configBitrateMaximum)) if((m_configBitrateMaximum > 0) && (m_configBitrateMinimum > 0) && (m_configBitrateMinimum <= m_configBitrateMaximum))
{ {
args << "--min-bitrate" << QString::number(qMin(qMax(m_configBitrateMinimum, 32), 500)); args << "--min-bitrate" << QString::number(qBound(32, m_configBitrateMinimum, 500));
args << "--max-bitrate" << QString::number(qMin(qMax(m_configBitrateMaximum, 32), 500)); args << "--max-bitrate" << QString::number(qBound(32, m_configBitrateMaximum, 500));
} }
if(m_configSamplingRate > 0) if(m_configSamplingRate > 0)
@ -198,3 +283,8 @@ void VorbisEncoder::setSamplingRate(int value)
{ {
m_configSamplingRate = value; m_configSamplingRate = value;
} }
const AbstractEncoderInfo *VorbisEncoder::getEncoderInfo(void)
{
return &g_vorbisEncoderInfo;
}

View File

@ -40,6 +40,9 @@ public:
virtual void setSamplingRate(int value); virtual void setSamplingRate(int value);
virtual void setBitrate(int bitrate); virtual void setBitrate(int bitrate);
//Encoder info
static const AbstractEncoderInfo *getEncoderInfo(void);
private: private:
const QString m_binary; const QString m_binary;
int m_configBitrateMaximum; int m_configBitrateMaximum;

View File

@ -29,6 +29,85 @@
#define FIX_SEPARATORS(STR) for(int i = 0; STR[i]; i++) { if(STR[i] == L'/') STR[i] = L'\\'; } #define FIX_SEPARATORS(STR) for(int i = 0; STR[i]; i++) { if(STR[i] == L'/') STR[i] = L'\\'; }
///////////////////////////////////////////////////////////////////////////////
// Encoder Info
///////////////////////////////////////////////////////////////////////////////
class WaveEncoderInfo : public AbstractEncoderInfo
{
public:
virtual bool isModeSupported(int mode) const
{
switch(mode)
{
case SettingsModel::VBRMode:
case SettingsModel::ABRMode:
return false;
break;
case SettingsModel::CBRMode:
return true;
break;
default:
throw "Bad RC mode specified!";
}
}
virtual int valueCount(int mode) const
{
switch(mode)
{
case SettingsModel::VBRMode:
case SettingsModel::ABRMode:
case SettingsModel::CBRMode:
return 0;
break;
default:
throw "Bad RC mode specified!";
}
}
virtual int valueAt(int mode, int index) const
{
switch(mode)
{
case SettingsModel::VBRMode:
case SettingsModel::ABRMode:
case SettingsModel::CBRMode:
return -1;
break;
default:
throw "Bad RC mode specified!";
}
}
virtual int valueType(int mode) const
{
switch(mode)
{
case SettingsModel::VBRMode:
case SettingsModel::ABRMode:
case SettingsModel::CBRMode:
return TYPE_UNCOMPRESSED;
break;
default:
throw "Bad RC mode specified!";
}
}
virtual const char *description(void) const
{
static const char* s_description = "Wave Audio (PCM)";
return s_description;
}
};
static const WaveEncoderInfo g_waveEncoderInfo;
///////////////////////////////////////////////////////////////////////////////
// Encoder implementation
///////////////////////////////////////////////////////////////////////////////
WaveEncoder::WaveEncoder(void) WaveEncoder::WaveEncoder(void)
{ {
} }
@ -103,3 +182,8 @@ bool WaveEncoder::isFormatSupported(const QString &containerType, const QString
} }
return false; return false;
} }
const AbstractEncoderInfo *WaveEncoder::getEncoderInfo(void)
{
return &g_waveEncoderInfo;
}

View File

@ -36,4 +36,7 @@ public:
virtual bool encode(const QString &sourceFile, const AudioFileModel &metaInfo, const QString &outputFile, volatile bool *abortFlag); 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 bool isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion);
virtual QString extension(void); virtual QString extension(void);
//Encoder info
static const AbstractEncoderInfo *getEncoderInfo(void);
}; };

View File

@ -424,30 +424,6 @@ void SettingsModel::syncNow(void)
m_configCache->flushValues(); m_configCache->flushValues();
} }
////////////////////////////////////////////////////////////
// Static Functions
////////////////////////////////////////////////////////////
int SettingsModel::getAacEncoder(void)
{
if(lamexp_check_tool("qaac.exe") && lamexp_check_tool("libsoxrate.dll"))
{
return AAC_ENCODER_QAAC;
}
else if(lamexp_check_tool("fhgaacenc.exe") && lamexp_check_tool("enc_fhgaac.dll") && lamexp_check_tool("nsutil.dll") && lamexp_check_tool("libmp4v2.dll"))
{
return AAC_ENCODER_FHG;
}
else if(lamexp_check_tool("neroAacEnc.exe") && lamexp_check_tool("neroAacDec.exe") && lamexp_check_tool("neroAacTag.exe"))
{
return AAC_ENCODER_NERO;
}
else
{
return AAC_ENCODER_NONE;
}
}
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Private Functions // Private Functions
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////

View File

@ -180,9 +180,6 @@ public:
//Misc //Misc
void validate(void); void validate(void);
void syncNow(void); void syncNow(void);
//Static
static int getAacEncoder(void);
private: private:
SettingsCache *m_configCache; SettingsCache *m_configCache;

View File

@ -21,6 +21,7 @@
#include "Registry_Encoder.h" #include "Registry_Encoder.h"
#include "Global.h"
#include "Model_Settings.h" #include "Model_Settings.h"
#include "Encoder_AAC.h" #include "Encoder_AAC.h"
#include "Encoder_AAC_FHG.h" #include "Encoder_AAC_FHG.h"
@ -97,7 +98,7 @@ AbstractEncoder *EncoderRegistry::createInstance(const int encoderId, const Sett
/*-------- AACEncoder /*--------*/ /*-------- AACEncoder /*--------*/
case SettingsModel::AACEncoder: case SettingsModel::AACEncoder:
{ {
switch(SettingsModel::getAacEncoder()) switch(getAacEncoder())
{ {
case SettingsModel::AAC_ENCODER_QAAC: case SettingsModel::AAC_ENCODER_QAAC:
{ {
@ -215,57 +216,23 @@ const AbstractEncoderInfo *EncoderRegistry::getEncoderInfo(const int encoderId)
switch(encoderId) switch(encoderId)
{ {
/*-------- MP3Encoder /*--------*/ case SettingsModel::MP3Encoder: info = MP3Encoder::getEncoderInfo(); break;
case SettingsModel::MP3Encoder: case SettingsModel::VorbisEncoder: info = VorbisEncoder::getEncoderInfo(); break;
info = MP3Encoder::getEncoderInfo(); case SettingsModel::AC3Encoder: info = AC3Encoder::getEncoderInfo(); break;
break; case SettingsModel::FLACEncoder: info = FLACEncoder::getEncoderInfo(); break;
/*-------- VorbisEncoder /*--------*/ case SettingsModel::OpusEncoder: info = OpusEncoder::getEncoderInfo(); break;
case SettingsModel::VorbisEncoder: case SettingsModel::DCAEncoder: info = DCAEncoder::getEncoderInfo(); break;
info = VorbisEncoder::getEncoderInfo(); case SettingsModel::PCMEncoder: info = WaveEncoder::getEncoderInfo(); break;
break; case SettingsModel::AACEncoder:
/*-------- AACEncoder /*--------*/ switch(getAacEncoder())
case SettingsModel::AACEncoder:
{
switch(SettingsModel::getAacEncoder())
{ {
case SettingsModel::AAC_ENCODER_QAAC: case SettingsModel::AAC_ENCODER_QAAC: info = QAACEncoder::getEncoderInfo(); break;
info = QAACEncoder::getEncoderInfo(); case SettingsModel::AAC_ENCODER_FHG: info = FHGAACEncoder::getEncoderInfo(); break;
break; case SettingsModel::AAC_ENCODER_NERO: info = AACEncoder::getEncoderInfo(); break;
case SettingsModel::AAC_ENCODER_FHG: default: throw "Unknown AAC encoder specified!";
info = FHGAACEncoder::getEncoderInfo();
break;
case SettingsModel::AAC_ENCODER_NERO:
info = AACEncoder::getEncoderInfo();
break;
default:
throw "Unknown AAC encoder specified!";
break;
} }
} break;
break; default: throw "Unsupported encoder!";
/*-------- AC3Encoder /*--------*/
case SettingsModel::AC3Encoder:
info = AC3Encoder::getEncoderInfo();
break;
/*-------- FLACEncoder /*--------*/
case SettingsModel::FLACEncoder:
info = FLACEncoder::getEncoderInfo();
break;
/*-------- OpusEncoder --------*/
case SettingsModel::OpusEncoder:
info = OpusEncoder::getEncoderInfo();
break;
/*-------- DCAEncoder --------*/
case SettingsModel::DCAEncoder:
info = DCAEncoder::getEncoderInfo();
break;
/*-------- PCMEncoder --------*/
case SettingsModel::PCMEncoder:
info = WaveEncoder::getEncoderInfo();
break;
/*-------- default --------*/
default:
throw "Unsupported encoder!";
} }
//Sanity checking //Sanity checking
@ -416,3 +383,27 @@ int EncoderRegistry::loadEncoderValue(const SettingsModel *settings, const int e
return value; return value;
} }
////////////////////////////////////////////////////////////
// Static Functions
////////////////////////////////////////////////////////////
int EncoderRegistry::getAacEncoder(void)
{
if(lamexp_check_tool("qaac.exe") && lamexp_check_tool("libsoxrate.dll"))
{
return SettingsModel::AAC_ENCODER_QAAC;
}
else if(lamexp_check_tool("fhgaacenc.exe") && lamexp_check_tool("enc_fhgaac.dll") && lamexp_check_tool("nsutil.dll") && lamexp_check_tool("libmp4v2.dll"))
{
return SettingsModel::AAC_ENCODER_FHG;
}
else if(lamexp_check_tool("neroAacEnc.exe") && lamexp_check_tool("neroAacDec.exe") && lamexp_check_tool("neroAacTag.exe"))
{
return SettingsModel::AAC_ENCODER_NERO;
}
else
{
return SettingsModel::AAC_ENCODER_NONE;
}
}

View File

@ -40,4 +40,6 @@ public:
static void saveEncoderValue(SettingsModel *settings, const int encoderId, const int rcMode, const int value); static void saveEncoderValue(SettingsModel *settings, const int encoderId, const int rcMode, const int value);
static int loadEncoderValue(const SettingsModel *settings, const int encoderId, const int rcMode); static int loadEncoderValue(const SettingsModel *settings, const int encoderId, const int rcMode);
static int getAacEncoder(void);
}; };