Actually make the Nero AAC Profile/2-Pass options work. Also make the MP3 Channel Mode and Sampling Rate options work.

This commit is contained in:
LoRd_MuldeR 2011-01-23 02:19:18 +01:00
parent 6c43678b7f
commit 7e44c69c03
15 changed files with 155 additions and 58 deletions

View File

@ -502,7 +502,7 @@
<translation type="unfinished"></translation>
</message>
<message>
<source>Auto (Recommended)</source>
<source>Auto Select (Recommended)</source>
<translation type="unfinished"></translation>
</message>
<message>
@ -514,7 +514,7 @@
<translation type="unfinished"></translation>
</message>
<message>
<source>Enforce HE-AAC v2 (AAC +SBR + PS)</source>
<source>Enforce HE-AAC v2 (AAC + SBR + PS)</source>
<translation type="unfinished"></translation>
</message>
<message>

View File

@ -944,91 +944,91 @@
</message>
<message>
<source>Channel Mode / Sampling Rate</source>
<translation type="unfinished"></translation>
<translation>Kanal Modus / Abtastrate</translation>
</message>
<message>
<source>Auto Select (Default)</source>
<translation type="unfinished"></translation>
<translation>Automatisch (Standard)</translation>
</message>
<message>
<source>Joint Stereo</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<source>Forced Joint Stereo</source>
<translation type="unfinished"></translation>
<translation>Joint Stereo Erzwingen</translation>
</message>
<message>
<source>Simple</source>
<translation type="unfinished"></translation>
<translation>Einfach</translation>
</message>
<message>
<source>Dual Mono</source>
<translation type="unfinished"></translation>
<translation>Doppel Mono</translation>
</message>
<message>
<source>Mono</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<source>MP3 Channel Mode:</source>
<translation type="unfinished"></translation>
<translation>MP3 Kanal Modus:</translation>
</message>
<message>
<source>16.000</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<source>22.050</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<source>24.000</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<source>32.000</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<source>44.100</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<source>48.000</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<source>Sampling Rate (Hz):</source>
<translation type="unfinished"></translation>
<translation>Abtastrate (Hz):</translation>
</message>
<message>
<source>Nero AAC Options</source>
<translation type="unfinished"></translation>
<translation>Nero AAC Optionen</translation>
</message>
<message>
<source>Enable 2-Pass Processing (ABR Mode)</source>
<translation type="unfinished"></translation>
<translation>2 Durchläufe Verwenden (ABR Modus)</translation>
</message>
<message>
<source>Select AAC Profile:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Auto (Recommended)</source>
<translation type="unfinished"></translation>
<translation>AAC Profil Auswahl:</translation>
</message>
<message>
<source>Enforce LC-AAC</source>
<translation type="unfinished"></translation>
<translation>Erzwinge LC-AAC</translation>
</message>
<message>
<source>Enforce HE-AAC (AAC + SBR)</source>
<translation type="unfinished"></translation>
<translation>Erzwinge HE-AAC (AAC + SBR)</translation>
</message>
<message>
<source>Enforce HE-AAC v2 (AAC +SBR + PS)</source>
<translation type="unfinished"></translation>
<source>Auto Select (Recommended)</source>
<translation>Automatisch (Empfohlen)</translation>
</message>
<message>
<source>Enforce HE-AAC v2 (AAC + SBR + PS)</source>
<translation>Erzwinge HE-AAC v2 (AAC + SBR + PS)</translation>
</message>
</context>
<context>

View File

@ -1014,10 +1014,6 @@
<source>Select AAC Profile:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Auto (Recommended)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enforce LC-AAC</source>
<translation type="unfinished"></translation>
@ -1027,7 +1023,11 @@
<translation type="unfinished"></translation>
</message>
<message>
<source>Enforce HE-AAC v2 (AAC +SBR + PS)</source>
<source>Auto Select (Recommended)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enforce HE-AAC v2 (AAC + SBR + PS)</source>
<translation type="unfinished"></translation>
</message>
</context>

View File

@ -1018,10 +1018,6 @@ Votre dossier TEMP est situé ici:</translation>
<source>Select AAC Profile:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Auto (Recommended)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enforce LC-AAC</source>
<translation type="unfinished"></translation>
@ -1031,7 +1027,11 @@ Votre dossier TEMP est situé ici:</translation>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enforce HE-AAC v2 (AAC +SBR + PS)</source>
<source>Auto Select (Recommended)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enforce HE-AAC v2 (AAC + SBR + PS)</source>
<translation type="unfinished"></translation>
</message>
</context>

View File

