Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 9e1b3d93 authored by Vincent PINON's avatar Vincent PINON

Handle VBR encoding profiles, and use it!

parent 645e6a69
......@@ -472,19 +472,33 @@ void RenderWidget::slotSaveProfile()
ui.extension->setText(m_view.size_list->currentItem()->data(ExtensionRole).toString());
ui.profile_name->setFocus();
QListWidgetItem *item = m_view.size_list->currentItem();
if (ui.parameters->toPlainText().contains("%bitrate")) {
if (ui.parameters->toPlainText().contains("%bitrate") || ui.parameters->toPlainText().contains("%quality")) {
if (ui.parameters->toPlainText().contains("%quality")) {
ui.vbitrates_label->setText(i18n("Qualities"));
ui.default_vbitrate_label->setText(i18n("Default quality"));
} else {
ui.vbitrates_label->setText(i18n("Bitrates"));
ui.default_vbitrate_label->setText(i18n("Default bitrate"));
}
if ( item && item->data(BitratesRole).canConvert(QVariant::StringList) && item->data(BitratesRole).toStringList().count()) {
QStringList bitrates = item->data(BitratesRole).toStringList();
ui.vbitrates_list->setText(bitrates.join(","));
ui.vbitrates_list->setText(bitrates.join(","));
if (item->data(DefaultBitrateRole).canConvert(QVariant::String))
ui.default_vbitrate->setValue(item->data(DefaultBitrateRole).toInt());
}
}
else ui.vbitrates->setHidden(true);
if (ui.parameters->toPlainText().contains("%audiobitrate")) {
if ( item && item->data(AudioBitratesRole).canConvert(QVariant::StringList) && item->data(AudioBitratesRole).toStringList().count()) {
if (ui.parameters->toPlainText().contains("%audiobitrate") || ui.parameters->toPlainText().contains("%audioquality")) {
if (ui.parameters->toPlainText().contains("%audioquality")) {
ui.abitrates_label->setText(i18n("Qualities"));
ui.default_abitrate_label->setText(i18n("Default quality"));
} else {
ui.abitrates_label->setText(i18n("Bitrates"));
ui.default_abitrate_label->setText(i18n("Default bitrate"));
}
if ( item && item->data(AudioBitratesRole).canConvert(QVariant::StringList) && item->data(AudioBitratesRole).toStringList().count()) {
QStringList bitrates = item->data(AudioBitratesRole).toStringList();
ui.abitrates_list->setText(bitrates.join(","));
ui.abitrates_list->setText(bitrates.join(","));
if (item->data(DefaultAudioBitrateRole).canConvert(QVariant::String))
ui.default_abitrate->setValue(item->data(DefaultAudioBitrateRole).toInt());
}
......@@ -505,12 +519,12 @@ void RenderWidget::slotSaveProfile()
profileElement.setAttribute("extension", ui.extension->text().simplified());
QString args = ui.parameters->toPlainText().simplified();
profileElement.setAttribute("args", args);
if (args.contains("%bitrate")) {
if (args.contains("%bitrate") || args.contains("%quality")) {
// profile has a variable bitrate
profileElement.setAttribute("defaultbitrate", QString::number(ui.default_vbitrate->value()));
profileElement.setAttribute("bitrates", ui.vbitrates_list->text());
}
if (args.contains("%audiobitrate")) {
if (args.contains("%audiobitrate") || args.contains("%audioquality")) {
// profile has a variable bitrate
profileElement.setAttribute("defaultaudiobitrate", QString::number(ui.default_abitrate->value()));
profileElement.setAttribute("audiobitrates", ui.abitrates_list->text());
......@@ -640,10 +654,17 @@ void RenderWidget::slotEditProfile()
ui.extension->setText(extension);
ui.parameters->setText(params);
ui.profile_name->setFocus();
if (ui.parameters->toPlainText().contains("%bitrate")) {
if (ui.parameters->toPlainText().contains("%bitrate") || ui.parameters->toPlainText().contains("%quality")) {
if (ui.parameters->toPlainText().contains("%quality")) {
ui.vbitrates_label->setText(i18n("Qualities"));
ui.default_vbitrate_label->setText(i18n("Default quality"));
} else {
ui.vbitrates_label->setText(i18n("Bitrates"));
ui.default_vbitrate_label->setText(i18n("Default bitrate"));
}
if ( item->data(BitratesRole).canConvert(QVariant::StringList) && item->data(BitratesRole).toStringList().count()) {
QStringList bitrates = item->data(BitratesRole).toStringList();
ui.vbitrates_list->setText(bitrates.join(","));
ui.vbitrates_list->setText(bitrates.join(","));
if (item->data(DefaultBitrateRole).canConvert(QVariant::String))
ui.default_vbitrate->setValue(item->data(DefaultBitrateRole).toInt());
}
......@@ -651,10 +672,17 @@ void RenderWidget::slotEditProfile()
ui.vbitrates->setHidden(true);
}
if (ui.parameters->toPlainText().contains("%audiobitrate")) {
if ( item->data(AudioBitratesRole).canConvert(QVariant::StringList) && item->data(AudioBitratesRole).toStringList().count()) {
if (ui.parameters->toPlainText().contains("%audiobitrate") || ui.parameters->toPlainText().contains("%audioquality")) {
if (ui.parameters->toPlainText().contains("%audioquality")) {
ui.abitrates_label->setText(i18n("Qualities"));
ui.default_abitrate_label->setText(i18n("Default quality"));
} else {
ui.abitrates_label->setText(i18n("Bitrates"));
ui.default_abitrate_label->setText(i18n("Default bitrate"));
}
if ( item->data(AudioBitratesRole).canConvert(QVariant::StringList) && item->data(AudioBitratesRole).toStringList().count()) {
QStringList bitrates = item->data(AudioBitratesRole).toStringList();
ui.abitrates_list->setText(bitrates.join(","));
ui.abitrates_list->setText(bitrates.join(","));
if (item->data(DefaultAudioBitrateRole).canConvert(QVariant::String))
ui.default_abitrate->setValue(item->data(DefaultAudioBitrateRole).toInt());
}
......@@ -718,14 +746,14 @@ void RenderWidget::slotEditProfile()
profileElement.setAttribute("extension", ui.extension->text().simplified());
QString args = ui.parameters->toPlainText().simplified();
profileElement.setAttribute("args", args);
if (args.contains("%bitrate")) {
if (args.contains("%bitrate") || args.contains("%quality")) {
// profile has a variable bitrate
profileElement.setAttribute("defaultbitrate", QString::number(ui.default_vbitrate->value()));
profileElement.setAttribute("defaultbitrate", QString::number(ui.default_vbitrate->value()));
profileElement.setAttribute("bitrates", ui.vbitrates_list->text());
}
if (args.contains("%audiobitrate")) {
if (args.contains("%audiobitrate") || args.contains("%audioquality")) {
// profile has a variable bitrate
profileElement.setAttribute("defaultaudiobitrate", QString::number(ui.default_abitrate->value()));
profileElement.setAttribute("defaultaudiobitrate", QString::number(ui.default_abitrate->value()));
profileElement.setAttribute("audiobitrates", ui.abitrates_list->text());
}
......@@ -1476,7 +1504,14 @@ void RenderWidget::refreshParams()
// setup comboBox with bitrates
m_view.comboBitrates->clear();
if (params.contains("bitrate")) {
if (params.contains("bitrate") || params.contains("quality")) {
if (params.contains("quality")) {
m_view.bitrateLabel->setText(i18n("Video\nquality"));
m_view.comboBitrates->setToolTip(i18n("Lower is better"));
} else {
m_view.bitrateLabel->setText(i18n("Video\nbitrate"));
m_view.comboBitrates->setToolTip(i18n("Higher is better"));
}
m_view.comboBitrates->setEnabled(true);
m_view.bitrateLabel->setEnabled(true);
if ( item->data(BitratesRole).canConvert(QVariant::StringList) && item->data(BitratesRole).toStringList().count()) {
......@@ -1493,7 +1528,12 @@ void RenderWidget::refreshParams()
// setup comboBox with audiobitrates
m_view.comboAudioBitrates->clear();
if (params.contains("audiobitrate")) {
if (params.contains("audiobitrate") || params.contains("audioquality")) {
if (params.contains("audioquality")) {
m_view.audiobitrateLabel->setText(i18n("Audio\nquality"));
} else {
m_view.audiobitrateLabel->setText(i18n("Audio\nbitrate"));
}
m_view.comboAudioBitrates->setEnabled(true);
m_view.audiobitrateLabel->setEnabled(true);
if ( item->data(AudioBitratesRole).canConvert(QVariant::StringList) && item->data(AudioBitratesRole).toStringList().count()) {
......@@ -1578,7 +1618,7 @@ void RenderWidget::parseFile(const QString &exportFile, bool editable)
bool replaceVorbisCodec = false;
if (acodecsList.contains("libvorbis")) replaceVorbisCodec = true;
bool replaceLibfaacCodec = false;
if (!acodecsList.contains("aac") && acodecsList.contains("libfaac")) replaceLibfaacCodec = true;
if (acodecsList.contains("libfaac")) replaceLibfaacCodec = true;
if (editable || groups.count() == 0) {
QDomElement profiles = doc.documentElement();
......
......@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>460</width>
<width>465</width>
<height>732</height>
</rect>
</property>
......@@ -14,7 +14,16 @@
<string>Dialog</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
......@@ -180,7 +189,7 @@
<item row="4" column="5" rowspan="4">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Bitrate</string>
<string>File size</string>
</property>
<layout class="QGridLayout" name="gridLayout_9">
<item row="0" column="0">
......@@ -336,17 +345,17 @@
<widget class="KComboBox" name="destination_list"/>
</item>
<item row="5" column="3">
<widget class="KIntNumInput" name="encoder_threads">
<widget class="KIntNumInput" name="encoder_threads" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<property name="minimum" stdset="0">
<number>1</number>
</property>
<property name="maximum">
<property name="maximum" stdset="0">
<number>999</number>
</property>
</widget>
......@@ -526,8 +535,8 @@
<item row="8" column="1" colspan="5">
<layout class="QHBoxLayout" name="rescale_box">
<item>
<widget class="KIntNumInput" name="rescale_width">
<property name="minimum">
<widget class="KIntNumInput" name="rescale_width" native="true">
<property name="minimum" stdset="0">
<number>0</number>
</property>
</widget>
......@@ -546,8 +555,8 @@
</widget>
</item>
<item>
<widget class="KIntNumInput" name="rescale_height">
<property name="minimum">
<widget class="KIntNumInput" name="rescale_height" native="true">
<property name="minimum" stdset="0">
<number>0</number>
</property>
</widget>
......@@ -806,6 +815,7 @@
<class>KUrlRequester</class>
<extends>QFrame</extends>
<header>kurlrequester.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>KIntNumInput</class>
......
......@@ -28,7 +28,7 @@
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="2" column="0">
<widget class="QLabel" name="label_7">
<widget class="QLabel" name="default_vbitrate_label">
<property name="text">
<string>Default bitrate</string>
</property>
......@@ -38,7 +38,7 @@
<widget class="KLineEdit" name="vbitrates_list"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_6">
<widget class="QLabel" name="vbitrates_label">
<property name="text">
<string>Bitrates</string>
</property>
......@@ -125,14 +125,14 @@
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QLabel" name="label_8">
<widget class="QLabel" name="abitrates_label">
<property name="text">
<string>Bitrates</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_9">
<widget class="QLabel" name="default_abitrate_label">
<property name="text">
<string>Default bitrate</string>
</property>
......@@ -149,11 +149,8 @@
</widget>
</item>
</layout>
<zorder>label_9</zorder>
<zorder>label_8</zorder>
<zorder>abitrates_list</zorder>
<zorder>label_9</zorder>
<zorder>label_8</zorder>
<zorder>default_abitrate_label</zorder>
<zorder>abitrates_label</zorder>
<zorder>abitrates_list</zorder>
<zorder>default_abitrate</zorder>
</widget>
......@@ -166,16 +163,16 @@
<extends>QComboBox</extends>
<header>kcombobox.h</header>
</customwidget>
<customwidget>
<class>KLineEdit</class>
<extends>QLineEdit</extends>
<header>klineedit.h</header>
</customwidget>
<customwidget>
<class>KTextEdit</class>
<extends>QTextEdit</extends>
<header>ktextedit.h</header>
</customwidget>
<customwidget>
<class>KLineEdit</class>
<extends>QLineEdit</extends>
<header>klineedit.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment