Re-enable transcoder and organiser, add transcoder for wavpack

This commit is contained in:
Jonas Kvinge 2019-01-06 14:34:50 +01:00
parent a11f43520e
commit 14cfd1a34e
25 changed files with 463 additions and 272 deletions

View File

@ -774,14 +774,15 @@ SOURCES
organise/organiseerrordialog.cpp
transcoder/transcoder.cpp
transcoder/transcodedialog.cpp
transcoder/transcoderoptionsaac.cpp
transcoder/transcoderoptionsdialog.cpp
transcoder/transcoderoptionsflac.cpp
transcoder/transcoderoptionsmp3.cpp
transcoder/transcoderoptionswavpack.cpp
transcoder/transcoderoptionsvorbis.cpp
transcoder/transcoderoptionsopus.cpp
transcoder/transcoderoptionsspeex.cpp
transcoder/transcoderoptionsvorbis.cpp
transcoder/transcoderoptionswma.cpp
transcoder/transcoderoptionsaac.cpp
transcoder/transcoderoptionsasf.cpp
transcoder/transcoderoptionsmp3.cpp
settings/transcodersettingspage.cpp
HEADERS
organise/organise.h
@ -800,11 +801,12 @@ UI
transcoder/transcoderoptionsaac.ui
transcoder/transcoderoptionsdialog.ui
transcoder/transcoderoptionsflac.ui
transcoder/transcoderoptionsmp3.ui
transcoder/transcoderoptionswavpack.ui
transcoder/transcoderoptionsvorbis.ui
transcoder/transcoderoptionsopus.ui
transcoder/transcoderoptionsspeex.ui
transcoder/transcoderoptionsvorbis.ui
transcoder/transcoderoptionswma.ui
transcoder/transcoderoptionsasf.ui
transcoder/transcoderoptionsmp3.ui
settings/transcodersettingspage.ui
)

View File

