transcoder: Fix flacenc "insane" level encoding
The gstreamer flacenc element defines a set of quality levels that is different from the standard flac library. Its highest level, labeled "insane", uses settings that are outside of the streamable subset. Set the streamable-subset property to false for this level. Reference: https://xiph.org/flac/format.html#subset
This commit is contained in:
parent
e1e559732b
commit
ace5234e62
|
@ -615,6 +615,7 @@ set(HEADERS
|
||||||
transcoder/transcoder.h
|
transcoder/transcoder.h
|
||||||
transcoder/transcoderoptionsdialog.h
|
transcoder/transcoderoptionsdialog.h
|
||||||
transcoder/transcoderoptionsmp3.h
|
transcoder/transcoderoptionsmp3.h
|
||||||
|
transcoder/transcoderoptionsflac.h
|
||||||
transcoder/transcodersettingspage.h
|
transcoder/transcodersettingspage.h
|
||||||
|
|
||||||
ui/about.h
|
ui/about.h
|
||||||
|
|
|
@ -26,6 +26,8 @@ const char* TranscoderOptionsFlac::kSettingsGroup = "Transcoder/flacenc";
|
||||||
TranscoderOptionsFlac::TranscoderOptionsFlac(QWidget* parent)
|
TranscoderOptionsFlac::TranscoderOptionsFlac(QWidget* parent)
|
||||||
: TranscoderOptionsInterface(parent), ui_(new Ui_TranscoderOptionsFlac) {
|
: TranscoderOptionsInterface(parent), ui_(new Ui_TranscoderOptionsFlac) {
|
||||||
ui_->setupUi(this);
|
ui_->setupUi(this);
|
||||||
|
connect(ui_->quality, SIGNAL(valueChanged(int)), this,
|
||||||
|
SLOT(ValueChanged(int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
TranscoderOptionsFlac::~TranscoderOptionsFlac() { delete ui_; }
|
TranscoderOptionsFlac::~TranscoderOptionsFlac() { delete ui_; }
|
||||||
|
@ -37,9 +39,34 @@ void TranscoderOptionsFlac::Load() {
|
||||||
ui_->quality->setValue(s.value("quality", 5).toInt());
|
ui_->quality->setValue(s.value("quality", 5).toInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TranscoderOptionsFlac::ValueChanged(int value) {
|
||||||
|
if (!IsInStreamingSubset(value)) {
|
||||||
|
ui_->info->setStyleSheet("QLabel { color : red }");
|
||||||
|
ui_->info->setText(
|
||||||
|
tr("Warning: This compression level is outside of the streamable "
|
||||||
|
"subset. This means that a decoder may not be able to start "
|
||||||
|
"playing it mid-stream. It may also affect the performance of "
|
||||||
|
"hardware decoders."));
|
||||||
|
} else {
|
||||||
|
ui_->info->setStyleSheet("");
|
||||||
|
ui_->info->setText("");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void TranscoderOptionsFlac::Save() {
|
void TranscoderOptionsFlac::Save() {
|
||||||
QSettings s;
|
QSettings s;
|
||||||
s.beginGroup(kSettingsGroup + settings_postfix_);
|
s.beginGroup(kSettingsGroup + settings_postfix_);
|
||||||
|
|
||||||
s.setValue("quality", ui_->quality->value());
|
int quality = ui_->quality->value();
|
||||||
|
s.setValue("quality", quality);
|
||||||
|
|
||||||
|
s.setValue("streamable-subset", IsInStreamingSubset(quality));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TranscoderOptionsFlac::IsInStreamingSubset(int level) {
|
||||||
|
// The gstreamer flacenc element defines its own quality settings. The
|
||||||
|
// highest level, 9 (aka "insane"), uses settings that are outside of the
|
||||||
|
// streamable subset.
|
||||||
|
// https://xiph.org/flac/format.html#subset
|
||||||
|
return (level < 9);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
class Ui_TranscoderOptionsFlac;
|
class Ui_TranscoderOptionsFlac;
|
||||||
|
|
||||||
class TranscoderOptionsFlac : public TranscoderOptionsInterface {
|
class TranscoderOptionsFlac : public TranscoderOptionsInterface {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TranscoderOptionsFlac(QWidget* parent = nullptr);
|
TranscoderOptionsFlac(QWidget* parent = nullptr);
|
||||||
~TranscoderOptionsFlac();
|
~TranscoderOptionsFlac();
|
||||||
|
@ -30,7 +32,12 @@ class TranscoderOptionsFlac : public TranscoderOptionsInterface {
|
||||||
void Load();
|
void Load();
|
||||||
void Save();
|
void Save();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void ValueChanged(int value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
static bool IsInStreamingSubset(int level);
|
||||||
|
|
||||||
static const char* kSettingsGroup;
|
static const char* kSettingsGroup;
|
||||||
|
|
||||||
Ui_TranscoderOptionsFlac* ui_;
|
Ui_TranscoderOptionsFlac* ui_;
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
</property>
|
</property>
|
||||||
<layout class="QFormLayout" name="formLayout">
|
<layout class="QFormLayout" name="formLayout">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="quality_label">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string comment="Sound quality">Quality</string>
|
<string comment="Sound quality">Quality</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="fast_label">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Fast</string>
|
<string>Fast</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -47,7 +47,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_3">
|
<widget class="QLabel" name="best_label">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Best</string>
|
<string>Best</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -55,6 +55,22 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="0" colspan="2">
|
||||||
|
<widget class="QLabel" name="info">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
|
Loading…
Reference in New Issue