Implemented encoding mode and bitrate selection for AC-3 encoder. Also support for custom parameters.

This commit is contained in:
LoRd_MuldeR 2011-05-05 12:27:25 +02:00
parent c3a7eef242
commit 0d2b16424f
16 changed files with 114 additions and 22 deletions

View File

@ -1272,6 +1272,10 @@
<source>The LameXP shell integration has been re-enabled.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Aften A/52</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MetaInfo</name>

View File

@ -1273,6 +1273,10 @@
<source>LameXP will &lt;i&gt;not&lt;/i&gt; check for Beta (pre-release) updates from now on.</source>
<translation>LameXP wird fortan &lt;i&gt;nicht&lt;/i&gt; nach Beta (Entwickler) Updates suchen.</translation>
</message>
<message>
<source>Aften A/52</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MetaInfo</name>

View File

@ -1272,6 +1272,10 @@
<source>LameXP will &lt;i&gt;not&lt;/i&gt; check for Beta (pre-release) updates from now on.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Aften A/52</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MetaInfo</name>

View File

@ -1282,6 +1282,10 @@ Ouvrir le dossier récursivement...</translation>
<source>LameXP will &lt;i&gt;not&lt;/i&gt; check for Beta (pre-release) updates from now on.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Aften A/52</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MetaInfo</name>

View File

@ -1273,6 +1273,10 @@
<source>LameXP will &lt;i&gt;not&lt;/i&gt; check for Beta (pre-release) updates from now on.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Aften A/52</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MetaInfo</name>

View File

@ -1272,6 +1272,10 @@
<source>LameXP will &lt;i&gt;not&lt;/i&gt; check for Beta (pre-release) updates from now on.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Aften A/52</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MetaInfo</name>

View File

@ -1274,6 +1274,10 @@
<source>LameXP will &lt;i&gt;not&lt;/i&gt; check for Beta (pre-release) updates from now on.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Aften A/52</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MetaInfo</name>

View File

@ -1272,6 +1272,10 @@
<source>LameXP will &lt;i&gt;not&lt;/i&gt; check for Beta (pre-release) updates from now on.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Aften A/52</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MetaInfo</name>

View File

@ -30,7 +30,7 @@
</font>
</property>
<property name="currentIndex">
<number>3</number>
<number>0</number>
</property>
<property name="usesScrollButtons">
<bool>false</bool>
@ -1067,8 +1067,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>602</width>
<height>1088</height>
<width>604</width>
<height>1117</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_22">
@ -2081,7 +2081,7 @@
<item row="1" column="1">
<widget class="QLabel" name="label_9">
<property name="text">
<string>LAME:</string>
<string>Lame MP3:</string>
</property>
</widget>
</item>
@ -2154,7 +2154,7 @@
</property>
</spacer>
</item>
<item row="7" column="1" colspan="2">
<item row="8" column="1" colspan="2">
<spacer name="verticalSpacer_16">
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -2170,7 +2170,7 @@
</property>
</spacer>
</item>
<item row="6" column="1" colspan="2">
<item row="7" column="1" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QLabel" name="labelCustomParamsIcon">
@ -2197,7 +2197,7 @@
</item>
</layout>
</item>
<item row="5" column="1" colspan="2">
<item row="6" column="1" colspan="2">
<widget class="QLabel" name="labelCustomParamsSpacer">
<property name="minimumSize">
<size>
@ -2216,6 +2216,22 @@
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QLineEdit" name="lineEditCustomParamAften">
<property name="font">
<font>
<family>Lucida Console</family>
</font>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLabel" name="label_13">
<property name="text">
<string>Aften A/52:</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
@ -3172,6 +3188,9 @@
<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"/>
<include location="../res/Icons.qrc"/>
</resources>
<connections>
<connection>

View File

@ -30,7 +30,7 @@
#define VER_LAMEXP_MINOR_LO 2
#define VER_LAMEXP_TYPE Alpha
#define VER_LAMEXP_PATCH 10
#define VER_LAMEXP_BUILD 484
#define VER_LAMEXP_BUILD 485
///////////////////////////////////////////////////////////////////////////////
// Tools versions

