Tunings are now also loaded from the EncoderInfo object. Also improved template saving code.

This commit is contained in:
LoRd_MuldeR 2014-04-16 16:50:03 +02:00
parent 09e6e4fe7f
commit 0ce1fff4c6
8 changed files with 73 additions and 75 deletions

View File

@ -703,58 +703,8 @@
<string>This option tweaks the encoder for a specific type of content of for a specific application scenario. Make sure you pick the Tuning that matches your type of source best!</string> <string>This option tweaks the encoder for a specific type of content of for a specific application scenario. Make sure you pick the Tuning that matches your type of source best!</string>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>-1</number>
</property> </property>
<item>
<property name="text">
<string>None</string>
</property>
</item>
<item>
<property name="text">
<string>Film</string>
</property>
</item>
<item>
<property name="text">
<string>Animation</string>
</property>
</item>
<item>
<property name="text">
<string>Grain</string>
</property>
</item>
<item>
<property name="text">
<string>Stillimage</string>
</property>
</item>
<item>
<property name="text">
<string>PSNR</string>
</property>
</item>
<item>
<property name="text">
<string>SSIM</string>
</property>
</item>
<item>
<property name="text">
<string>Fastdecode</string>
</property>
</item>
<item>
<property name="text">
<string>Zerolatency</string>
</property>
</item>
<item>
<property name="text">
<string>Touhou</string>
</property>
</item>
</widget> </widget>
</item> </item>
</layout> </layout>

View File

@ -32,6 +32,7 @@ class AbstractEncoderInfo
public: public:
virtual QString getVariantId(const int &variant) const = 0; virtual QString getVariantId(const int &variant) const = 0;
virtual QStringList getProfiles(const int &variant) const = 0; virtual QStringList getProfiles(const int &variant) const = 0;
virtual QStringList getTunings(void) const = 0;
virtual QStringList supportedInputFormats(void) const = 0; virtual QStringList supportedInputFormats(void) const = 0;
virtual QStringList supportedOutputFormats(void) const = 0; virtual QStringList supportedOutputFormats(void) const = 0;
virtual bool isRCModeSupported(const int rcMode) const = 0; virtual bool isRCModeSupported(const int rcMode) const = 0;

View File

