transcoder: Add options widget for fdkaacenc

As with the other cases, the base GstAudioEncoder class properties are
not included.
Reference: https://gstreamer.freedesktop.org/documentation/fdkaac/fdkaacenc.html
This commit is contained in:
Jim Broadus 2021-02-06 15:08:37 -08:00 committed by John Maguire
parent e84f87f625
commit 4994091f86
5 changed files with 240 additions and 0 deletions

View File

@ -320,6 +320,7 @@ set(SOURCES
transcoder/transcoderoptionsaac.cpp transcoder/transcoderoptionsaac.cpp
transcoder/transcoderoptionsdialog.cpp transcoder/transcoderoptionsdialog.cpp
transcoder/transcoderoptionserror.cpp transcoder/transcoderoptionserror.cpp
transcoder/transcoderoptionsfdkaac.cpp
transcoder/transcoderoptionsflac.cpp transcoder/transcoderoptionsflac.cpp
transcoder/transcoderoptionsmp3.cpp transcoder/transcoderoptionsmp3.cpp
transcoder/transcoderoptionsopus.cpp transcoder/transcoderoptionsopus.cpp
@ -618,6 +619,7 @@ set(HEADERS
transcoder/transcoder.h transcoder/transcoder.h
transcoder/transcoderoptionsdialog.h transcoder/transcoderoptionsdialog.h
transcoder/transcoderoptionsmp3.h transcoder/transcoderoptionsmp3.h
transcoder/transcoderoptionsfdkaac.h
transcoder/transcoderoptionsflac.h transcoder/transcoderoptionsflac.h
transcoder/transcodersettingspage.h transcoder/transcodersettingspage.h
@ -747,6 +749,7 @@ set(UI
transcoder/transcoderoptionsaac.ui transcoder/transcoderoptionsaac.ui
transcoder/transcoderoptionsdialog.ui transcoder/transcoderoptionsdialog.ui
transcoder/transcoderoptionserror.ui transcoder/transcoderoptionserror.ui
transcoder/transcoderoptionsfdkaac.ui
transcoder/transcoderoptionsflac.ui transcoder/transcoderoptionsflac.ui
transcoder/transcoderoptionsmp3.ui transcoder/transcoderoptionsmp3.ui
transcoder/transcoderoptionsopus.ui transcoder/transcoderoptionsopus.ui

View File

@ -22,6 +22,7 @@
#include "transcoder.h" #include "transcoder.h"
#include "transcoderoptionsaac.h" #include "transcoderoptionsaac.h"
#include "transcoderoptionserror.h" #include "transcoderoptionserror.h"
#include "transcoderoptionsfdkaac.h"
#include "transcoderoptionsflac.h" #include "transcoderoptionsflac.h"
#include "transcoderoptionsmp3.h" #include "transcoderoptionsmp3.h"
#include "transcoderoptionsopus.h" #include "transcoderoptionsopus.h"
@ -78,6 +79,8 @@ TranscoderOptionsInterface* TranscoderOptionsDialog::MakeOptionsPage(
return new TranscoderOptionsFlac(parent); return new TranscoderOptionsFlac(parent);
} else if (element == "faac") { } else if (element == "faac") {
return new TranscoderOptionsAAC(parent); return new TranscoderOptionsAAC(parent);
} else if (element == "fdkaacenc") {
return new TranscoderOptionsFDKAAC(parent);
} else if (element == "lamemp3enc") { } else if (element == "lamemp3enc") {
return new TranscoderOptionsMP3(parent); return new TranscoderOptionsMP3(parent);
} else if (element == "vorbisenc") { } else if (element == "vorbisenc") {

View File

@ -0,0 +1,69 @@
/* This file is part of Clementine.
Copyright 2021, Jim Broadus <jbroadus@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
/*
Settings for the fdkaacenc gstreamer element.
https://gstreamer.freedesktop.org/documentation/fdkaac/fdkaacenc.html
*/
#include "transcoderoptionsfdkaac.h"
#include <QSettings>
#include "ui_transcoderoptionsfdkaac.h"
const char* TranscoderOptionsFDKAAC::kSettingsGroup = "Transcoder/fdkaacenc";
TranscoderOptionsFDKAAC::TranscoderOptionsFDKAAC(QWidget* parent)
: TranscoderOptionsInterface(parent), ui_(new Ui_TranscoderOptionsFDKAAC) {
ui_->setupUi(this);
connect(ui_->target_radio, SIGNAL(toggled(bool)),
SLOT(TargetBitrateToggle(bool)));
}
TranscoderOptionsFDKAAC::~TranscoderOptionsFDKAAC() { delete ui_; }
void TranscoderOptionsFDKAAC::Load() {
QSettings s;
s.beginGroup(kSettingsGroup + settings_postfix_);
// If bitrate is set to 0 (default), then bitrate is detemined by sample rate
// and channel count.
int bitrate = s.value("bitrate", 0).toInt();
if (bitrate == 0) {
ui_->auto_radio->setChecked(true);
ui_->bitrate_group->setEnabled(false);
} else {
ui_->target_radio->setChecked(true);
ui_->bitrate_slider->setValue(bitrate / 1000);
}
}
void TranscoderOptionsFDKAAC::Save() {
QSettings s;
s.beginGroup(kSettingsGroup + settings_postfix_);
if (ui_->target_radio->isChecked()) {
s.setValue("bitrate", ui_->bitrate_slider->value() * 1000);
} else {
s.setValue("bitrate", 0);
}
}
void TranscoderOptionsFDKAAC::TargetBitrateToggle(bool checked) {
ui_->bitrate_group->setEnabled(checked);
}

View File

@ -0,0 +1,44 @@
/* This file is part of Clementine.
Copyright 2021, Jim Broadus <jbroadus@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TRANSCODEROPTIONSFDKAAC_H
#define TRANSCODEROPTIONSFDKAAC_H
#include "transcoderoptionsinterface.h"
class Ui_TranscoderOptionsFDKAAC;
class TranscoderOptionsFDKAAC : public TranscoderOptionsInterface {
Q_OBJECT
public:
TranscoderOptionsFDKAAC(QWidget* parent = nullptr);
~TranscoderOptionsFDKAAC();
void Load();
void Save();
private slots:
void TargetBitrateToggle(bool checked);
private:
static const char* kSettingsGroup;
Ui_TranscoderOptionsFDKAAC* ui_;
};
#endif // TRANSCODEROPTIONSFDKAAC_H

View File

@ -0,0 +1,121 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TranscoderOptionsFDKAAC</class>
<widget class="QWidget" name="TranscoderOptionsFDKAAC">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>480</width>
<height>344</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Bitrate</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QRadioButton" name="auto_radio">
<property name="text">
<string>Automatically determine based on sample rate.</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="target_radio">
<property name="text">
<string>Set target rate</string>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="bitrate_group">
<property name="title">
<string/>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QSpinBox" name="bitrate_spinbox">
<property name="suffix">
<string> kbps</string>
</property>
<property name="minimum">
<number>8</number>
</property>
<property name="maximum">
<number>320</number>
</property>
<property name="singleStep">
<number>8</number>
</property>
<property name="value">
<number>128</number>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="bitrate_slider">
<property name="minimum">
<number>8</number>
</property>
<property name="maximum">
<number>320</number>
</property>
<property name="value">
<number>128</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>bitrate_slider</sender>
<signal>valueChanged(int)</signal>
<receiver>bitrate_spinbox</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
<x>170</x>
<y>29</y>
</hint>
<hint type="destinationlabel">
<x>445</x>
<y>24</y>
</hint>
</hints>
</connection>
<connection>
<sender>bitrate_spinbox</sender>
<signal>valueChanged(int)</signal>
<receiver>bitrate_slider</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
<x>407</x>
<y>18</y>
</hint>
<hint type="destinationlabel">
<x>191</x>
<y>29</y>
</hint>
</hints>
</connection>
</connections>
</ui>