@ -1014,10 +1014,6 @@
<source>Select AAC Profile:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Auto (Recommended)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enforce LC-AAC</source>
<translation type="unfinished"></translation>
@ -1027,7 +1023,11 @@
<translation type="unfinished"></translation>
</message>
<message>
<source>Enforce HE-AAC v2 (AAC +SBR + PS)</source>
<source>Auto Select (Recommended)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enforce HE-AAC v2 (AAC + SBR + PS)</source>
<translation type="unfinished"></translation>
</message>
</context>

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>667</width>
<height>407</height>
<height>446</height>
</rect>
</property>
<property name="windowTitle">
@ -1269,6 +1269,9 @@
<layout class="QGridLayout" name="gridLayout_23">
<item row="1" column="2">
<widget class="QComboBox" name="comboBoxMP3ChannelMode">
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContents</enum>
</property>
<item>
<property name="text">
<string>Auto Select (Default)</string>
@ -1406,6 +1409,9 @@
</item>
<item row="1" column="7">
<widget class="QComboBox" name="comboBoxSamplingRate">
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContents</enum>
</property>
<item>
<property name="text">
<string>Auto Select (Default)</string>
@ -1520,9 +1526,12 @@
</item>
<item row="1" column="4">
<widget class="QComboBox" name="comboBoxNeroAACProfile">
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContents</enum>
</property>
<item>
<property name="text">
<string>Auto (Recommended)</string>
<string>Auto Select (Recommended)</string>
</property>
</item>
<item>
@ -1537,7 +1546,7 @@
</item>
<item>
<property name="text">
<string>Enforce HE-AAC v2 (AAC +SBR + PS)</string>
<string>Enforce HE-AAC v2 (AAC + SBR + PS)</string>
</property>
</item>
</widget>
@ -2076,6 +2085,8 @@
<include location="../res/Icons.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Icons.qrc"/>
<include location="../res/Icons.qrc"/>
</resources>
<connections>
<connection>

Binary file not shown.

View File

