parent
63ff2539b4
commit
d5139ac2b2
|
@ -311,6 +311,7 @@ set(SOURCES
|
|||
transcoder/transcoderoptionsdialog.cpp
|
||||
transcoder/transcoderoptionsflac.cpp
|
||||
transcoder/transcoderoptionsmp3.cpp
|
||||
transcoder/transcoderoptionsopus.cpp
|
||||
transcoder/transcoderoptionsspeex.cpp
|
||||
transcoder/transcoderoptionsvorbis.cpp
|
||||
transcoder/transcoderoptionswma.cpp
|
||||
|
@ -701,6 +702,7 @@ set(UI
|
|||
transcoder/transcoderoptionsdialog.ui
|
||||
transcoder/transcoderoptionsflac.ui
|
||||
transcoder/transcoderoptionsmp3.ui
|
||||
transcoder/transcoderoptionsopus.ui
|
||||
transcoder/transcoderoptionsspeex.ui
|
||||
transcoder/transcoderoptionsvorbis.ui
|
||||
transcoder/transcoderoptionswma.ui
|
||||
|
|
|
@ -531,7 +531,7 @@ void Song::InitFromFilePartial(const QString& filename) {
|
|||
QString suffix = info.suffix().toLower();
|
||||
if (suffix == "mp3" || suffix == "ogg" || suffix == "flac" || suffix == "mpc"
|
||||
|| suffix == "m4a" || suffix == "aac" || suffix == "wma" || suffix == "mp4"
|
||||
|| suffix == "spx" || suffix == "wav") {
|
||||
|| suffix == "spx" || suffix == "wav" || suffix == "opus") {
|
||||
d->valid_ = true;
|
||||
} else {
|
||||
d->valid_ = false;
|
||||
|
|
|
@ -233,6 +233,7 @@ QList<TranscoderPreset> Transcoder::GetAllPresets() {
|
|||
ret << PresetForFileType(Song::Type_OggSpeex);
|
||||
ret << PresetForFileType(Song::Type_Asf);
|
||||
ret << PresetForFileType(Song::Type_Wav);
|
||||
ret << PresetForFileType(Song::Type_OggOpus);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -250,6 +251,8 @@ TranscoderPreset Transcoder::PresetForFileType(Song::FileType type) {
|
|||
return TranscoderPreset(type, "Ogg Flac", "ogg", "audio/x-flac", "application/ogg");
|
||||
case Song::Type_OggSpeex:
|
||||
return TranscoderPreset(type, "Ogg Speex", "spx", "audio/x-speex", "application/ogg");
|
||||
case Song::Type_OggOpus:
|
||||
return TranscoderPreset(type, "Ogg Opus", "opus", "audio/x-opus", "application/ogg");
|
||||
case Song::Type_Asf:
|
||||
return TranscoderPreset(type, "Windows Media audio", "wma", "audio/x-wma", "video/x-ms-asf");
|
||||
case Song::Type_Wav:
|
||||
|
@ -407,12 +410,13 @@ bool Transcoder::StartJob(const Job &job) {
|
|||
if (!state->pipeline_) return false;
|
||||
|
||||
// Create all the elements
|
||||
GstElement* src = CreateElement("filesrc", state->pipeline_);
|
||||
GstElement* decode = CreateElement("decodebin2", state->pipeline_);
|
||||
GstElement* convert = CreateElement("audioconvert", state->pipeline_);
|
||||
GstElement* codec = CreateElementForMimeType("Codec/Encoder/Audio", job.preset.codec_mimetype_, state->pipeline_);
|
||||
GstElement* muxer = CreateElementForMimeType("Codec/Muxer", job.preset.muxer_mimetype_, state->pipeline_);
|
||||
GstElement* sink = CreateElement("filesink", state->pipeline_);
|
||||
GstElement* src = CreateElement("filesrc", state->pipeline_);
|
||||
GstElement* decode = CreateElement("decodebin2", state->pipeline_);
|
||||
GstElement* convert = CreateElement("audioconvert", state->pipeline_);
|
||||
GstElement* resample = CreateElement("audioresample", state->pipeline_);
|
||||
GstElement* codec = CreateElementForMimeType("Codec/Encoder/Audio", job.preset.codec_mimetype_, state->pipeline_);
|
||||
GstElement* muxer = CreateElementForMimeType("Codec/Muxer", job.preset.muxer_mimetype_, state->pipeline_);
|
||||
GstElement* sink = CreateElement("filesink", state->pipeline_);
|
||||
|
||||
if (!src || !decode || !convert || !sink)
|
||||
return false;
|
||||
|
@ -432,11 +436,11 @@ bool Transcoder::StartJob(const Job &job) {
|
|||
// Join them together
|
||||
gst_element_link(src, decode);
|
||||
if (codec && muxer)
|
||||
gst_element_link_many(convert, codec, muxer, sink, NULL);
|
||||
gst_element_link_many(convert, resample, codec, muxer, sink, NULL);
|
||||
else if (codec)
|
||||
gst_element_link_many(convert, codec, sink, NULL);
|
||||
gst_element_link_many(convert, resample, codec, sink, NULL);
|
||||
else if (muxer)
|
||||
gst_element_link_many(convert, muxer, sink, NULL);
|
||||
gst_element_link_many(convert, resample, muxer, sink, NULL);
|
||||
|
||||
// Set properties
|
||||
g_object_set(src, "location", job.input.toUtf8().constData(), NULL);
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "transcoderoptionsmp3.h"
|
||||
#include "transcoderoptionsspeex.h"
|
||||
#include "transcoderoptionsvorbis.h"
|
||||
#include "transcoderoptionsopus.h"
|
||||
#include "transcoderoptionswma.h"
|
||||
#include "ui_transcoderoptionsdialog.h"
|
||||
|
||||
|
@ -37,6 +38,7 @@ TranscoderOptionsDialog::TranscoderOptionsDialog(Song::FileType type, QWidget* p
|
|||
case Song::Type_Mp4: options_ = new TranscoderOptionsAAC(this); break;
|
||||
case Song::Type_Mpeg: options_ = new TranscoderOptionsMP3(this); break;
|
||||
case Song::Type_OggVorbis: options_ = new TranscoderOptionsVorbis(this); break;
|
||||
case Song::Type_OggOpus: options_ = new TranscoderOptionsOpus(this); break;
|
||||
case Song::Type_OggSpeex: options_ = new TranscoderOptionsSpeex(this); break;
|
||||
case Song::Type_Asf: options_ = new TranscoderOptionsWma(this); break;
|
||||
default:
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
/* This file is part of Clementine.
|
||||
Copyright 2013, Martin Brodbeck <martin@brodbeck-online.de>
|
||||
|
||||
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/>.
|
||||
*/
|
||||
|
||||
#include "transcoderoptionsopus.h"
|
||||
#include "ui_transcoderoptionsopus.h"
|
||||
|
||||
#include <QSettings>
|
||||
|
||||
// TODO: Add more options than only bitrate as soon as gst doesn't crash
|
||||
// anymore while using the cbr parmameter (like cbr=false)
|
||||
|
||||
const char* TranscoderOptionsOpus::kSettingsGroup = "Transcoder/opusenc";
|
||||
|
||||
TranscoderOptionsOpus::TranscoderOptionsOpus(QWidget* parent)
|
||||
: TranscoderOptionsInterface(parent),
|
||||
ui_(new Ui_TranscoderOptionsOpus)
|
||||
{
|
||||
ui_->setupUi(this);
|
||||
}
|
||||
|
||||
TranscoderOptionsOpus::~TranscoderOptionsOpus() {
|
||||
delete ui_;
|
||||
}
|
||||
|
||||
void TranscoderOptionsOpus::Load() {
|
||||
QSettings s;
|
||||
s.beginGroup(kSettingsGroup);
|
||||
|
||||
ui_->bitrate_slider->setValue(s.value("bitrate", 128000).toInt() / 1000);
|
||||
}
|
||||
|
||||
void TranscoderOptionsOpus::Save() {
|
||||
QSettings s;
|
||||
s.beginGroup(kSettingsGroup);
|
||||
|
||||
s.setValue("bitrate", ui_->bitrate_slider->value() * 1000);
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
/* This file is part of Clementine.
|
||||
Copyright 2013, Martin Brodbeck <martin@brodbeck-online.de>
|
||||
|
||||
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 TRANSCODEROPTIONSOPUS_H
|
||||
#define TRANSCODEROPTIONSOPUS_H
|
||||
|
||||
#include "transcoderoptionsinterface.h"
|
||||
|
||||
class Ui_TranscoderOptionsOpus;
|
||||
|
||||
class TranscoderOptionsOpus : public TranscoderOptionsInterface {
|
||||
public:
|
||||
TranscoderOptionsOpus(QWidget* parent = 0);
|
||||
~TranscoderOptionsOpus();
|
||||
|
||||
void Load();
|
||||
void Save();
|
||||
|
||||
private:
|
||||
static const char* kSettingsGroup;
|
||||
|
||||
Ui_TranscoderOptionsOpus* ui_;
|
||||
};
|
||||
|
||||
#endif // TRANSCODEROPTIONSOPUS_H
|
|
@ -0,0 +1,94 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>TranscoderOptionsOpus</class>
|
||||
<widget class="QWidget" name="TranscoderOptionsOpus">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Bitrate</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QSlider" name="bitrate_slider">
|
||||
<property name="minimum">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>510</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>128</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="bitrate_spinbox">
|
||||
<property name="suffix">
|
||||
<string> kbps</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>320</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>128</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</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>166</x>
|
||||
<y>25</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>323</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>325</x>
|
||||
<y>14</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>190</x>
|
||||
<y>31</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
|
@ -38,6 +38,7 @@ void TranscoderSettingsPage::Load() {
|
|||
ui_->transcoding_speex->Load();
|
||||
ui_->transcoding_vorbis->Load();
|
||||
ui_->transcoding_wma->Load();
|
||||
ui_->transcoding_opus->Load();
|
||||
}
|
||||
|
||||
void TranscoderSettingsPage::Save() {
|
||||
|
@ -47,4 +48,5 @@ void TranscoderSettingsPage::Save() {
|
|||
ui_->transcoding_speex->Save();
|
||||
ui_->transcoding_vorbis->Save();
|
||||
ui_->transcoding_wma->Save();
|
||||
ui_->transcoding_opus->Load();
|
||||
}
|
||||
|
|
|
@ -125,6 +125,22 @@
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_7">
|
||||
<attribute name="title">
|
||||
<string>Opus</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_26">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="TranscoderOptionsOpus" name="transcoding_opus" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -166,6 +182,12 @@
|
|||
<header>transcoder/transcoderoptionswma.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>TranscoderOptionsOpus</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>transcoder/transcoderoptionsopus.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
|
Loading…
Reference in New Issue