From 5ed1fcd5e1b09d1fb5667c06fa351ba07a652adc Mon Sep 17 00:00:00 2001 From: David Sansome Date: Sat, 16 Apr 2011 23:04:15 +0000 Subject: [PATCH] Add a load of options to the transcoders. Fixes issue 415. --- data/data.qrc | 1 + data/icons/32x32/tools-wizard.png | Bin 0 -> 1912 bytes src/CMakeLists.txt | 16 + src/transcoder/transcodedialog.cpp | 12 + src/transcoder/transcodedialog.h | 1 + src/transcoder/transcodedialog.ui | 26 +- src/transcoder/transcoder.cpp | 49 ++- src/transcoder/transcoder.h | 1 + src/transcoder/transcoderoptionsaac.cpp | 56 +++ src/transcoder/transcoderoptionsaac.h | 39 +++ src/transcoder/transcoderoptionsaac.ui | 185 ++++++++++ src/transcoder/transcoderoptionsdialog.cpp | 70 ++++ src/transcoder/transcoderoptionsdialog.h | 47 +++ src/transcoder/transcoderoptionsdialog.ui | 64 ++++ src/transcoder/transcoderoptionsflac.cpp | 48 +++ src/transcoder/transcoderoptionsflac.h | 39 +++ src/transcoder/transcoderoptionsflac.ui | 62 ++++ src/transcoder/transcoderoptionsinterface.h | 32 ++ src/transcoder/transcoderoptionsmp3.cpp | 74 ++++ src/transcoder/transcoderoptionsmp3.h | 45 +++ src/transcoder/transcoderoptionsmp3.ui | 291 ++++++++++++++++ src/transcoder/transcoderoptionsspeex.cpp | 64 ++++ src/transcoder/transcoderoptionsspeex.h | 39 +++ src/transcoder/transcoderoptionsspeex.ui | 353 +++++++++++++++++++ src/transcoder/transcoderoptionsvorbis.cpp | 74 ++++ src/transcoder/transcoderoptionsvorbis.h | 39 +++ src/transcoder/transcoderoptionsvorbis.ui | 365 ++++++++++++++++++++ src/transcoder/transcoderoptionswma.cpp | 48 +++ src/transcoder/transcoderoptionswma.h | 39 +++ src/transcoder/transcoderoptionswma.ui | 91 +++++ src/ui/settingsdialog.cpp | 17 + src/ui/settingsdialog.h | 1 + src/ui/settingsdialog.ui | 160 ++++++++- 33 files changed, 2436 insertions(+), 12 deletions(-) create mode 100644 data/icons/32x32/tools-wizard.png create mode 100644 src/transcoder/transcoderoptionsaac.cpp create mode 100644 src/transcoder/transcoderoptionsaac.h create mode 100644 src/transcoder/transcoderoptionsaac.ui create mode 100644 src/transcoder/transcoderoptionsdialog.cpp create mode 100644 src/transcoder/transcoderoptionsdialog.h create mode 100644 src/transcoder/transcoderoptionsdialog.ui create mode 100644 src/transcoder/transcoderoptionsflac.cpp create mode 100644 src/transcoder/transcoderoptionsflac.h create mode 100644 src/transcoder/transcoderoptionsflac.ui create mode 100644 src/transcoder/transcoderoptionsinterface.h create mode 100644 src/transcoder/transcoderoptionsmp3.cpp create mode 100644 src/transcoder/transcoderoptionsmp3.h create mode 100644 src/transcoder/transcoderoptionsmp3.ui create mode 100644 src/transcoder/transcoderoptionsspeex.cpp create mode 100644 src/transcoder/transcoderoptionsspeex.h create mode 100644 src/transcoder/transcoderoptionsspeex.ui create mode 100644 src/transcoder/transcoderoptionsvorbis.cpp create mode 100644 src/transcoder/transcoderoptionsvorbis.h create mode 100644 src/transcoder/transcoderoptionsvorbis.ui create mode 100644 src/transcoder/transcoderoptionswma.cpp create mode 100644 src/transcoder/transcoderoptionswma.h create mode 100644 src/transcoder/transcoderoptionswma.ui diff --git a/data/data.qrc b/data/data.qrc index eaeea7d23..480fdf780 100644 --- a/data/data.qrc +++ b/data/data.qrc @@ -305,5 +305,6 @@ providers/musicbrainz.png last.fm/as_disabled.png last.fm/as_light.png + icons/32x32/tools-wizard.png diff --git a/data/icons/32x32/tools-wizard.png b/data/icons/32x32/tools-wizard.png new file mode 100644 index 0000000000000000000000000000000000000000..34914417ccd8c7722eee0ee83fd02907581f2b3b GIT binary patch literal 1912 zcmV-;2Z#8HP)6nw88?yhVlMR=gzcd zt*=q3JM*9KeD}MT^W&a#?!8L@;D6OaPjqr}THx;PzK_f0K6`sVZN2rGPwOwmFK;e# zb;Q@l2auSUXquLm=74`Qg2Q4}vRJHsv|CXu`n~E6!e{CylZ4=L7vuG!{xw(Nocn=E;6G1;aNz_jtky$0X zNkru*WY>+eq#k}IgYc^f!}QE=E-4|xI|5u!@fI5Fi6X*38ctRhhqH1|hLEh4Zsd8T zQmHB^C{V3gv*z>C(o$$@YJzLmt}#oNEU~&*__7j-S=m9d37W_dbj@W3+U;`4-4aBn zF|%$-7R0x&H9egd#nyCjtvnAjK(%qAanZ!;TcSTFoA+DkYI=h$nOh0d(5u9mj8w#qUy zGZ&(*((CoAO`A5gR8&+zPfrgGL-T_qa{mQ#1hk6)+RVF3zb4jyfBb^*;ecrk9CRG5 z+#p_rjwK?INK%~^5!J3%c4#-x&1od0reLcp9d7mVbIbZ{yF;GjhUcC&44Y{p;QzQR|RqP&iY z2^}fQ?yHwC%X)izWjlB7Tu#H0nwmNX$F`wh%f|KKC?p&1=Da7LtY$9yj>3-;7`{mA z_irTvLs*FRh-E932f@hc;3~s}xVSi8VPT;}yES^1ZiC;M#?)D#Rpsvw$j!}_Mny%1 z;IzoelP9Yb6D_~AOO%9eEB69Ix#8l_Q^>}N#crQ2b^1KYbRiwCtxD_qGM@nY^+Qy7RR7HCp2puc3s z(SQF37+Y&BJ4s|@q-5j9jZWym*VNQhie;xl`x&`huEOoOjzXj*CqYI8@51mlP7||7 z!oWcnU~+_`f8?4KRlG&U-KpwG+2I+!ZRJmmLb(W_+>_}$CH=7Gc!HH-aL0OIyX~RQ zv>GI{XV0dRp{?-o@sZ8<^LY6!g~{9d=33Mpp2vc&wL<7i69T03fO*$uWZ*r^^9@^w z6vyBDEVz(2Ekl2C(FmMV0u%{=ImTs%as|CT=@Ye`sj~hXZ#cI!z9uNEQ=5OUecisg zDOu93PqG*qevt=*O9>3E;6l$@duUd>K-G??;pl3&Pu^Q7=A+*SKMjlC=Xkb$6L@&| zd}J$A88HlH^Pu~6AD|V`nIeb&40q6FPJxbhyrJ*?An4lR&)nSVJE(otM}H;3vn4@p z^$UkZ0F#%V51&8uar{?fS7&h-b)nTbJRmr#$J2H}@~(JrxzI zQerO5^6>Bob#ZZt$Fkjy^FX0cz~aS=|3I7ncn`)Lc4d7ZPk16ap(?l9!iP2$p0NLagNRc;8Zh=;&y`_mZ&$ zV4Kva_>`GdDNiMFE_hogpG3;?~xDYXvpICJzr_48cZ?N7-W@%tYsl z5hMY_pu;|z2f*QQ*8O$IxPdA~oqsd{V+d1}9iPv4!!}1K6egOPnH{G9{{H@e_r^ zTiZ68FArJ;kD8R@Q2rQ(*Kid^DFl`&{iqsi00V>x${rPiC*&0hFm>uwx+xtPI{;${ zGn9-vH8C*(+#vy1gzk`nu>~;x5wip#`Y{w>Wo1P>W5*W27-9nI3_{RVpdDxbYXBB1 y83hyqpCcF&;n)HgLkLg}xEHkG6)yWuWBvre0$R+details, SIGNAL(clicked()), log_dialog_, SLOT(show())); + connect(ui_->options, SIGNAL(clicked()), SLOT(Options())); connect(transcoder_, SIGNAL(JobComplete(QString,bool)), SLOT(JobComplete(QString,bool))); connect(transcoder_, SIGNAL(LogLine(QString)), SLOT(LogLine(QString))); @@ -243,3 +245,13 @@ void TranscodeDialog::timerEvent(QTimerEvent* e) { UpdateProgress(); } } + +void TranscodeDialog::Options() { + TranscoderPreset preset = ui_->format->itemData( + ui_->format->currentIndex()).value(); + + TranscoderOptionsDialog dialog(preset.type_, this); + if (dialog.is_valid()) { + dialog.exec(); + } +} diff --git a/src/transcoder/transcodedialog.h b/src/transcoder/transcodedialog.h index 539e387a4..ebf70d204 100644 --- a/src/transcoder/transcodedialog.h +++ b/src/transcoder/transcodedialog.h @@ -48,6 +48,7 @@ class TranscodeDialog : public QDialog { void JobComplete(const QString& filename, bool success); void LogLine(const QString& message); void AllJobsComplete(); + void Options(); private: void SetWorking(bool working); diff --git a/src/transcoder/transcodedialog.ui b/src/transcoder/transcodedialog.ui index 29243460d..1b8ede1de 100644 --- a/src/transcoder/transcodedialog.ui +++ b/src/transcoder/transcodedialog.ui @@ -14,7 +14,7 @@ Transcode Music - + :/icon.png:/icon.png @@ -104,7 +104,25 @@ - + + + + + + 0 + 0 + + + + + + + + Options... + + + + @@ -178,8 +196,6 @@ destination button_box - - - + diff --git a/src/transcoder/transcoder.cpp b/src/transcoder/transcoder.cpp index ab2999e05..c4a4fea05 100644 --- a/src/transcoder/transcoder.cpp +++ b/src/transcoder/transcoder.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -60,6 +61,8 @@ GstElement* Transcoder::CreateElement(const QString &factory_name, tr("Could not create the GStreamer element \"%1\" -" " make sure you have all the required GStreamer plugins installed") .arg(factory_name)); + } else { + SetElementProperties(factory_name, G_OBJECT(ret)); } return ret; @@ -146,8 +149,6 @@ GstElement* Transcoder::CreateElementForMimeType(const QString& element_type, if (best.name_ == "lamemp3enc") { // Special case: we need to add xingmux and id3v2mux to the pipeline when // using lamemp3enc because it doesn't write the VBR or ID3v2 headers itself. - // We also turn off VBR since it isn't compatible with some music players. - // TODO: Should make settings like these configurable. LogLine("Adding xingmux and id3v2mux to the pipeline"); @@ -164,10 +165,6 @@ GstElement* Transcoder::CreateElementForMimeType(const QString& element_type, return NULL; } - // Configure the lame element - g_object_set(G_OBJECT(lame), "target", 1, NULL); // 1 == bitrate - g_object_set(G_OBJECT(lame), "cbr", true, NULL); - // Link the elements together gst_element_link_many(lame, xing, id3v2, NULL); @@ -210,6 +207,17 @@ Transcoder::Transcoder(QObject* parent) { if (JobFinishedEvent::sEventType == -1) JobFinishedEvent::sEventType = QEvent::registerEventType(); + + // Initialise some settings for the lamemp3enc element. + QSettings s; + s.beginGroup("Transcoder/lamemp3enc"); + + if (s.value("target").isNull()) { + s.setValue("target", 1); // 1 == bitrate + } + if (s.value("cbr").isNull()) { + s.setValue("cbr", true); + } } QList Transcoder::GetAllPresets() { @@ -535,3 +543,32 @@ QMap Transcoder::GetProgress() const { return ret; } + +void Transcoder::SetElementProperties(const QString& name, GObject* object) { + QSettings s; + s.beginGroup("Transcoder/" + name); + + guint properties_count = 0; + GParamSpec** properties = g_object_class_list_properties( + G_OBJECT_GET_CLASS(object), &properties_count); + + for (int i=0 ; iname); + if (value.isNull()) + continue; + + LogLine(QString("Setting %1 property: %2 = %3").arg(name, property->name, value.toString())); + + switch (property->value_type) { + case G_TYPE_DOUBLE: g_object_set(object, property->name, value.toDouble(), NULL); break; + case G_TYPE_FLOAT: g_object_set(object, property->name, value.toFloat(), NULL); break; + case G_TYPE_BOOLEAN: g_object_set(object, property->name, value.toInt(), NULL); break; + case G_TYPE_INT: + default: g_object_set(object, property->name, value.toInt(), NULL); break; + } + } + + g_free(properties); +} diff --git a/src/transcoder/transcoder.h b/src/transcoder/transcoder.h index 940b728db..fbcb77bb7 100644 --- a/src/transcoder/transcoder.h +++ b/src/transcoder/transcoder.h @@ -129,6 +129,7 @@ class Transcoder : public QObject { GstElement* CreateElementForMimeType(const QString& element_type, const QString& mime_type, GstElement* bin = NULL); + void SetElementProperties(const QString& name, GObject* element); static void NewPadCallback(GstElement*, GstPad* pad, gboolean, gpointer data); static gboolean BusCallback(GstBus*, GstMessage* msg, gpointer data); diff --git a/src/transcoder/transcoderoptionsaac.cpp b/src/transcoder/transcoderoptionsaac.cpp new file mode 100644 index 000000000..0f5751396 --- /dev/null +++ b/src/transcoder/transcoderoptionsaac.cpp @@ -0,0 +1,56 @@ +/* This file is part of Clementine. + Copyright 2010, David Sansome + + 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 . +*/ + +#include "transcoderoptionsaac.h" +#include "ui_transcoderoptionsaac.h" + +#include + +const char* TranscoderOptionsAAC::kSettingsGroup = "Transcoder/faac"; + +TranscoderOptionsAAC::TranscoderOptionsAAC(QWidget* parent) + : TranscoderOptionsInterface(parent), + ui_(new Ui_TranscoderOptionsAAC) +{ + ui_->setupUi(this); +} + +TranscoderOptionsAAC::~TranscoderOptionsAAC() { + delete ui_; +} + +void TranscoderOptionsAAC::Load() { + QSettings s; + s.beginGroup(kSettingsGroup); + + ui_->bitrate_slider->setValue(s.value("bitrate", 128000).toInt() / 1000); + ui_->profile->setCurrentIndex(s.value("profile", 2).toInt() - 1); + ui_->tns->setChecked(s.value("tns", false).toBool()); + ui_->midside->setChecked(s.value("midside", true).toBool()); + ui_->shortctl->setCurrentIndex(s.value("shortctl", 0).toInt()); +} + +void TranscoderOptionsAAC::Save() { + QSettings s; + s.beginGroup(kSettingsGroup); + + s.setValue("bitrate", ui_->bitrate_slider->value() * 1000); + s.setValue("profile", ui_->profile->currentIndex() + 1); + s.setValue("tns", ui_->tns->isChecked()); + s.setValue("midside", ui_->midside->isChecked()); + s.setValue("shortctl", ui_->shortctl->currentIndex()); +} diff --git a/src/transcoder/transcoderoptionsaac.h b/src/transcoder/transcoderoptionsaac.h new file mode 100644 index 000000000..6710904bd --- /dev/null +++ b/src/transcoder/transcoderoptionsaac.h @@ -0,0 +1,39 @@ +/* This file is part of Clementine. + Copyright 2010, David Sansome + + 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 . +*/ + +#ifndef TRANSCODEROPTIONSAAC_H +#define TRANSCODEROPTIONSAAC_H + +#include "transcoderoptionsinterface.h" + +class Ui_TranscoderOptionsAAC; + +class TranscoderOptionsAAC : public TranscoderOptionsInterface { +public: + TranscoderOptionsAAC(QWidget* parent = 0); + ~TranscoderOptionsAAC(); + + void Load(); + void Save(); + +private: + static const char* kSettingsGroup; + + Ui_TranscoderOptionsAAC* ui_; +}; + +#endif // TRANSCODEROPTIONSAAC_H diff --git a/src/transcoder/transcoderoptionsaac.ui b/src/transcoder/transcoderoptionsaac.ui new file mode 100644 index 000000000..9463d276e --- /dev/null +++ b/src/transcoder/transcoderoptionsaac.ui @@ -0,0 +1,185 @@ + + + TranscoderOptionsAAC + + + + 0 + 0 + 480 + 344 + + + + Form + + + + + + Bitrate + + + + + + + + + 8 + + + 320 + + + 128 + + + Qt::Horizontal + + + + + + + kbps + + + 8 + + + 320 + + + 8 + + + 128 + + + + + + + + + Profile + + + + + + + 1 + + + + Main profile (MAIN) + + + + + Low complexity profile (LC) + + + + + Scalable sampling rate profile (SSR) + + + + + Long term prediction profile (LTP) + + + + + + + + Use temporal noise shaping + + + + + + + Allow mid/side encoding + + + true + + + + + + + Block type + + + + + + + + Normal block type + + + + + No short blocks + + + + + No long blocks + + + + + + + + bitrate_slider + bitrate_spinbox + profile + shortctl + tns + midside + + + + + bitrate_slider + valueChanged(int) + bitrate_spinbox + setValue(int) + + + 170 + 29 + + + 445 + 24 + + + + + bitrate_spinbox + valueChanged(int) + bitrate_slider + setValue(int) + + + 407 + 18 + + + 191 + 29 + + + + + diff --git a/src/transcoder/transcoderoptionsdialog.cpp b/src/transcoder/transcoderoptionsdialog.cpp new file mode 100644 index 000000000..f0e3661c8 --- /dev/null +++ b/src/transcoder/transcoderoptionsdialog.cpp @@ -0,0 +1,70 @@ +/* This file is part of Clementine. + Copyright 2010, David Sansome + + 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 . +*/ + +#include "transcoderoptionsaac.h" +#include "transcoderoptionsdialog.h" +#include "transcoderoptionsflac.h" +#include "transcoderoptionsmp3.h" +#include "transcoderoptionsspeex.h" +#include "transcoderoptionsvorbis.h" +#include "transcoderoptionswma.h" +#include "ui_transcoderoptionsdialog.h" + +TranscoderOptionsDialog::TranscoderOptionsDialog(Song::FileType type, QWidget* parent) + : QDialog(parent), + ui_(new Ui_TranscoderOptionsDialog), + options_(NULL) +{ + ui_->setupUi(this); + + switch (type) { + case Song::Type_Flac: + case Song::Type_OggFlac: options_ = new TranscoderOptionsFlac(this); break; + 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_OggSpeex: options_ = new TranscoderOptionsSpeex(this); break; + case Song::Type_Asf: options_ = new TranscoderOptionsWma(this); break; + default: + break; + } + + if (options_) { + setWindowTitle(windowTitle() + " - " + Song::TextForFiletype(type)); + options_->layout()->setContentsMargins(0, 0, 0, 0); + ui_->verticalLayout->insertWidget(0, options_); + resize(width(), minimumHeight()); + } +} + +TranscoderOptionsDialog::~TranscoderOptionsDialog() { + delete ui_; +} + +void TranscoderOptionsDialog::showEvent(QShowEvent* e) { + if (options_) { + options_->Load(); + } +} + +void TranscoderOptionsDialog::accept() { + if (options_) { + options_->Save(); + } + QDialog::accept(); +} + diff --git a/src/transcoder/transcoderoptionsdialog.h b/src/transcoder/transcoderoptionsdialog.h new file mode 100644 index 000000000..4f033f378 --- /dev/null +++ b/src/transcoder/transcoderoptionsdialog.h @@ -0,0 +1,47 @@ +/* This file is part of Clementine. + Copyright 2010, David Sansome + + 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 . +*/ + +#ifndef TRANSCODEROPTIONSDIALOG_H +#define TRANSCODEROPTIONSDIALOG_H + +#include + +#include "transcoderoptionsinterface.h" +#include "core/song.h" + +class Ui_TranscoderOptionsDialog; + +class TranscoderOptionsDialog : public QDialog { + Q_OBJECT + +public: + TranscoderOptionsDialog(Song::FileType type, QWidget* parent = 0); + ~TranscoderOptionsDialog(); + + bool is_valid() const { return options_; } + + void accept(); + +protected: + void showEvent(QShowEvent* e); + +private: + Ui_TranscoderOptionsDialog* ui_; + TranscoderOptionsInterface* options_; +}; + +#endif // TRANSCODEROPTIONSDIALOG_H diff --git a/src/transcoder/transcoderoptionsdialog.ui b/src/transcoder/transcoderoptionsdialog.ui new file mode 100644 index 000000000..9bc4844a9 --- /dev/null +++ b/src/transcoder/transcoderoptionsdialog.ui @@ -0,0 +1,64 @@ + + + TranscoderOptionsDialog + + + + 0 + 0 + 400 + 300 + + + + Transcoding options + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + TranscoderOptionsDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + TranscoderOptionsDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/src/transcoder/transcoderoptionsflac.cpp b/src/transcoder/transcoderoptionsflac.cpp new file mode 100644 index 000000000..ee73175ed --- /dev/null +++ b/src/transcoder/transcoderoptionsflac.cpp @@ -0,0 +1,48 @@ +/* This file is part of Clementine. + Copyright 2010, David Sansome + + 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 . +*/ + +#include "transcoderoptionsflac.h" +#include "ui_transcoderoptionsflac.h" + +#include + +const char* TranscoderOptionsFlac::kSettingsGroup = "Transcoder/flacenc"; + +TranscoderOptionsFlac::TranscoderOptionsFlac(QWidget* parent) + : TranscoderOptionsInterface(parent), + ui_(new Ui_TranscoderOptionsFlac) +{ + ui_->setupUi(this); +} + +TranscoderOptionsFlac::~TranscoderOptionsFlac() { + delete ui_; +} + +void TranscoderOptionsFlac::Load() { + QSettings s; + s.beginGroup(kSettingsGroup); + + ui_->quality->setValue(s.value("quality", 5).toInt()); +} + +void TranscoderOptionsFlac::Save() { + QSettings s; + s.beginGroup(kSettingsGroup); + + s.setValue("quality", ui_->quality->value()); +} diff --git a/src/transcoder/transcoderoptionsflac.h b/src/transcoder/transcoderoptionsflac.h new file mode 100644 index 000000000..ae410327b --- /dev/null +++ b/src/transcoder/transcoderoptionsflac.h @@ -0,0 +1,39 @@ +/* This file is part of Clementine. + Copyright 2010, David Sansome + + 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 . +*/ + +#ifndef TRANSCODEROPTIONSFLAC_H +#define TRANSCODEROPTIONSFLAC_H + +#include "transcoderoptionsinterface.h" + +class Ui_TranscoderOptionsFlac; + +class TranscoderOptionsFlac : public TranscoderOptionsInterface { +public: + TranscoderOptionsFlac(QWidget* parent = 0); + ~TranscoderOptionsFlac(); + + void Load(); + void Save(); + +private: + static const char* kSettingsGroup; + + Ui_TranscoderOptionsFlac* ui_; +}; + +#endif // TRANSCODEROPTIONSFLAC_H diff --git a/src/transcoder/transcoderoptionsflac.ui b/src/transcoder/transcoderoptionsflac.ui new file mode 100644 index 000000000..9eaae5cc7 --- /dev/null +++ b/src/transcoder/transcoderoptionsflac.ui @@ -0,0 +1,62 @@ + + + TranscoderOptionsFlac + + + + 0 + 0 + 400 + 102 + + + + Form + + + + + + Quality + + + + + + + + + Fast + + + + + + + 9 + + + 5 + + + Qt::Horizontal + + + QSlider::TicksBelow + + + + + + + Best + + + + + + + + + + diff --git a/src/transcoder/transcoderoptionsinterface.h b/src/transcoder/transcoderoptionsinterface.h new file mode 100644 index 000000000..11d6740fc --- /dev/null +++ b/src/transcoder/transcoderoptionsinterface.h @@ -0,0 +1,32 @@ +/* This file is part of Clementine. + Copyright 2010, David Sansome + + 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 . +*/ + +#ifndef TRANSCODEROPTIONSINTERFACE_H +#define TRANSCODEROPTIONSINTERFACE_H + +#include + +class TranscoderOptionsInterface : public QWidget { +public: + TranscoderOptionsInterface(QWidget* parent) : QWidget(parent) {} + virtual ~TranscoderOptionsInterface() {} + + virtual void Load() = 0; + virtual void Save() = 0; +}; + +#endif // TRANSCODEROPTIONSINTERFACE_H diff --git a/src/transcoder/transcoderoptionsmp3.cpp b/src/transcoder/transcoderoptionsmp3.cpp new file mode 100644 index 000000000..827405598 --- /dev/null +++ b/src/transcoder/transcoderoptionsmp3.cpp @@ -0,0 +1,74 @@ +/* This file is part of Clementine. + Copyright 2010, David Sansome + + 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 . +*/ + +#include "transcoderoptionsmp3.h" +#include "ui_transcoderoptionsmp3.h" + +#include + +const char* TranscoderOptionsMP3::kSettingsGroup = "Transcoder/lamemp3enc"; + +TranscoderOptionsMP3::TranscoderOptionsMP3(QWidget* parent) + : TranscoderOptionsInterface(parent), + ui_(new Ui_TranscoderOptionsMP3) +{ + ui_->setupUi(this); + + connect(ui_->quality_slider, SIGNAL(valueChanged(int)), SLOT(QualitySliderChanged(int))); + connect(ui_->quality_spinbox, SIGNAL(valueChanged(double)), SLOT(QualitySpinboxChanged(double))); +} + +TranscoderOptionsMP3::~TranscoderOptionsMP3() { + delete ui_; +} + +void TranscoderOptionsMP3::Load() { + QSettings s; + s.beginGroup(kSettingsGroup);; + + if (s.value("target", 1).toInt() == 0) { + ui_->target_quality->setChecked(true); + } else { + ui_->target_bitrate->setChecked(true); + } + + ui_->quality_spinbox->setValue(s.value("quality", 4.0).toFloat()); + ui_->bitrate_slider->setValue(s.value("bitrate", 128).toInt()); + ui_->cbr->setChecked(s.value("cbr", true).toBool()); + ui_->encoding_engine_quality->setCurrentIndex(s.value("encoding-engine-quality", 1).toInt()); + ui_->mono->setChecked(s.value("mono", false).toBool()); +} + +void TranscoderOptionsMP3::Save() { + QSettings s; + s.beginGroup(kSettingsGroup); + + s.setValue("target", ui_->target_quality->isChecked() ? 0 : 1); + s.setValue("quality", ui_->quality_spinbox->value()); + s.setValue("bitrate", ui_->bitrate_slider->value()); + s.setValue("cbr", ui_->cbr->isChecked()); + s.setValue("encoding-engine-quality", ui_->encoding_engine_quality->currentIndex()); + s.setValue("mono", ui_->mono->isChecked()); +} + +void TranscoderOptionsMP3::QualitySliderChanged(int value) { + ui_->quality_spinbox->setValue(float(value) / 100); +} + +void TranscoderOptionsMP3::QualitySpinboxChanged(double value) { + ui_->quality_slider->setValue(value * 100); +} diff --git a/src/transcoder/transcoderoptionsmp3.h b/src/transcoder/transcoderoptionsmp3.h new file mode 100644 index 000000000..161643e48 --- /dev/null +++ b/src/transcoder/transcoderoptionsmp3.h @@ -0,0 +1,45 @@ +/* This file is part of Clementine. + Copyright 2010, David Sansome + + 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 . +*/ + +#ifndef TRANSCODEROPTIONSMP3_H +#define TRANSCODEROPTIONSMP3_H + +#include "transcoderoptionsinterface.h" + +class Ui_TranscoderOptionsMP3; + +class TranscoderOptionsMP3 : public TranscoderOptionsInterface { + Q_OBJECT + +public: + TranscoderOptionsMP3(QWidget* parent = 0); + ~TranscoderOptionsMP3(); + + void Load(); + void Save(); + +private slots: + void QualitySliderChanged(int value); + void QualitySpinboxChanged(double value); + +private: + static const char* kSettingsGroup; + + Ui_TranscoderOptionsMP3* ui_; +}; + +#endif // TRANSCODEROPTIONSMP3_H diff --git a/src/transcoder/transcoderoptionsmp3.ui b/src/transcoder/transcoderoptionsmp3.ui new file mode 100644 index 000000000..0933a54fc --- /dev/null +++ b/src/transcoder/transcoderoptionsmp3.ui @@ -0,0 +1,291 @@ + + + TranscoderOptionsMP3 + + + + 0 + 0 + 557 + 486 + + + + Form + + + + + + Optimize for quality + + + false + + + + + + + false + + + + 32 + + + 0 + + + 0 + + + 0 + + + + + Quality + + + + + + + + + 999 + + + 400 + + + Qt::Horizontal + + + QSlider::TicksBelow + + + 100 + + + + + + + 9.990000000000000 + + + 4.000000000000000 + + + + + + + + + + + + Optimize for bitrate + + + true + + + + + + + + 32 + + + 0 + + + 0 + + + 0 + + + + + Bitrate + + + + + + + + + 8 + + + 320 + + + 128 + + + Qt::Horizontal + + + QSlider::TicksBelow + + + 32 + + + + + + + kbps + + + 8 + + + 320 + + + 8 + + + 128 + + + + + + + + + Constant bitrate + + + + + + + + + + Encoding engine quality + + + + + + + 1 + + + + Fast + + + + + Standard + + + + + High + + + + + + + + Force mono encoding + + + + + + + target_quality + quality_slider + quality_spinbox + target_bitrate + bitrate_slider + bitrate_spinbox + cbr + encoding_engine_quality + mono + + + + + bitrate_slider + valueChanged(int) + bitrate_spinbox + setValue(int) + + + 191 + 109 + + + 492 + 115 + + + + + bitrate_spinbox + valueChanged(int) + bitrate_slider + setValue(int) + + + 485 + 115 + + + 182 + 113 + + + + + target_quality + toggled(bool) + widget + setEnabled(bool) + + + 65 + 23 + + + 20 + 49 + + + + + target_bitrate + toggled(bool) + widget_2 + setEnabled(bool) + + + 46 + 87 + + + 22 + 122 + + + + + diff --git a/src/transcoder/transcoderoptionsspeex.cpp b/src/transcoder/transcoderoptionsspeex.cpp new file mode 100644 index 000000000..02dd0ab49 --- /dev/null +++ b/src/transcoder/transcoderoptionsspeex.cpp @@ -0,0 +1,64 @@ +/* This file is part of Clementine. + Copyright 2010, David Sansome + + 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 . +*/ + +#include "transcoderoptionsspeex.h" +#include "ui_transcoderoptionsspeex.h" + +#include + +const char* TranscoderOptionsSpeex::kSettingsGroup = "Transcoder/speexenc"; + +TranscoderOptionsSpeex::TranscoderOptionsSpeex(QWidget* parent) + : TranscoderOptionsInterface(parent), + ui_(new Ui_TranscoderOptionsSpeex) +{ + ui_->setupUi(this); +} + +TranscoderOptionsSpeex::~TranscoderOptionsSpeex() { + delete ui_; +} + +void TranscoderOptionsSpeex::Load() { + QSettings s; + s.beginGroup(kSettingsGroup); + + ui_->quality_slider->setValue(s.value("quality", 8).toInt()); + ui_->bitrate_slider->setValue(s.value("bitrate", 0).toInt() / 1000); + ui_->mode->setCurrentIndex(s.value("mode", 0).toInt()); + ui_->vbr->setChecked(s.value("vbr", false).toBool()); + ui_->abr_slider->setValue(s.value("abr", 0).toInt() / 1000); + ui_->vad->setChecked(s.value("vad", false).toBool()); + ui_->dtx->setChecked(s.value("dtx", false).toBool()); + ui_->complexity->setValue(s.value("complexity", 3).toInt()); + ui_->nframes->setValue(s.value("nframes", 1).toInt()); +} + +void TranscoderOptionsSpeex::Save() { + QSettings s; + s.beginGroup(kSettingsGroup); + + s.setValue("quality", ui_->quality_slider->value()); + s.setValue("bitrate", ui_->bitrate_slider->value() * 1000); + s.setValue("mode", ui_->mode->currentIndex()); + s.setValue("vbr", ui_->vbr->isChecked()); + s.setValue("abr", ui_->abr_slider->value() * 1000); + s.setValue("vad", ui_->vad->isChecked()); + s.setValue("dtx", ui_->dtx->isChecked()); + s.setValue("complexity", ui_->complexity->value()); + s.setValue("nframes", ui_->nframes->value()); +} diff --git a/src/transcoder/transcoderoptionsspeex.h b/src/transcoder/transcoderoptionsspeex.h new file mode 100644 index 000000000..40662cbe4 --- /dev/null +++ b/src/transcoder/transcoderoptionsspeex.h @@ -0,0 +1,39 @@ +/* This file is part of Clementine. + Copyright 2010, David Sansome + + 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 . +*/ + +#ifndef TRANSCODEROPTIONSSPEEX_H +#define TRANSCODEROPTIONSSPEEX_H + +#include "transcoderoptionsinterface.h" + +class Ui_TranscoderOptionsSpeex; + +class TranscoderOptionsSpeex : public TranscoderOptionsInterface { +public: + TranscoderOptionsSpeex(QWidget* parent = 0); + ~TranscoderOptionsSpeex(); + + void Load(); + void Save(); + +private: + static const char* kSettingsGroup; + + Ui_TranscoderOptionsSpeex* ui_; +}; + +#endif // TRANSCODEROPTIONSSPEEX_H diff --git a/src/transcoder/transcoderoptionsspeex.ui b/src/transcoder/transcoderoptionsspeex.ui new file mode 100644 index 000000000..f66d89ed6 --- /dev/null +++ b/src/transcoder/transcoderoptionsspeex.ui @@ -0,0 +1,353 @@ + + + TranscoderOptionsSpeex + + + + 0 + 0 + 555 + 424 + + + + Form + + + + + + Quality + + + + + + + + + 10 + + + 8 + + + Qt::Horizontal + + + QSlider::TicksBelow + + + + + + + 10 + + + 8 + + + + + + + + + Bitrate + + + + + + + + + 320 + + + 8 + + + 32 + + + Qt::Horizontal + + + + + + + + 100 + 0 + + + + automatic + + + kbps + + + 320 + + + 8 + + + + + + + + + Average bitrate + + + + + + + + + 320 + + + 8 + + + 32 + + + Qt::Horizontal + + + + + + + + 100 + 0 + + + + disabled + + + kbps + + + 320 + + + 8 + + + + + + + + + Encoding mode + + + + + + + + Auto + + + + + Ultra wide band (UWB) + + + + + Wide band (WB) + + + + + Narrow band (NB) + + + + + + + + Variable bit rate + + + + + + + Voice activity detection + + + + + + + Discontinuous transmission + + + + + + + Encoding complexity + + + + + + + 10000 + + + 3 + + + + + + + Frames per buffer + + + + + + + 10000 + + + 1 + + + + + + + quality_slider + quality_spinbox + bitrate_slider + bitrate_spinbox + abr_slider + abr_spinbox + mode + vbr + vad + dtx + complexity + nframes + + + + + quality_slider + valueChanged(int) + quality_spinbox + setValue(int) + + + 232 + 29 + + + 525 + 23 + + + + + quality_spinbox + valueChanged(int) + quality_slider + setValue(int) + + + 517 + 25 + + + 248 + 31 + + + + + bitrate_slider + valueChanged(int) + bitrate_spinbox + setValue(int) + + + 185 + 66 + + + 445 + 51 + + + + + bitrate_spinbox + valueChanged(int) + bitrate_slider + setValue(int) + + + 471 + 68 + + + 214 + 56 + + + + + abr_slider + valueChanged(int) + abr_spinbox + setValue(int) + + + 323 + 90 + + + 500 + 95 + + + + + abr_spinbox + valueChanged(int) + abr_slider + setValue(int) + + + 493 + 84 + + + 339 + 94 + + + + + diff --git a/src/transcoder/transcoderoptionsvorbis.cpp b/src/transcoder/transcoderoptionsvorbis.cpp new file mode 100644 index 000000000..3914ea711 --- /dev/null +++ b/src/transcoder/transcoderoptionsvorbis.cpp @@ -0,0 +1,74 @@ +/* This file is part of Clementine. + Copyright 2010, David Sansome + + 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 . +*/ + +#include "transcoderoptionsvorbis.h" +#include "ui_transcoderoptionsvorbis.h" + +#include + +const char* TranscoderOptionsVorbis::kSettingsGroup = "Transcoder/vorbisenc"; + +TranscoderOptionsVorbis::TranscoderOptionsVorbis(QWidget* parent) + : TranscoderOptionsInterface(parent), + ui_(new Ui_TranscoderOptionsVorbis) +{ + ui_->setupUi(this); +} + +TranscoderOptionsVorbis::~TranscoderOptionsVorbis() { + delete ui_; +} + +void TranscoderOptionsVorbis::Load() { + QSettings s; + s.beginGroup(kSettingsGroup); + +#define GET_BITRATE(variable, property) \ + int variable = s.value(property, -1).toInt(); \ + variable = variable == -1 ? 0 : variable / 1000 + + GET_BITRATE(bitrate, "bitrate"); + GET_BITRATE(min_bitrate, "min-bitrate"); + GET_BITRATE(max_bitrate, "max-bitrate"); +#undef GET_BITRATE + + ui_->quality_slider->setValue(s.value("quality", 0.3).toDouble() * 10); + ui_->managed->setChecked(s.value("managed", false).toBool()); + ui_->max_bitrate_slider->setValue(max_bitrate); + ui_->min_bitrate_slider->setValue(min_bitrate); + ui_->bitrate_slider->setValue(bitrate); +} + +void TranscoderOptionsVorbis::Save() { + QSettings s; + s.beginGroup(kSettingsGroup); + +#define GET_BITRATE(variable, ui_slider) \ + int variable = ui_slider->value(); \ + variable = variable == 0 ? -1 : variable * 1000 + + GET_BITRATE(bitrate, ui_->bitrate_slider); + GET_BITRATE(min_bitrate, ui_->min_bitrate_slider); + GET_BITRATE(max_bitrate, ui_->max_bitrate_slider); +#undef GET_BITRATE + + s.setValue("quality", double(ui_->quality_slider->value()) / 10); + s.setValue("managed", ui_->managed->isChecked()); + s.setValue("bitrate", bitrate); + s.setValue("min-bitrate", min_bitrate); + s.setValue("max-bitrate", max_bitrate); +} diff --git a/src/transcoder/transcoderoptionsvorbis.h b/src/transcoder/transcoderoptionsvorbis.h new file mode 100644 index 000000000..62c14d288 --- /dev/null +++ b/src/transcoder/transcoderoptionsvorbis.h @@ -0,0 +1,39 @@ +/* This file is part of Clementine. + Copyright 2010, David Sansome + + 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 . +*/ + +#ifndef TRANSCODEROPTIONSVORBIS_H +#define TRANSCODEROPTIONSVORBIS_H + +#include "transcoderoptionsinterface.h" + +class Ui_TranscoderOptionsVorbis; + +class TranscoderOptionsVorbis : public TranscoderOptionsInterface { +public: + TranscoderOptionsVorbis(QWidget* parent = 0); + ~TranscoderOptionsVorbis(); + + void Load(); + void Save(); + +private: + static const char* kSettingsGroup; + + Ui_TranscoderOptionsVorbis* ui_; +}; + +#endif // TRANSCODEROPTIONSVORBIS_H diff --git a/src/transcoder/transcoderoptionsvorbis.ui b/src/transcoder/transcoderoptionsvorbis.ui new file mode 100644 index 000000000..809a959e2 --- /dev/null +++ b/src/transcoder/transcoderoptionsvorbis.ui @@ -0,0 +1,365 @@ + + + TranscoderOptionsVorbis + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + Quality + + + + + + + + + -1 + + + 10 + + + 3 + + + Qt::Horizontal + + + QSlider::TicksBelow + + + + + + + -1 + + + 10 + + + 3 + + + + + + + + + Use bitrate management engine + + + + + + + false + + + + 32 + + + 0 + + + 0 + + + 0 + + + + + Target bitrate + + + + + + + + + 250 + + + 128 + + + Qt::Horizontal + + + + + + + kbps + + + 250 + + + 128 + + + + + + + + + Minimum bitrate + + + + + + + + + 250 + + + 0 + + + Qt::Horizontal + + + + + + + disabled + + + kbps + + + 250 + + + 0 + + + + + + + + + Maximum bitrate + + + + + + + + + 250 + + + 0 + + + Qt::Horizontal + + + + + + + disabled + + + kbps + + + 250 + + + 0 + + + + + + + + + + + + quality_slider + quality_spinbox + managed + bitrate_slider + bitrate_spinbox + min_bitrate_slider + min_bitrate_spinbox + max_bitrate_slider + max_bitrate_spinbox + + + + + quality_slider + valueChanged(int) + quality_spinbox + setValue(int) + + + 176 + 29 + + + 365 + 31 + + + + + quality_spinbox + valueChanged(int) + quality_slider + setValue(int) + + + 358 + 19 + + + 136 + 29 + + + + + bitrate_slider + valueChanged(int) + bitrate_spinbox + setValue(int) + + + 255 + 83 + + + 344 + 88 + + + + + bitrate_spinbox + valueChanged(int) + bitrate_slider + setValue(int) + + + 341 + 77 + + + 244 + 80 + + + + + min_bitrate_spinbox + valueChanged(int) + min_bitrate_slider + setValue(int) + + + 324 + 122 + + + 265 + 115 + + + + + min_bitrate_slider + valueChanged(int) + min_bitrate_spinbox + setValue(int) + + + 217 + 122 + + + 347 + 124 + + + + + max_bitrate_slider + valueChanged(int) + max_bitrate_spinbox + setValue(int) + + + 278 + 157 + + + 323 + 155 + + + + + max_bitrate_spinbox + valueChanged(int) + max_bitrate_slider + setValue(int) + + + 344 + 166 + + + 216 + 155 + + + + + managed + toggled(bool) + widget + setEnabled(bool) + + + 55 + 58 + + + 25 + 86 + + + + + diff --git a/src/transcoder/transcoderoptionswma.cpp b/src/transcoder/transcoderoptionswma.cpp new file mode 100644 index 000000000..3b24c51a6 --- /dev/null +++ b/src/transcoder/transcoderoptionswma.cpp @@ -0,0 +1,48 @@ +/* This file is part of Clementine. + Copyright 2010, David Sansome + + 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 . +*/ + +#include "transcoderoptionswma.h" +#include "ui_transcoderoptionswma.h" + +#include + +const char* TranscoderOptionsWma::kSettingsGroup = "Transcoder/ffenc_wmav2"; + +TranscoderOptionsWma::TranscoderOptionsWma(QWidget* parent) + : TranscoderOptionsInterface(parent), + ui_(new Ui_TranscoderOptionsWma) +{ + ui_->setupUi(this); +} + +TranscoderOptionsWma::~TranscoderOptionsWma() { + delete ui_; +} + +void TranscoderOptionsWma::Load() { + QSettings s; + s.beginGroup(kSettingsGroup); + + ui_->bitrate_slider->setValue(s.value("bitrate", 128000).toInt() / 1000); +} + +void TranscoderOptionsWma::Save() { + QSettings s; + s.beginGroup(kSettingsGroup); + + s.setValue("bitrate", ui_->bitrate_slider->value() * 1000); +} diff --git a/src/transcoder/transcoderoptionswma.h b/src/transcoder/transcoderoptionswma.h new file mode 100644 index 000000000..8ae4c19fb --- /dev/null +++ b/src/transcoder/transcoderoptionswma.h @@ -0,0 +1,39 @@ +/* This file is part of Clementine. + Copyright 2010, David Sansome + + 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 . +*/ + +#ifndef TRANSCODEROPTIONSWMA_H +#define TRANSCODEROPTIONSWMA_H + +#include "transcoderoptionsinterface.h" + +class Ui_TranscoderOptionsWma; + +class TranscoderOptionsWma : public TranscoderOptionsInterface { +public: + TranscoderOptionsWma(QWidget* parent = 0); + ~TranscoderOptionsWma(); + + void Load(); + void Save(); + +private: + static const char* kSettingsGroup; + + Ui_TranscoderOptionsWma* ui_; +}; + +#endif // TRANSCODEROPTIONSWMA_H diff --git a/src/transcoder/transcoderoptionswma.ui b/src/transcoder/transcoderoptionswma.ui new file mode 100644 index 000000000..a6b47eb1b --- /dev/null +++ b/src/transcoder/transcoderoptionswma.ui @@ -0,0 +1,91 @@ + + + TranscoderOptionsWma + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + Bitrate + + + + + + + + + 320 + + + 128 + + + Qt::Horizontal + + + + + + + kbps + + + 320 + + + 128 + + + + + + + + + + + bitrate_slider + valueChanged(int) + bitrate_spinbox + setValue(int) + + + 166 + 25 + + + 323 + 24 + + + + + bitrate_spinbox + valueChanged(int) + bitrate_slider + setValue(int) + + + 325 + 14 + + + 190 + 31 + + + + + diff --git a/src/ui/settingsdialog.cpp b/src/ui/settingsdialog.cpp index 1e2bd68a8..b40a01f6e 100644 --- a/src/ui/settingsdialog.cpp +++ b/src/ui/settingsdialog.cpp @@ -145,6 +145,7 @@ SettingsDialog::SettingsDialog(BackgroundStreams* streams, QWidget* parent) ui_->list->item(Page_Library)->setIcon(IconLoader::Load("folder-sound")); ui_->list->item(Page_BackgroundStreams)->setIcon(QIcon(":/icons/32x32/weather-showers-scattered.png")); ui_->list->item(Page_Proxy)->setIcon(IconLoader::Load("applications-internet")); + ui_->list->item(Page_Transcoding)->setIcon(IconLoader::Load("tools-wizard")); AddStreams(); @@ -438,6 +439,14 @@ void SettingsDialog::accept() { s.setValue("password", ui_->proxy_password->text()); s.endGroup(); + // Transcoding + ui_->transcoding_aac->Save(); + ui_->transcoding_flac->Save(); + ui_->transcoding_mp3->Save(); + ui_->transcoding_speex->Save(); + ui_->transcoding_vorbis->Save(); + ui_->transcoding_wma->Save(); + ui_->library_config->Save(); ui_->magnatune->Save(); ui_->global_shortcuts->Save(); @@ -629,6 +638,14 @@ void SettingsDialog::showEvent(QShowEvent*) { ui_->proxy_password->setText(s.value("password").toString()); s.endGroup(); + // Transcoding + ui_->transcoding_aac->Load(); + ui_->transcoding_flac->Load(); + ui_->transcoding_mp3->Load(); + ui_->transcoding_speex->Load(); + ui_->transcoding_vorbis->Load(); + ui_->transcoding_wma->Load(); + loading_settings_ = false; } diff --git a/src/ui/settingsdialog.h b/src/ui/settingsdialog.h index e373dc6b0..32840fcd3 100644 --- a/src/ui/settingsdialog.h +++ b/src/ui/settingsdialog.h @@ -67,6 +67,7 @@ class SettingsDialog : public QDialog { Page_Magnatune, Page_BackgroundStreams, Page_Proxy, + Page_Transcoding, #ifdef HAVE_REMOTE Page_Remote, #endif diff --git a/src/ui/settingsdialog.ui b/src/ui/settingsdialog.ui index aabf9ef69..63d6f0eab 100644 --- a/src/ui/settingsdialog.ui +++ b/src/ui/settingsdialog.ui @@ -103,6 +103,11 @@ Network Proxy + + + Transcoding + + @@ -120,7 +125,7 @@ - 1 + 9 @@ -1104,6 +1109,123 @@ + + + + + + These settings are used in the "Transcode Music" dialog, and when converting music before copying it to a device. + + + true + + + + + + + 0 + + + + MP3 + + + + 0 + + + 0 + + + + + + + + + Vorbis + + + + 0 + + + 0 + + + + + + + + + FLAC + + + + 0 + + + 0 + + + + + + + + + Speex + + + + 0 + + + 0 + + + + + + + + + AAC + + + + 0 + + + 0 + + + + + + + + + WMA + + + + 0 + + + 0 + + + + + + + + + + @@ -1159,6 +1281,42 @@
songinfo/lyricsettings.h
1 + + TranscoderOptionsMP3 + QWidget +
transcoder/transcoderoptionsmp3.h
+ 1 +
+ + TranscoderOptionsVorbis + QWidget +
transcoder/transcoderoptionsvorbis.h
+ 1 +
+ + TranscoderOptionsSpeex + QWidget +
transcoder/transcoderoptionsspeex.h
+ 1 +
+ + TranscoderOptionsAAC + QWidget +
transcoder/transcoderoptionsaac.h
+ 1 +
+ + TranscoderOptionsFlac + QWidget +
transcoder/transcoderoptionsflac.h
+ 1 +
+ + TranscoderOptionsWma + QWidget +
transcoder/transcoderoptionswma.h
+ 1 +
list