@ -25,7 +25,7 @@
#define VER_LAMEXP_MAJOR 4
#define VER_LAMEXP_MINOR_HI 0
#define VER_LAMEXP_MINOR_LO 0
#define VER_LAMEXP_BUILD 249
#define VER_LAMEXP_BUILD 251
#define VER_LAMEXP_SUFFIX Beta-1
/*

View File

@ -440,6 +440,8 @@ void ProcessingDialog::startNextJob(void)
{
mp3Encoder->setBitrateLimits(m_settings->bitrateManagementMinRate(), m_settings->bitrateManagementMaxRate());
}
mp3Encoder->setSamplingRate(SettingsModel::samplingRates[m_settings->samplingRate()]);
mp3Encoder->setChannelMode(m_settings->lameChannelMode());
encoder = mp3Encoder;
}
break;
@ -460,6 +462,8 @@ void ProcessingDialog::startNextJob(void)
AACEncoder *aacEncoder = new AACEncoder();
aacEncoder->setBitrate(m_settings->compressionBitrate());
aacEncoder->setRCMode(m_settings->compressionRCMode());
aacEncoder->setEnable2Pass(m_settings->neroAACEnable2Pass());
aacEncoder->setProfile(m_settings->neroAACProfile());
encoder = aacEncoder;
}
break;

View File

@ -40,6 +40,9 @@ AACEncoder::AACEncoder(void)
{
throw "Error initializing AAC encoder. Tool 'neroAacEnc.exe' is not registred!";
}
m_configProfile = 0;
m_configEnable2Pass = true;
}
AACEncoder::~AACEncoder(void)
@ -58,7 +61,7 @@ bool AACEncoder::encode(const QString &sourceFile, const AudioFileModel &metaInf
args << "-q" << QString().sprintf("%.2f", min(1.0, max(0.0, static_cast<double>(m_configBitrate * 5) / 100.0)));
break;
case SettingsModel::ABRMode:
args << "-br" << QString::number(max(32, min(500, (m_configBitrate * 8))) * 1000) << "-2pass";
args << "-br" << QString::number(max(32, min(500, (m_configBitrate * 8))) * 1000);
break;
case SettingsModel::CBRMode:
args << "-cbr" << QString::number(max(32, min(500, (m_configBitrate * 8))) * 1000) << "-2pass";
@ -68,6 +71,24 @@ bool AACEncoder::encode(const QString &sourceFile, const AudioFileModel &metaInf
break;
}
if(m_configEnable2Pass && (m_configRCMode == SettingsModel::ABRMode))
{
args << "-2pass";
}
switch(m_configProfile)
{
case 1:
args << "-lc"; //Forces use of LC AAC profile
break;
case 2:
args << "-he"; //Forces use of HE AAC profile
break;
case 3:
args << "-hev2"; //Forces use of HEv2 AAC profile
break;
}
args << "-if" << QDir::toNativeSeparators(sourceFile);
args << "-of" << QDir::toNativeSeparators(outputFile);
@ -235,3 +256,14 @@ bool AACEncoder::isFormatSupported(const QString &containerType, const QString &
return false;
}
void AACEncoder::setProfile(int profile)
{
m_configProfile = profile;
}
void AACEncoder::setEnable2Pass(bool enabled)
{
m_configEnable2Pass = enabled;
}

View File

@ -36,8 +36,14 @@ public:
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);
virtual void setEnable2Pass(bool enabled);
private:
const QString m_binary_enc;
const QString m_binary_tag;
int m_configProfile;
bool m_configEnable2Pass;
};

View File

@ -44,6 +44,8 @@ MP3Encoder::MP3Encoder(void)
m_algorithmQuality = 3;
m_configBitrateMaximum = 0;
m_configBitrateMinimum = 0;
m_configSamplingRate = 0;
m_configChannelMode = 0;
}
MP3Encoder::~MP3Encoder(void)
@ -84,6 +86,30 @@ bool MP3Encoder::encode(const QString &sourceFile, const AudioFileModel &metaInf
}
}
if(m_configSamplingRate > 0)
{
args << "--resample" << QString::number(m_configSamplingRate);
}
switch(m_configChannelMode)
{
case 1:
args << "-m" << "j";
break;
case 2:
args << "-m" << "f";
break;
case 3:
args << "-m" << "s";
break;
case 4:
args << "-m" << "d";
break;
case 5:
args << "-m" << "m";
break;
}
if(!metaInfo.fileName().isEmpty()) args << (IS_UNICODE(metaInfo.fileName()) ? "--uTitle" : "--lTitle") << metaInfo.fileName();
if(!metaInfo.fileArtist().isEmpty()) args << (IS_UNICODE(metaInfo.fileArtist()) ? "--uArtist" : "--lArtist") << metaInfo.fileArtist();
if(!metaInfo.fileAlbum().isEmpty()) args << (IS_UNICODE(metaInfo.fileAlbum()) ? "--uAlbum" : "--lAlbum") << metaInfo.fileAlbum();
@ -206,6 +232,16 @@ void MP3Encoder::setBitrateLimits(int minimumBitrate, int maximumBitrate)
m_configBitrateMaximum = maximumBitrate;
}
void MP3Encoder::setSamplingRate(int value)
{
m_configSamplingRate = value;
}
void MP3Encoder::setChannelMode(int value)
{
m_configChannelMode = value;
}
int MP3Encoder::clipBitrate(int bitrate)
{
int targetBitrate = min(max(bitrate, 32), 320);
@ -230,4 +266,3 @@ int MP3Encoder::clipBitrate(int bitrate)
return targetBitrate;
}

View File

@ -41,13 +41,16 @@ public:
//Advanced options
virtual void setAlgoQuality(int value);
virtual void setBitrateLimits(int minimumBitrate, int maximumBitrate);
virtual void setSamplingRate(int value);
virtual void setChannelMode(int value);
private:
const QString m_binary;
int m_algorithmQuality;
int m_configBitrateMaximum;
int m_configBitrateMinimum;
int m_configSamplingRate;
int m_configChannelMode;
int clipBitrate(int bitrate);
};

View File

@ -62,19 +62,22 @@ static const char *g_settingsId_neroAACProfile = "AdvancedOptions/NeroAAC/ForceP
//Macros
#define MAKE_OPTION1(OPT,DEF) \
int SettingsModel::OPT(void) { return m_settings->value(g_settingsId_##OPT, DEF).toInt(); } \
void SettingsModel::OPT(int value) { m_settings->setValue(g_settingsId_##OPT, value); }
void SettingsModel::OPT(int value) { m_settings->setValue(g_settingsId_##OPT, value); } \
int SettingsModel::OPT##Default(void) { return DEF; }
#define MAKE_OPTION2(OPT,DEF) \
QString SettingsModel::OPT(void) { return m_settings->value(g_settingsId_##OPT, DEF).toString().trimmed(); } \
void SettingsModel::OPT(const QString &value) { m_settings->setValue(g_settingsId_##OPT, value); }
void SettingsModel::OPT(const QString &value) { m_settings->setValue(g_settingsId_##OPT, value); } \
QString SettingsModel::OPT##Default(void) { return DEF; }
#define MAKE_OPTION3(OPT,DEF) \
bool SettingsModel::OPT(void) { return m_settings->value(g_settingsId_##OPT, DEF).toBool(); } \
void SettingsModel::OPT(bool value) { m_settings->setValue(g_settingsId_##OPT, value); }
void SettingsModel::OPT(bool value) { m_settings->setValue(g_settingsId_##OPT, value); } \
bool SettingsModel::OPT##Default(void) { return DEF; }
//LUT
const int SettingsModel::mp3Bitrates[15] = {32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, -1};
const int SettingsModel::samplingRates[7] = {16000, 22050, 24000, 32000, 44100, 48000, -1};
const int SettingsModel::samplingRates[8] = {0, 16000, 22050, 24000, 32000, 44100, 48000, -1};
////////////////////////////////////////////////////////////
// Constructor

View File

@ -26,15 +26,18 @@ class QString;
#define MAKE_OPTION_DEC1(OPT) \
int OPT(void); \
void OPT(int value);
void OPT(int value); \
int OPT##Default(void);
#define MAKE_OPTION_DEC2(OPT) \
QString OPT(void); \
void OPT(const QString &value);
void OPT(const QString &value); \
QString OPT##Default(void);
#define MAKE_OPTION_DEC3(OPT) \
bool OPT(void); \
void OPT(bool value);
void OPT(bool value); \
bool OPT##Default(void);
class SettingsModel
{
@ -60,7 +63,7 @@ public:
//Consts
static const int mp3Bitrates[15];
static const int samplingRates[7];
static const int samplingRates[8];
//Getters & setters
MAKE_OPTION_DEC1(licenseAccepted);