View File

@ -226,6 +226,7 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
lineEditCustomParamOggEnc->setText(m_settings->customParametersOggEnc());
lineEditCustomParamNeroAAC->setText(m_settings->customParametersNeroAAC());
lineEditCustomParamFLAC->setText(m_settings->customParametersFLAC());
lineEditCustomParamAften->setText(m_settings->customParametersAften());
lineEditCustomTempFolder->setText(QDir::toNativeSeparators(m_settings->customTempPath()));
connect(sliderLameAlgoQuality, SIGNAL(valueChanged(int)), this, SLOT(updateLameAlgoQuality(int)));
connect(checkBoxBitrateManagement, SIGNAL(clicked(bool)), this, SLOT(bitrateManagementEnabledChanged(bool)));
@ -244,6 +245,7 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
connect(lineEditCustomParamOggEnc, SIGNAL(editingFinished()), this, SLOT(customParamsChanged()));
connect(lineEditCustomParamNeroAAC, SIGNAL(editingFinished()), this, SLOT(customParamsChanged()));
connect(lineEditCustomParamFLAC, SIGNAL(editingFinished()), this, SLOT(customParamsChanged()));
connect(lineEditCustomParamAften, SIGNAL(editingFinished()), this, SLOT(customParamsChanged()));
connect(sliderMaxInstances, SIGNAL(valueChanged(int)), this, SLOT(updateMaximumInstances(int)));
connect(checkBoxAutoDetectInstances, SIGNAL(clicked(bool)), this, SLOT(autoDetectInstancesChanged(bool)));
connect(buttonBrowseCustomTempFolder, SIGNAL(clicked()), this, SLOT(browseCustomTempFolderButtonClicked()));
@ -1759,6 +1761,13 @@ void MainWindow::updateEncoder(int id)
if(radioButtonConstBitrate->isChecked()) radioButtonModeQuality->setChecked(true);
sliderBitrate->setEnabled(true);
break;
case SettingsModel::AC3Encoder:
radioButtonModeQuality->setEnabled(true);
radioButtonModeQuality->setChecked(true);
radioButtonModeAverageBitrate->setEnabled(false);
radioButtonConstBitrate->setEnabled(true);
sliderBitrate->setEnabled(true);
break;
case SettingsModel::FLACEncoder:
radioButtonModeQuality->setEnabled(false);
radioButtonModeQuality->setChecked(true);
@ -1819,6 +1828,19 @@ void MainWindow::updateRCMode(int id)
break;
}
break;
case SettingsModel::AC3Encoder:
switch(m_settings->compressionRCMode())
{
case SettingsModel::VBRMode:
sliderBitrate->setMinimum(0);
sliderBitrate->setMaximum(16);
break;
default:
sliderBitrate->setMinimum(0);
sliderBitrate->setMaximum(18);
break;
}
break;
case SettingsModel::AACEncoder:
switch(m_settings->compressionRCMode())
{
@ -1874,6 +1896,9 @@ void MainWindow::updateBitrate(int value)
case SettingsModel::FLACEncoder:
labelBitrate->setText(tr("Compression %1").arg(value));
break;
case SettingsModel::AC3Encoder:
labelBitrate->setText(tr("Quality Level %1").arg(min(1023, max(0, value * 64))));
break;
case SettingsModel::PCMEncoder:
labelBitrate->setText(tr("Uncompressed"));
break;
@ -1891,6 +1916,9 @@ void MainWindow::updateBitrate(int value)
case SettingsModel::FLACEncoder:
labelBitrate->setText(tr("Compression %1").arg(value));
break;
case SettingsModel::AC3Encoder:
labelBitrate->setText(QString("&asymp; %1 kbps").arg(SettingsModel::ac3Bitrates[value]));
break;
case SettingsModel::PCMEncoder:
labelBitrate->setText(tr("Uncompressed"));
break;
@ -1908,6 +1936,9 @@ void MainWindow::updateBitrate(int value)
case SettingsModel::FLACEncoder:
labelBitrate->setText(tr("Compression %1").arg(value));
break;
case SettingsModel::AC3Encoder:
labelBitrate->setText(QString("&asymp; %1 kbps").arg(SettingsModel::ac3Bitrates[value]));
break;
case SettingsModel::PCMEncoder:
labelBitrate->setText(tr("Uncompressed"));
break;
@ -2079,12 +2110,14 @@ void MainWindow::customParamsChanged(void)
lineEditCustomParamOggEnc->setText(lineEditCustomParamOggEnc->text().simplified());
lineEditCustomParamNeroAAC->setText(lineEditCustomParamNeroAAC->text().simplified());
lineEditCustomParamFLAC->setText(lineEditCustomParamFLAC->text().simplified());
lineEditCustomParamAften->setText(lineEditCustomParamAften->text().simplified());
bool customParamsUsed = false;
if(!lineEditCustomParamLAME->text().isEmpty()) customParamsUsed = true;
if(!lineEditCustomParamOggEnc->text().isEmpty()) customParamsUsed = true;
if(!lineEditCustomParamNeroAAC->text().isEmpty()) customParamsUsed = true;
if(!lineEditCustomParamFLAC->text().isEmpty()) customParamsUsed = true;
if(!lineEditCustomParamAften->text().isEmpty()) customParamsUsed = true;
labelCustomParamsIcon->setVisible(customParamsUsed);
labelCustomParamsText->setVisible(customParamsUsed);
@ -2094,6 +2127,7 @@ void MainWindow::customParamsChanged(void)
m_settings->customParametersOggEnc(lineEditCustomParamOggEnc->text());
m_settings->customParametersNeroAAC(lineEditCustomParamNeroAAC->text());
m_settings->customParametersFLAC(lineEditCustomParamFLAC->text());
m_settings->customParametersAften(lineEditCustomParamAften->text());
}
/*

View File

@ -606,7 +606,7 @@ void ProcessingDialog::startNextJob(void)
AC3Encoder *ac3Encoder = new AC3Encoder();
ac3Encoder->setBitrate(m_settings->compressionBitrate());
ac3Encoder->setRCMode(m_settings->compressionRCMode());
ac3Encoder->setCustomParams(m_settings->customParametersNeroAAC());
ac3Encoder->setCustomParams(m_settings->customParametersAften());
encoder = ac3Encoder;
}
break;

View File

@ -49,18 +49,20 @@ bool AC3Encoder::encode(const QString &sourceFile, const AudioFileModel &metaInf
QProcess process;
QStringList args;
//args << QString("-%1").arg(QString::number(max(0, min(8, m_configBitrate))));
switch(m_configRCMode)
{
case SettingsModel::VBRMode:
args << "-q" << QString::number(max(0, min(1023, m_configBitrate * 64)));
break;
case SettingsModel::CBRMode:
args << "-b" << QString::number(SettingsModel::ac3Bitrates[max(0, min(18, m_configBitrate))]);
break;
default:
throw "Bad rate-control mode!";
break;
}
//if(!metaInfo.fileName().isEmpty()) args << "-T" << QString("title=%1").arg(metaInfo.fileName());
//if(!metaInfo.fileArtist().isEmpty()) args << "-T" << QString("artist=%1").arg(metaInfo.fileArtist());
//if(!metaInfo.fileAlbum().isEmpty()) args << "-T" << QString("album=%1").arg(metaInfo.fileAlbum());
//if(!metaInfo.fileGenre().isEmpty()) args << "-T" << QString("genre=%1").arg(metaInfo.fileGenre());
//if(!metaInfo.fileComment().isEmpty()) args << "-T" << QString("comment=%1").arg(metaInfo.fileComment());
//if(metaInfo.fileYear()) args << "-T" << QString("date=%1").arg(QString::number(metaInfo.fileYear()));
//if(metaInfo.filePosition()) args << "-T" << QString("track=%1").arg(QString::number(metaInfo.filePosition()));
//if(!metaInfo.fileCover().isEmpty()) args << QString("--picture=%1").arg(metaInfo.fileCover());
//if(!m_configCustomParams.isEmpty()) args << m_configCustomParams.split(" ", QString::SkipEmptyParts);
if(!m_configCustomParams.isEmpty()) args << m_configCustomParams.split(" ", QString::SkipEmptyParts);
args << QDir::toNativeSeparators(sourceFile);
args << QDir::toNativeSeparators(outputFile);

View File

@ -64,11 +64,11 @@ bool MP3Encoder::encode(const QString &sourceFile, const AudioFileModel &metaInf
args << "-V" << QString::number(9 - min(9, m_configBitrate));
break;
case SettingsModel::ABRMode:
args << "--abr" << QString::number(SettingsModel::mp3Bitrates[min(13, m_configBitrate)]);
args << "--abr" << QString::number(SettingsModel::mp3Bitrates[max(0, min(13, m_configBitrate))]);
break;
case SettingsModel::CBRMode:
args << "--cbr";
args << "-b" << QString::number(SettingsModel::mp3Bitrates[min(13, m_configBitrate)]);
args << "-b" << QString::number(SettingsModel::mp3Bitrates[max(0, min(13, m_configBitrate))]);
break;
default:
throw "Bad rate-control mode!";

View File

@ -101,6 +101,7 @@ LAMEXP_MAKE_ID(toneAdjustTreble, "AdvancedOptions/ToneAdjustment/Treble");
LAMEXP_MAKE_ID(customParametersLAME, "AdvancedOptions/CustomParameters/LAME");
LAMEXP_MAKE_ID(customParametersOggEnc, "AdvancedOptions/CustomParameters/OggEnc");
LAMEXP_MAKE_ID(customParametersNeroAAC, "AdvancedOptions/CustomParameters/NeroAAC");
LAMEXP_MAKE_ID(customParametersAften, "AdvancedOptions/CustomParameters/Aften");
LAMEXP_MAKE_ID(customParametersFLAC, "AdvancedOptions/CustomParameters/FLAC");
LAMEXP_MAKE_ID(metaInfoPosition, "MetaInformation/PlaylistPosition");
LAMEXP_MAKE_ID(maximumInstances, "AdvancedOptions/Threading/MaximumInstances");
@ -109,6 +110,7 @@ LAMEXP_MAKE_ID(customTempPathEnabled, "AdvancedOptions/TempDirectory/UseCustomPa
//LUT
const int SettingsModel::mp3Bitrates[15] = {32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, -1};
const int SettingsModel::ac3Bitrates[20] = {32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, 448, 512, 576, 640, -1};
const int SettingsModel::samplingRates[8] = {0, 16000, 22050, 24000, 32000, 44100, 48000, -1};
////////////////////////////////////////////////////////////
@ -283,6 +285,7 @@ LAMEXP_MAKE_OPTION_I(toneAdjustTreble, 0)
LAMEXP_MAKE_OPTION_S(customParametersLAME, QString());
LAMEXP_MAKE_OPTION_S(customParametersOggEnc, QString());
LAMEXP_MAKE_OPTION_S(customParametersNeroAAC, QString());
LAMEXP_MAKE_OPTION_S(customParametersAften, QString());
LAMEXP_MAKE_OPTION_S(customParametersFLAC, QString());
LAMEXP_MAKE_OPTION_U(metaInfoPosition, UINT_MAX);
LAMEXP_MAKE_OPTION_U(maximumInstances, 0);

View File

@ -73,6 +73,7 @@ public:
//Consts
static const int mp3Bitrates[15];
static const int ac3Bitrates[20];
static const int samplingRates[8];
//Getters & setters
@ -110,6 +111,7 @@ public:
LAMEXP_MAKE_OPTION_S(customParametersLAME);
LAMEXP_MAKE_OPTION_S(customParametersOggEnc);
LAMEXP_MAKE_OPTION_S(customParametersNeroAAC);
LAMEXP_MAKE_OPTION_S(customParametersAften);
LAMEXP_MAKE_OPTION_S(customParametersFLAC);
LAMEXP_MAKE_OPTION_U(metaInfoPosition);
LAMEXP_MAKE_OPTION_U(maximumInstances);