@ -360,6 +360,7 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co
ui_->action_cover_manager->setIcon(IconLoader::Load("document-download"));
ui_->action_edit_track->setIcon(IconLoader::Load("edit-rename"));
ui_->action_equalizer->setIcon(IconLoader::Load("equalizer"));
ui_->action_transcoder->setIcon(IconLoader::Load("tools-wizard"));
ui_->action_update_collection->setIcon(IconLoader::Load("view-refresh"));
ui_->action_full_collection_scan->setIcon(IconLoader::Load("view-refresh"));
ui_->action_settings->setIcon(IconLoader::Load("configure"));
@ -411,10 +412,11 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co
connect(ui_->action_add_folder, SIGNAL(triggered()), SLOT(AddFolder()));
connect(ui_->action_cover_manager, SIGNAL(triggered()), SLOT(ShowCoverManager()));
connect(ui_->action_equalizer, SIGNAL(triggered()), equalizer_.get(), SLOT(show()));
connect(ui_->action_transcoder, SIGNAL(triggered()), SLOT(ShowTranscodeDialog()));
connect(ui_->action_jump, SIGNAL(triggered()), ui_->playlist->view(), SLOT(JumpToCurrentlyPlayingTrack()));
connect(ui_->action_update_collection, SIGNAL(triggered()), app_->collection(), SLOT(IncrementalScan()));
connect(ui_->action_full_collection_scan, SIGNAL(triggered()), app_->collection(), SLOT(FullScan()));
//connect(ui_->action_add_files_to_transcoder, SIGNAL(triggered()), SLOT(AddFilesToTranscoder()));
connect(ui_->action_add_files_to_transcoder, SIGNAL(triggered()), SLOT(AddFilesToTranscoder()));
connect(ui_->action_toggle_scrobbling, SIGNAL(triggered()), app_->scrobbler(), SLOT(ToggleScrobbling()));
connect(app_->scrobbler(), SIGNAL(ErrorMessage(QString)), SLOT(ShowErrorDialog(QString)));
@ -569,12 +571,12 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co
playlist_menu_->addAction(ui_->action_renumber_tracks);
playlist_menu_->addAction(ui_->action_selection_set_value);
playlist_menu_->addAction(ui_->action_auto_complete_tags);
//playlist_menu_->addAction(ui_->action_add_files_to_transcoder);
playlist_menu_->addAction(ui_->action_add_files_to_transcoder);
playlist_menu_->addSeparator();
#ifdef HAVE_GSTREAMER
playlist_copy_to_collection_ = playlist_menu_->addAction(IconLoader::Load("edit-copy"), tr("Copy to collection..."), this, SLOT(PlaylistCopyToCollection()));
playlist_move_to_collection_ = playlist_menu_->addAction(IconLoader::Load("go-jump"), tr("Move to collection..."), this, SLOT(PlaylistMoveToCollection()));
//playlist_organise_ = playlist_menu_->addAction(IconLoader::Load("edit-copy"), tr("Organise files..."), this, SLOT(PlaylistMoveToCollection()));
playlist_organise_ = playlist_menu_->addAction(IconLoader::Load("edit-copy"), tr("Organise files..."), this, SLOT(PlaylistMoveToCollection()));
#ifndef Q_OS_WIN
playlist_copy_to_device_ = playlist_menu_->addAction(IconLoader::Load("device"), tr("Copy to device..."), this, SLOT(PlaylistCopyToDevice()));
#endif
@ -1429,7 +1431,7 @@ void MainWindow::PlaylistRightClick(const QPoint &global_pos, const QModelIndex
#ifdef HAVE_GSTREAMER
playlist_copy_to_collection_->setVisible(false);
playlist_move_to_collection_->setVisible(false);
//playlist_organise_->setVisible(false);
playlist_organise_->setVisible(false);
#ifndef Q_OS_WIN
playlist_copy_to_device_->setVisible(false);
#endif
@ -1493,7 +1495,9 @@ void MainWindow::PlaylistRightClick(const QPoint &global_pos, const QModelIndex
// Is it a collection item?
PlaylistItemPtr item = app_->playlist_manager()->current()->item_at(source_index.row());
if (item->IsLocalCollectionItem() && item->Metadata().id() != -1) {
//playlist_organise_->setVisible(editable);
#ifdef HAVE_GSTREAMER
playlist_organise_->setVisible(editable);
#endif
playlist_show_in_collection_->setVisible(editable);
playlist_open_in_browser_->setVisible(true);
}

View File

@ -350,7 +350,7 @@ signals:
QAction *playlist_play_pause_;
QAction *playlist_stop_after_;
QAction *playlist_undoredo_;
//QAction *playlist_organise_;
QAction *playlist_organise_;
QAction *playlist_show_in_collection_;
#ifdef HAVE_GSTREAMER
QAction *playlist_copy_to_collection_;

View File

@ -407,7 +407,7 @@
<x>0</x>
<y>0</y>
<width>1131</width>
<height>24</height>
<height>27</height>
</rect>
</property>
<widget class="QMenu" name="menu_music">
@ -429,7 +429,7 @@
</widget>
<widget class="QMenu" name="menu_playlist">
<property name="title">
<string>&amp;Playlist</string>
<string>P&amp;laylist</string>
</property>
<addaction name="action_add_file"/>
<addaction name="action_add_folder"/>
@ -449,7 +449,7 @@
</widget>
<widget class="QMenu" name="menu_help">
<property name="title">
<string>&amp;Help</string>
<string>Help</string>
</property>
<addaction name="action_about_strawberry"/>
<addaction name="action_about_qt"/>
@ -461,6 +461,7 @@
</property>
<addaction name="action_cover_manager"/>
<addaction name="action_equalizer"/>
<addaction name="action_transcoder"/>
<addaction name="separator"/>
<addaction name="action_update_collection"/>
<addaction name="action_full_collection_scan"/>
@ -613,7 +614,7 @@
</action>
<action name="action_open_cd">
<property name="text">
<string>Open &amp;audio CD...</string>
<string>Open audio &amp;CD...</string>
</property>
</action>
<action name="action_cover_manager">
@ -646,6 +647,11 @@
<string>&amp;Equalizer</string>
</property>
</action>
<action name="action_transcoder">
<property name="text">
<string>&amp;Transcode Music</string>
</property>
</action>
<action name="action_add_folder">
<property name="text">
<string>Add &amp;folder...</string>
@ -749,6 +755,20 @@
<string>Remove &amp;unavailable tracks from playlist</string>
</property>
</action>
<action name="action_add_files_to_transcoder">
<property name="checkable">
<bool>false</bool>
</property>
<property name="text">
<string>Add file(s) to transcoder</string>
</property>
<property name="toolTip">
<string>Add file to transcoder</string>
</property>
<property name="shortcut">
<string notr="true">Ctrl+Shift+T</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>

View File

@ -67,7 +67,7 @@
using std::shared_ptr;
using std::stable_sort;
const char *OrganiseDialog::kDefaultFormat = "%artist/%album{ (Disc %disc)}/{%track - }%title.%extension";
const char *OrganiseDialog::kDefaultFormat = "%artist/%album{ (Disc %disc)}/{%track - }%artist - %album - %title.%extension";
const char *OrganiseDialog::kSettingsGroup = "OrganiseDialog";
OrganiseDialog::OrganiseDialog(TaskManager *task_manager, QWidget *parent)

View File

@ -22,13 +22,14 @@
#include "core/iconloader.h"
#include "settingspage.h"
#include "transcoder/transcoderoptionsaac.h"
#include "transcoder/transcoderoptionsflac.h"
#include "transcoder/transcoderoptionsmp3.h"
#include "transcoder/transcoderoptionswavpack.h"
#include "transcoder/transcoderoptionsvorbis.h"
#include "transcoder/transcoderoptionsopus.h"
#include "transcoder/transcoderoptionsspeex.h"
#include "transcoder/transcoderoptionsvorbis.h"
#include "transcoder/transcoderoptionswma.h"
#include "transcoder/transcoderoptionsaac.h"
#include "transcoder/transcoderoptionsasf.h"
#include "transcoder/transcoderoptionsmp3.h"
#include "transcodersettingspage.h"
#include "ui_transcodersettingspage.h"
@ -45,21 +46,23 @@ TranscoderSettingsPage::~TranscoderSettingsPage() {
}
void TranscoderSettingsPage::Load() {
ui_->transcoding_aac->Load();
ui_->transcoding_flac->Load();
ui_->transcoding_mp3->Load();
ui_->transcoding_speex->Load();
ui_->transcoding_wavpack->Load();
ui_->transcoding_vorbis->Load();
ui_->transcoding_wma->Load();
ui_->transcoding_opus->Load();
ui_->transcoding_speex->Load();
ui_->transcoding_aac->Load();
ui_->transcoding_asf->Load();
ui_->transcoding_mp3->Load();
}
void TranscoderSettingsPage::Save() {
ui_->transcoding_aac->Save();
ui_->transcoding_flac->Save();
ui_->transcoding_mp3->Save();
ui_->transcoding_speex->Save();
ui_->transcoding_wavpack->Save();
ui_->transcoding_vorbis->Save();
ui_->transcoding_wma->Save();
ui_->transcoding_opus->Save();
ui_->transcoding_speex->Save();
ui_->transcoding_aac->Save();
ui_->transcoding_asf->Save();
ui_->transcoding_mp3->Save();
}

View File

@ -47,4 +47,4 @@ private:
Ui_TranscoderSettingsPage* ui_;
};
#endif // TRANSCODERSETTINGSPAGE_H
#endif // TRANSCODERSETTINGSPAGE_H

View File

@ -15,7 +15,7 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label_1">
<widget class="QLabel" name="label_top">
<property name="text">
<string>These settings are used in the &quot;Transcode Music&quot; dialog, and when converting music before copying it to a device.</string>
</property>
@ -27,9 +27,184 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
<number>5</number>
</property>
<widget class="QWidget" name="tab_1">
<widget class="QWidget" name="tab_flac">
<attribute name="title">
<string>FLAC</string>
</attribute>
<layout class="QVBoxLayout" name="layout_flac">
<property name="spacing">
<number>0</number>
</property>
<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>
<widget class="TranscoderOptionsFLAC" name="transcoding_flac" native="true"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_wavpack">
<attribute name="title">
<string>WavPack</string>
</attribute>
<layout class="QVBoxLayout" name="layout_wavpack">
<property name="spacing">
<number>0</number>
</property>
<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>
<widget class="TranscoderOptionsWavPack" name="transcoding_wavpack" native="true"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_vorbis">
<attribute name="title">
<string>Vorbis</string>
</attribute>
<layout class="QVBoxLayout" name="layout_vorbis">
<property name="spacing">
<number>0</number>
</property>
<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>
<widget class="TranscoderOptionsVorbis" name="transcoding_vorbis" native="true"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_opus">
<attribute name="title">
<string>Opus</string>
</attribute>
<layout class="QVBoxLayout" name="layout_opus">
<property name="spacing">
<number>0</number>
</property>
<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>
<widget class="TranscoderOptionsOpus" name="transcoding_opus" native="true"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_speex">
<attribute name="title">
<string>Speex</string>
</attribute>
<layout class="QVBoxLayout" name="layout_speex">
<property name="spacing">
<number>0</number>
</property>
<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>
<widget class="TranscoderOptionsSpeex" name="transcoding_speex" native="true"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_aac">
<attribute name="title">
<string>AAC</string>
</attribute>
<layout class="QVBoxLayout" name="layout_aac">
<property name="spacing">
<number>0</number>
</property>
<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>
<widget class="TranscoderOptionsAAC" name="transcoding_aac" native="true"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_asf">
<attribute name="title">
<string>ASF (WMA)</string>
</attribute>
<layout class="QVBoxLayout" name="layout_asf">
<property name="spacing">
<number>0</number>
</property>
<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>
<widget class="TranscoderOptionsASF" name="transcoding_asf" native="true"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_mp3">
<attribute name="title">
<string>MP3</string>
</attribute>
@ -54,156 +229,6 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Vorbis</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_25">
<property name="spacing">
<number>0</number>
</property>
<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>
<widget class="TranscoderOptionsVorbis" name="transcoding_vorbis" native="true"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_3">
<attribute name="title">
<string>FLAC</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_24">
<property name="spacing">
<number>0</number>
</property>
<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>
<widget class="TranscoderOptionsFlac" name="transcoding_flac" native="true"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_4">
<attribute name="title">
<string>Speex</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_23">
<property name="spacing">
<number>0</number>
</property>
<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>
<widget class="TranscoderOptionsSpeex" name="transcoding_speex" native="true"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_5">
<attribute name="title">
<string>AAC</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_22">
<property name="spacing">
<number>0</number>
</property>
<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>
<widget class="TranscoderOptionsAAC" name="transcoding_aac" native="true"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_6">
<attribute name="title">
<string>WMA</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_21">
<property name="spacing">
<number>0</number>
</property>
<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>
<widget class="TranscoderOptionsWma" name="transcoding_wma" native="true"/>
</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="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>
<widget class="TranscoderOptionsOpus" name="transcoding_opus" native="true"/>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
@ -234,15 +259,21 @@
<container>1</container>
</customwidget>
<customwidget>
<class>TranscoderOptionsFlac</class>
<class>TranscoderOptionsFLAC</class>
<extends>QWidget</extends>
<header>transcoder/transcoderoptionsflac.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>TranscoderOptionsWma</class>
<class>TranscoderOptionsWavPack</class>
<extends>QWidget</extends>
<header>transcoder/transcoderoptionswma.h</header>
<header>transcoder/transcoderoptionswavpack.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>TranscoderOptionsASF</class>
<extends>QWidget</extends>
<header>transcoder/transcoderoptionsasf.h</header>
<container>1</container>
</customwidget>
<customwidget>

View File

@ -106,8 +106,7 @@ TranscodeDialog::TranscodeDialog(QWidget *parent)
QString last_output_format = s.value("last_output_format", "audio/x-vorbis").toString();
for (int i = 0; i < ui_->format->count(); ++i) {
if (last_output_format ==
ui_->format->itemData(i).value<TranscoderPreset>().codec_mimetype_) {
if (last_output_format == ui_->format->itemData(i).value<TranscoderPreset>().codec_mimetype_) {
ui_->format->setCurrentIndex(i);
break;
}

View File

@ -202,7 +202,9 @@ void Transcoder::JobState::PostFinished(bool success) {
}
Transcoder::Transcoder(QObject *parent, const QString &settings_postfix)
: QObject(parent), max_threads_(QThread::idealThreadCount()), settings_postfix_(settings_postfix) {
: QObject(parent),
max_threads_(QThread::idealThreadCount()),
settings_postfix_(settings_postfix) {
if (JobFinishedEvent::sEventType == -1)
JobFinishedEvent::sEventType = QEvent::registerEventType();
@ -223,15 +225,16 @@ Transcoder::Transcoder(QObject *parent, const QString &settings_postfix)
QList<TranscoderPreset> Transcoder::GetAllPresets() {
QList<TranscoderPreset> ret;
ret << PresetForFileType(Song::FileType_FLAC);
ret << PresetForFileType(Song::FileType_MP4);
ret << PresetForFileType(Song::FileType_MPEG);
ret << PresetForFileType(Song::FileType_OggVorbis);
ret << PresetForFileType(Song::FileType_OggFlac);
ret << PresetForFileType(Song::FileType_OggSpeex);
ret << PresetForFileType(Song::FileType_ASF);
ret << PresetForFileType(Song::FileType_WAV);
ret << PresetForFileType(Song::FileType_FLAC);
ret << PresetForFileType(Song::FileType_WavPack);
ret << PresetForFileType(Song::FileType_OggFlac);
ret << PresetForFileType(Song::FileType_OggVorbis);
ret << PresetForFileType(Song::FileType_OggOpus);
ret << PresetForFileType(Song::FileType_OggSpeex);
ret << PresetForFileType(Song::FileType_MPEG);
ret << PresetForFileType(Song::FileType_MP4);
ret << PresetForFileType(Song::FileType_ASF);
return ret;
}
@ -239,24 +242,26 @@ QList<TranscoderPreset> Transcoder::GetAllPresets() {
TranscoderPreset Transcoder::PresetForFileType(Song::FileType type) {
switch (type) {
case Song::FileType_FLAC:
return TranscoderPreset(type, tr("FLAC"), "flac", "audio/x-flac");
case Song::FileType_MP4:
return TranscoderPreset(type, tr("M4A AAC"), "mp4", "audio/mpeg, mpegversion=(int)4", "audio/mp4");
case Song::FileType_MPEG:
return TranscoderPreset(type, tr("MP3"), "mp3", "audio/mpeg, mpegversion=(int)1, layer=(int)3");
case Song::FileType_OggVorbis:
return TranscoderPreset(type, tr("Ogg Vorbis"), "ogg", "audio/x-vorbis", "application/ogg");
case Song::FileType_OggFlac:
return TranscoderPreset(type, tr("Ogg FLAC"), "ogg", "audio/x-flac", "application/ogg");
case Song::FileType_OggSpeex:
return TranscoderPreset(type, tr("Ogg Speex"), "spx", "audio/x-speex", "application/ogg");
case Song::FileType_OggOpus:
return TranscoderPreset(type, tr("Ogg Opus"), "opus", "audio/x-opus", "application/ogg");
case Song::FileType_ASF:
return TranscoderPreset(type, tr("Windows Media audio"), "wma", "audio/x-wma", "video/x-ms-asf");
case Song::FileType_WAV:
return TranscoderPreset(type, tr("Wav"), "wav", QString(), "audio/x-wav");
return TranscoderPreset(type, "Wav", "wav", QString(), "audio/x-wav");
case Song::FileType_FLAC:
return TranscoderPreset(type, "FLAC", "flac", "audio/x-flac");
case Song::FileType_WavPack:
return TranscoderPreset(type, "WavPack", "wv", "audio/x-wavpack");
case Song::FileType_OggFlac:
return TranscoderPreset(type, "Ogg FLAC", "ogg", "audio/x-flac", "application/ogg");
case Song::FileType_OggVorbis:
return TranscoderPreset(type, "Ogg Vorbis", "ogg", "audio/x-vorbis", "application/ogg");
case Song::FileType_OggOpus:
return TranscoderPreset(type, "Ogg Opus", "opus", "audio/x-opus", "application/ogg");
case Song::FileType_OggSpeex:
return TranscoderPreset(type, "Ogg Speex", "spx", "audio/x-speex", "application/ogg");
case Song::FileType_MPEG:
return TranscoderPreset(type, "MP3", "mp3", "audio/mpeg, mpegversion=(int)1, layer=(int)3");
case Song::FileType_MP4:
return TranscoderPreset(type, "M4A AAC", "mp4", "audio/mpeg, mpegversion=(int)4", "audio/mp4");
case Song::FileType_ASF:
return TranscoderPreset(type, "Windows Media audio", "wma", "audio/x-wma", "video/x-ms-asf");
default:
qLog(Warning) << "Unsupported format in PresetForFileType:" << type;
return TranscoderPreset();
@ -269,9 +274,9 @@ Song::FileType Transcoder::PickBestFormat(QList<Song::FileType> supported) {
if (supported.isEmpty()) return Song::FileType_Unknown;
QList<Song::FileType> best_formats;
best_formats << Song::FileType_MPEG;
best_formats << Song::FileType_OggVorbis;
best_formats << Song::FileType_ASF;
best_formats << Song::FileType_FLAC;
best_formats << Song::FileType_OggFlac;
best_formats << Song::FileType_WavPack;
for (Song::FileType type : best_formats) {
if (supported.isEmpty() || supported.contains(type)) return type;
@ -413,13 +418,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("decodebin", state->pipeline_);
GstElement *convert = CreateElement("audioconvert", state->pipeline_);
GstElement *src = CreateElement("filesrc", state->pipeline_);
GstElement *decode = CreateElement("decodebin", 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_);
GstElement *sink = CreateElement("filesink", state->pipeline_);
if (!src || !decode || !convert || !sink) return false;
@ -558,7 +563,7 @@ void Transcoder::SetElementProperties(const QString &name, GObject *object) {
s.beginGroup("Transcoder/" + name + settings_postfix_);
guint properties_count = 0;
GParamSpec **properties = g_object_class_list_properties( G_OBJECT_GET_CLASS(object), &properties_count);
GParamSpec **properties = g_object_class_list_properties(G_OBJECT_GET_CLASS(object), &properties_count);
for (int i = 0; i < properties_count; ++i) {
GParamSpec *property = properties[i];

View File

@ -48,7 +48,7 @@ void TranscoderOptionsAAC::Load() {
QSettings s;
s.beginGroup(kSettingsGroup + settings_postfix_);
ui_->bitrate_slider->setValue(s.value("bitrate", 128000).toInt() / 1000);
ui_->bitrate_slider->setValue(s.value("bitrate", 320000).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());

View File

@ -28,30 +28,30 @@
#include <QSettings>
#include "transcoder/transcoderoptionsinterface.h"
#include "transcoderoptionswma.h"
#include "ui_transcoderoptionswma.h"
#include "transcoderoptionsasf.h"
#include "ui_transcoderoptionsasf.h"
const char *TranscoderOptionsWma::kSettingsGroup = "Transcoder/ffenc_wmav2";
const char *TranscoderOptionsASF::kSettingsGroup = "Transcoder/ffenc_wmav2";
TranscoderOptionsWma::TranscoderOptionsWma(QWidget *parent)
: TranscoderOptionsInterface(parent), ui_(new Ui_TranscoderOptionsWma) {
TranscoderOptionsASF::TranscoderOptionsASF(QWidget *parent)
: TranscoderOptionsInterface(parent), ui_(new Ui_TranscoderOptionsASF) {
ui_->setupUi(this);
}
TranscoderOptionsWma::~TranscoderOptionsWma() {
TranscoderOptionsASF::~TranscoderOptionsASF() {
delete ui_;
}
void TranscoderOptionsWma::Load() {
void TranscoderOptionsASF::Load() {
QSettings s;
s.beginGroup(kSettingsGroup + settings_postfix_);
ui_->bitrate_slider->setValue(s.value("bitrate", 128000).toInt() / 1000);
ui_->bitrate_slider->setValue(s.value("bitrate", 320000).toInt() / 1000);
}
void TranscoderOptionsWma::Save() {
void TranscoderOptionsASF::Save() {
QSettings s;
s.beginGroup(kSettingsGroup + settings_postfix_);

View File

@ -18,8 +18,8 @@
*
*/
#ifndef TRANSCODEROPTIONSWMA_H
#define TRANSCODEROPTIONSWMA_H
#ifndef TRANSCODEROPTIONSASF_H
#define TRANSCODEROPTIONSASF_H
#include "config.h"
@ -27,12 +27,12 @@
#include "transcoderoptionsinterface.h"
class Ui_TranscoderOptionsWma;
class Ui_TranscoderOptionsASF;
class TranscoderOptionsWma : public TranscoderOptionsInterface {
class TranscoderOptionsASF : public TranscoderOptionsInterface {
public:
TranscoderOptionsWma(QWidget *parent = nullptr);
~TranscoderOptionsWma();
TranscoderOptionsASF(QWidget *parent = nullptr);
~TranscoderOptionsASF();
void Load();
void Save();
@ -40,7 +40,7 @@ class TranscoderOptionsWma : public TranscoderOptionsInterface {
private:
static const char *kSettingsGroup;
Ui_TranscoderOptionsWma *ui_;
Ui_TranscoderOptionsASF *ui_;
};
#endif // TRANSCODEROPTIONSWMA_H
#endif // TRANSCODEROPTIONSASF_H

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TranscoderOptionsWma</class>
<widget class="QWidget" name="TranscoderOptionsWma">
<class>TranscoderOptionsASF</class>
<widget class="QWidget" name="TranscoderOptionsASF">
<property name="geometry">
<rect>
<x>0</x>

View File

@ -28,30 +28,34 @@
#include <QLayout>
#include "transcoderoptionsinterface.h"
#include "transcoderoptionsaac.h"
#include "transcoderoptionsdialog.h"
#include "transcoderoptionsflac.h"
#include "transcoderoptionsmp3.h"
#include "transcoderoptionswavpack.h"
#include "transcoderoptionsvorbis.h"
#include "transcoderoptionsopus.h"
#include "transcoderoptionsspeex.h"
#include "transcoderoptionsvorbis.h"
#include "transcoderoptionswma.h"
#include "transcoderoptionsasf.h"
#include "transcoderoptionsaac.h"
#include "transcoderoptionsmp3.h"
#include "ui_transcoderoptionsdialog.h"
TranscoderOptionsDialog::TranscoderOptionsDialog(Song::FileType type, QWidget *parent)
: QDialog(parent), ui_(new Ui_TranscoderOptionsDialog), options_(nullptr) {
: QDialog(parent),
ui_(new Ui_TranscoderOptionsDialog),
options_(nullptr) {
ui_->setupUi(this);
switch (type) {
case Song::FileType_FLAC:
case Song::FileType_OggFlac: options_ = new TranscoderOptionsFlac(this); break;
case Song::FileType_MP4: options_ = new TranscoderOptionsAAC(this); break;
case Song::FileType_MPEG: options_ = new TranscoderOptionsMP3(this); break;
case Song::FileType_OggVorbis: options_ = new TranscoderOptionsVorbis(this); break;
case Song::FileType_OggOpus: options_ = new TranscoderOptionsOpus(this); break;
case Song::FileType_OggSpeex: options_ = new TranscoderOptionsSpeex(this); break;
case Song::FileType_ASF: options_ = new TranscoderOptionsWma(this); break;
case Song::FileType_OggFlac: options_ = new TranscoderOptionsFLAC(this); break;
case Song::FileType_WavPack: options_ = new TranscoderOptionsWavPack(this); break;
case Song::FileType_OggVorbis: options_ = new TranscoderOptionsVorbis(this); break;
case Song::FileType_OggOpus: options_ = new TranscoderOptionsOpus(this); break;
case Song::FileType_OggSpeex: options_ = new TranscoderOptionsSpeex(this); break;
case Song::FileType_MP4: options_ = new TranscoderOptionsAAC(this); break;
case Song::FileType_MPEG: options_ = new TranscoderOptionsMP3(this); break;
case Song::FileType_ASF: options_ = new TranscoderOptionsASF(this); break;
default:
break;
}

View File

@ -31,25 +31,25 @@
#include "transcoderoptionsflac.h"
#include "ui_transcoderoptionsflac.h"
const char *TranscoderOptionsFlac::kSettingsGroup = "Transcoder/flacenc";
const char *TranscoderOptionsFLAC::kSettingsGroup = "Transcoder/flacenc";
TranscoderOptionsFlac::TranscoderOptionsFlac(QWidget *parent)
: TranscoderOptionsInterface(parent), ui_(new Ui_TranscoderOptionsFlac) {
TranscoderOptionsFLAC::TranscoderOptionsFLAC(QWidget *parent)
: TranscoderOptionsInterface(parent), ui_(new Ui_TranscoderOptionsFLAC) {
ui_->setupUi(this);
}
TranscoderOptionsFlac::~TranscoderOptionsFlac() {
TranscoderOptionsFLAC::~TranscoderOptionsFLAC() {
delete ui_;
}
void TranscoderOptionsFlac::Load() {
void TranscoderOptionsFLAC::Load() {
QSettings s;
s.beginGroup(kSettingsGroup + settings_postfix_);
ui_->quality->setValue(s.value("quality", 5).toInt());
}
void TranscoderOptionsFlac::Save() {
void TranscoderOptionsFLAC::Save() {
QSettings s;
s.beginGroup(kSettingsGroup + settings_postfix_);

View File

@ -27,12 +27,12 @@
#include "transcoderoptionsinterface.h"
class Ui_TranscoderOptionsFlac;
class Ui_TranscoderOptionsFLAC;
class TranscoderOptionsFlac : public TranscoderOptionsInterface {
class TranscoderOptionsFLAC : public TranscoderOptionsInterface {
public:
TranscoderOptionsFlac(QWidget *parent = nullptr);
~TranscoderOptionsFlac();
TranscoderOptionsFLAC(QWidget *parent = nullptr);
~TranscoderOptionsFLAC();
void Load();
void Save();
@ -40,7 +40,7 @@ class TranscoderOptionsFlac : public TranscoderOptionsInterface {
private:
static const char *kSettingsGroup;
Ui_TranscoderOptionsFlac *ui_;
Ui_TranscoderOptionsFLAC *ui_;
};
#endif // TRANSCODEROPTIONSFLAC_H

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TranscoderOptionsFlac</class>
<widget class="QWidget" name="TranscoderOptionsFlac">
<class>TranscoderOptionsFLAC</class>
<widget class="QWidget" name="TranscoderOptionsFLAC">
<property name="geometry">
<rect>
<x>0</x>

View File

@ -62,8 +62,8 @@ void TranscoderOptionsMP3::Load() {
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_->quality_spinbox->setValue(s.value("quality", 10).toFloat());
ui_->bitrate_slider->setValue(s.value("bitrate", 320).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());

View File

@ -47,7 +47,7 @@ void TranscoderOptionsOpus::Load() {
QSettings s;
s.beginGroup(kSettingsGroup + settings_postfix_);
ui_->bitrate_slider->setValue(s.value("bitrate", 128000).toInt() / 1000);
ui_->bitrate_slider->setValue(s.value("bitrate", 320000).toInt() / 1000);
}
void TranscoderOptionsOpus::Save() {

View File

@ -52,7 +52,7 @@ void TranscoderOptionsSpeex::Load() {
QSettings s;
s.beginGroup(kSettingsGroup + settings_postfix_);
ui_->quality_slider->setValue(s.value("quality", 8).toInt());
ui_->quality_slider->setValue(s.value("quality", 10).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());

View File

@ -59,7 +59,7 @@ void TranscoderOptionsVorbis::Load() {
GET_BITRATE(max_bitrate, "max-bitrate");
#undef GET_BITRATE
ui_->quality_slider->setValue(s.value("quality", 0.3).toDouble() * 10);
ui_->quality_slider->setValue(s.value("quality", 1.0).toDouble() * 10);
ui_->managed->setChecked(s.value("managed", false).toBool());
ui_->max_bitrate_slider->setValue(max_bitrate);
ui_->min_bitrate_slider->setValue(min_bitrate);

View File

@ -0,0 +1,54 @@
/*
* Strawberry Music Player
* Copyright 2018, Jonas Kvinge <jonas@jkvinge.net>
*
* Strawberry 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.
*
* Strawberry 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 Strawberry. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "config.h"
#include <QWidget>
#include <QVariant>
#include <QString>
#include <QStringBuilder>
#include <QSlider>
#include <QSettings>
#include "transcoderoptionsinterface.h"
#include "transcoderoptionswavpack.h"
#include "ui_transcoderoptionswavpack.h"
const char *TranscoderOptionsWavPack::kSettingsGroup = "Transcoder/wavpackenc";
TranscoderOptionsWavPack::TranscoderOptionsWavPack(QWidget *parent)
: TranscoderOptionsInterface(parent), ui_(new Ui_TranscoderOptionsWavPack) {
ui_->setupUi(this);
}
TranscoderOptionsWavPack::~TranscoderOptionsWavPack() {
delete ui_;
}
void TranscoderOptionsWavPack::Load() {
QSettings s;
s.beginGroup(kSettingsGroup + settings_postfix_);
s.endGroup();
}
void TranscoderOptionsWavPack::Save() {
QSettings s;
s.beginGroup(kSettingsGroup + settings_postfix_);
s.endGroup();
}

View File

@ -0,0 +1,45 @@
/*
* Strawberry Music Player
* Copyright 2018, Jonas Kvinge <jonas@jkvinge.net>
*
* Strawberry 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.
*
* Strawberry 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 Strawberry. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TRANSCODEROPTIONSWAVPACK_H
#define TRANSCODEROPTIONSWAVPACK_H
#include "config.h"
#include <QWidget>
#include "transcoderoptionsinterface.h"
class Ui_TranscoderOptionsWavPack;
class TranscoderOptionsWavPack : public TranscoderOptionsInterface {
public:
TranscoderOptionsWavPack(QWidget *parent = nullptr);
~TranscoderOptionsWavPack();
void Load();
void Save();
private:
static const char *kSettingsGroup;
Ui_TranscoderOptionsWavPack *ui_;
};
#endif // TRANSCODEROPTIONSWAVPACK_H

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TranscoderOptionsWavPack</class>
<widget class="QWidget" name="TranscoderOptionsWavPack">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>102</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout"/>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>