@ -97,6 +97,17 @@ public:
} }
} }
virtual QStringList getTunings(void) const
{
QStringList tunings;
tunings << "Film" << "Animation" << "Grain";
tunings << "StillImage" << "PSNR" << "SSIM";
tunings << "FastDecode" << "ZeroLatency" << "Touhou";
return tunings;
}
virtual QStringList getProfiles(const int &variant) const virtual QStringList getProfiles(const int &variant) const
{ {
QStringList profiles; QStringList profiles;
@ -116,27 +127,16 @@ public:
virtual QStringList supportedInputFormats(void) const virtual QStringList supportedInputFormats(void) const
{ {
QStringList extLst; QStringList extLst;
extLst << "avi"; extLst << "avi" << "mp4" << "mkv" << "flv";
extLst << "mp4"; extLst << "mpg" << "m2v" << "m2ts" << "ts";
extLst << "mkv"; extLst << "wmv" << "ogm" << "vob" << "y4m";
extLst << "flv";
extLst << "mpg";
extLst << "m2v";
extLst << "m2ts";
extLst << "ts";
extLst << "wmv";
extLst << "ogm";
extLst << "vob";
extLst << "y4m";
return extLst; return extLst;
} }
virtual QStringList supportedOutputFormats(void) const virtual QStringList supportedOutputFormats(void) const
{ {
QStringList extLst; QStringList extLst;
extLst << "264"; extLst << "264" << "mkv" << "mp4";
extLst << "mkv";
extLst << "mp4";
return extLst; return extLst;
} }
@ -291,9 +291,12 @@ void X264Encoder::buildCommandLine(QStringList &cmdLine, const bool &usePipe, co
cmdLine << "--preset" << m_options->preset().toLower(); cmdLine << "--preset" << m_options->preset().toLower();
if(m_options->tune().compare("none", Qt::CaseInsensitive)) if(!m_options->tune().simplified().isEmpty())
{ {
cmdLine << "--tune" << m_options->tune().toLower(); if(m_options->tune().simplified().compare(QString::fromLatin1(OptionsModel::TUNING_UNSPECIFIED), Qt::CaseInsensitive) != 0)
{
cmdLine << "--tune" << m_options->tune().simplified().toLower();
}
} }
if(!m_options->profile().simplified().isEmpty()) if(!m_options->profile().simplified().isEmpty())

View File

@ -97,6 +97,13 @@ public:
} }
} }
virtual QStringList getTunings(void) const
{
QStringList tunings;
tunings << "SSIM" << "FastDecode" << "ZeroLatency";
return tunings;
}
virtual QStringList getProfiles(const int &variant) const virtual QStringList getProfiles(const int &variant) const
{ {
return QStringList(); return QStringList();
@ -251,9 +258,12 @@ void X265Encoder::buildCommandLine(QStringList &cmdLine, const bool &usePipe, co
cmdLine << "--preset" << m_options->preset().toLower(); cmdLine << "--preset" << m_options->preset().toLower();
if(m_options->tune().compare("none", Qt::CaseInsensitive)) if(!m_options->tune().simplified().isEmpty())
{ {
cmdLine << "--tune" << m_options->tune().toLower(); if(m_options->tune().simplified().compare(QString::fromLatin1(OptionsModel::TUNING_UNSPECIFIED), Qt::CaseInsensitive) != 0)
{
cmdLine << "--tune" << m_options->tune().simplified().toLower();
}
} }
if(m_options->profile().compare("auto", Qt::CaseInsensitive) != 0) if(m_options->profile().compare("auto", Qt::CaseInsensitive) != 0)

View File

@ -46,6 +46,7 @@ static const char *KEY_PROFILE_NAME = "profile_name";
static const char *KEY_CUSTOM_ENCODER = "custom_params_encoder"; static const char *KEY_CUSTOM_ENCODER = "custom_params_encoder";
static const char *KEY_CUSTOM_AVS2YUV = "custom_params_avs2yuv"; static const char *KEY_CUSTOM_AVS2YUV = "custom_params_avs2yuv";
const char *const OptionsModel::TUNING_UNSPECIFIED = "<None>";
const char *const OptionsModel::PROFILE_UNRESTRICTED = "<Unrestricted>"; const char *const OptionsModel::PROFILE_UNRESTRICTED = "<Unrestricted>";
OptionsModel::OptionsModel(const SysinfoModel *sysinfo) OptionsModel::OptionsModel(const SysinfoModel *sysinfo)
@ -57,7 +58,7 @@ OptionsModel::OptionsModel(const SysinfoModel *sysinfo)
m_bitrate = 1200; m_bitrate = 1200;
m_quantizer = 22; m_quantizer = 22;
m_preset = "Medium"; m_preset = "Medium";
m_tune = "None"; m_tune = QString::fromLatin1(OptionsModel::TUNING_UNSPECIFIED);
m_profile = QString::fromLatin1(OptionsModel::PROFILE_UNRESTRICTED); m_profile = QString::fromLatin1(OptionsModel::PROFILE_UNRESTRICTED);
m_custom_encoder = QString(); m_custom_encoder = QString();
m_custom_avs2yuv = QString(); m_custom_avs2yuv = QString();

View File

@ -60,6 +60,7 @@ public:
RCMode_ABR = 3, RCMode_ABR = 3,
}; };
static const char *const TUNING_UNSPECIFIED;
static const char *const PROFILE_UNRESTRICTED; static const char *const PROFILE_UNRESTRICTED;
//Getter //Getter

View File

@ -26,7 +26,7 @@
#define VER_X264_MAJOR 2 #define VER_X264_MAJOR 2
#define VER_X264_MINOR 3 #define VER_X264_MINOR 3
#define VER_X264_PATCH 5 #define VER_X264_PATCH 5
#define VER_X264_BUILD 820 #define VER_X264_BUILD 821
#define VER_X264_PORTABLE_EDITION (0) #define VER_X264_PORTABLE_EDITION (0)

View File

@ -161,7 +161,7 @@ protected:
if(m_icon) { if(m_icon->isHidden()) m_icon->show(); } if(m_icon) { if(m_icon->isHidden()) m_icon->show(); }
if(QWidget *w = m_notifier->topLevelWidget()->focusWidget()) if(QWidget *w = m_notifier->topLevelWidget()->focusWidget())
{ {
QToolTip::showText(static_cast<QWidget*>(w->parent())->mapToGlobal(w->pos()), QString("<nobr>%1</nobr>").arg(tr("<b>Warning:</b> You entered a parameter that is incomaptible with using %1 from a GUI.<br>Please note that the GUI will automatically set <i>this</i> parameter for you (if required).").arg(toolName)), m_notifier, QRect()); QToolTip::showText(static_cast<QWidget*>(w->parent())->mapToGlobal(w->pos()), tr("<b>Warning:</b> You entered a parameter that is forbidden. Please note that the GUI will automatically set <i>this</i> parameter for you (if required)."), m_notifier, QRect());
} }
} }
} }
@ -195,7 +195,7 @@ public:
invalid = invalid || checkParam(input, QString::fromLatin1(p[i]), true); invalid = invalid || checkParam(input, QString::fromLatin1(p[i]), true);
} }
return setStatus(invalid, "x264") ? QValidator::Intermediate : QValidator::Acceptable; return setStatus(invalid, "encoder") ? QValidator::Intermediate : QValidator::Acceptable;
} }
}; };
@ -245,6 +245,7 @@ AddJobDialog::AddJobDialog(QWidget *parent, OptionsModel *const options, Recentl
setMaximumHeight(height()); setMaximumHeight(height());
//Init combobox items //Init combobox items
ui->cbxTuning ->addItem(QString::fromLatin1(OptionsModel::TUNING_UNSPECIFIED));
ui->cbxProfile->addItem(QString::fromLatin1(OptionsModel::PROFILE_UNRESTRICTED)); ui->cbxProfile->addItem(QString::fromLatin1(OptionsModel::PROFILE_UNRESTRICTED));
//Hide optional controls //Hide optional controls
@ -444,6 +445,21 @@ void AddJobDialog::encoderIndexChanged(int index)
ui->cbxEncoderVariant->setItemText(OptionsModel::EncVariant_LoBit, encoderInfo.getVariantId(OptionsModel::EncVariant_LoBit)); ui->cbxEncoderVariant->setItemText(OptionsModel::EncVariant_LoBit, encoderInfo.getVariantId(OptionsModel::EncVariant_LoBit));
ui->cbxEncoderVariant->setItemText(OptionsModel::EncVariant_HiBit, encoderInfo.getVariantId(OptionsModel::EncVariant_HiBit)); ui->cbxEncoderVariant->setItemText(OptionsModel::EncVariant_HiBit, encoderInfo.getVariantId(OptionsModel::EncVariant_HiBit));
//Update tunings
QStringList tunings = encoderInfo.getTunings();
if(tunings.empty())
{
ui->cbxTuning->setEnabled(false);
ui->cbxTuning->setCurrentIndex(0);
}
else
{
ui->cbxTuning->setEnabled(true);
ui->cbxTuning->clear();
ui->cbxTuning->addItem(QString::fromLatin1(OptionsModel::TUNING_UNSPECIFIED));
ui->cbxTuning->addItems(tunings);
}
variantIndexChanged(ui->cbxEncoderVariant->currentIndex()); variantIndexChanged(ui->cbxEncoderVariant->currentIndex());
} }
@ -724,12 +740,28 @@ void AddJobDialog::saveTemplateButtonClicked(void)
forever forever
{ {
bool ok = false; bool ok = false;
name = QInputDialog::getText(this, tr("Save Template"), tr("Please enter the name of the template:").leftJustified(144, ' '), QLineEdit::Normal, name, &ok).simplified();
QStringList items;
items << name;
for(int i = 0; i < ui->cbxTemplate->count(); i++)
{
const QString tempName = ui->cbxTemplate->itemText(i);
if(!(tempName.contains('<') || tempName.contains('>')))
{
items << tempName;
}
}
name = QInputDialog::getItem(this, tr("Save Template"), tr("Please enter the name of the template:").leftJustified(144, ' '), items, 0, true, &ok).simplified();
if(!ok) if(!ok)
{ {
X264_DELETE(options); X264_DELETE(options);
return; return;
} }
if(name.isEmpty())
{
continue;
}
if(name.contains('<') || name.contains('>') || name.contains('\\') || name.contains('/') || name.contains('"')) if(name.contains('<') || name.contains('>') || name.contains('\\') || name.contains('/') || name.contains('"'))
{ {
QMessageBox::warning (this, tr("Invalid Name"), tr("<nobr>Sorry, the name you have entered is invalid!</nobr>")); QMessageBox::warning (this, tr("Invalid Name"), tr("<nobr>Sorry, the name you have entered is invalid!</nobr>"));