Add an option to change the output device on supported gst sinks. Fixes issue #184
This commit is contained in:
parent
baacfcf772
commit
1dbcfb9aa7
|
@ -245,6 +245,7 @@ void GstEngine::ReloadSettings() {
|
|||
s.beginGroup(kSettingsGroup);
|
||||
|
||||
sink_ = s.value("sink", kAutoSink).toString();
|
||||
device_ = s.value("device").toString();
|
||||
}
|
||||
|
||||
|
||||
|
@ -271,7 +272,7 @@ bool GstEngine::canDecode(const QUrl &url) {
|
|||
}
|
||||
|
||||
// Set the file we're testing
|
||||
g_object_set(G_OBJECT(can_decode_src_), "location", (const char*) url.toEncoded().constData(), NULL);
|
||||
g_object_set(G_OBJECT(can_decode_src_), "location", url.toEncoded().constData(), NULL);
|
||||
|
||||
// Start the pipeline playing
|
||||
gst_element_set_state(can_decode_pipeline_, GST_STATE_PLAYING);
|
||||
|
@ -776,6 +777,10 @@ bool GstEngine::CreatePipeline() {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (SinkSupportsDevice(sink_) && !device_.isEmpty()) {
|
||||
g_object_set(G_OBJECT(gst_audiosink_), "device", device_.toUtf8().constData(), NULL);
|
||||
}
|
||||
|
||||
gst_equalizer_ = GST_ELEMENT(gst_equalizer_new());
|
||||
gst_bin_add(GST_BIN(gst_audiobin_), gst_equalizer_);
|
||||
|
||||
|
@ -901,3 +906,7 @@ void GstEngine::ClearScopeQ() {
|
|||
gst_buffer_unref(buf);
|
||||
}
|
||||
}
|
||||
|
||||
bool GstEngine::SinkSupportsDevice(const QString &name) {
|
||||
return (name == "alsasink" || name == "osssink" || name == "pulsesink");
|
||||
}
|
||||
|
|
|
@ -76,6 +76,7 @@ class GstEngine : public Engine::Base {
|
|||
void gstMetaData(Engine::SimpleMetaBundle &bundle) { emit metaData( bundle ); }
|
||||
|
||||
PluginDetailsList GetOutputsList() const { return GetPluginList( "Sink/Audio" ); }
|
||||
static bool SinkSupportsDevice(const QString& name);
|
||||
|
||||
public slots:
|
||||
bool load(const QUrl&, bool stream);
|
||||
|
@ -158,6 +159,7 @@ class GstEngine : public Engine::Base {
|
|||
static const int kGstStateTimeout = 10000000;
|
||||
|
||||
QString sink_;
|
||||
QString device_;
|
||||
|
||||
static GstEngine* sInstance;
|
||||
|
||||
|
|
|
@ -36,8 +36,8 @@ SettingsDialog::SettingsDialog(QWidget* parent)
|
|||
pretty_popup_->SetMessage(tr("OSD Preview"), tr("Drag to reposition"),
|
||||
QImage(":nocover.png"));
|
||||
|
||||
ui_.notifications_bg_preset->setItemData(0, QColor(OSDPretty::kPresetBlue), Qt::DecorationRole);
|
||||
ui_.notifications_bg_preset->setItemData(1, QColor(OSDPretty::kPresetOrange), Qt::DecorationRole);
|
||||
// Playback
|
||||
connect(ui_.gst_plugin, SIGNAL(currentIndexChanged(int)), SLOT(GstPluginChanged(int)));
|
||||
|
||||
// Behaviour
|
||||
connect(ui_.b_show_tray_icon_, SIGNAL(toggled(bool)), SLOT(ShowTrayIconToggled(bool)));
|
||||
|
@ -50,6 +50,9 @@ SettingsDialog::SettingsDialog(QWidget* parent)
|
|||
ui_.list->setCurrentRow(0);
|
||||
|
||||
// Notifications
|
||||
ui_.notifications_bg_preset->setItemData(0, QColor(OSDPretty::kPresetBlue), Qt::DecorationRole);
|
||||
ui_.notifications_bg_preset->setItemData(1, QColor(OSDPretty::kPresetOrange), Qt::DecorationRole);
|
||||
|
||||
connect(ui_.notifications_none, SIGNAL(toggled(bool)), SLOT(NotificationTypeChanged()));
|
||||
connect(ui_.notifications_native, SIGNAL(toggled(bool)), SLOT(NotificationTypeChanged()));
|
||||
connect(ui_.notifications_tray, SIGNAL(toggled(bool)), SLOT(NotificationTypeChanged()));
|
||||
|
@ -116,6 +119,7 @@ void SettingsDialog::accept() {
|
|||
|
||||
s.beginGroup(GstEngine::kSettingsGroup);
|
||||
s.setValue("sink", ui_.gst_plugin->itemData(ui_.gst_plugin->currentIndex()).toString());
|
||||
s.setValue("device", ui_.gst_device->text());
|
||||
s.endGroup();
|
||||
|
||||
// Notifications
|
||||
|
@ -182,6 +186,7 @@ void SettingsDialog::showEvent(QShowEvent*) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
ui_.gst_device->setText(s.value("device").toString());
|
||||
s.endGroup();
|
||||
|
||||
// Notifications
|
||||
|
@ -311,3 +316,12 @@ void SettingsDialog::SetGstEngine(const GstEngine *engine) {
|
|||
}
|
||||
ui_.gst_group->setEnabled(true);
|
||||
}
|
||||
|
||||
void SettingsDialog::GstPluginChanged(int index) {
|
||||
QString name = ui_.gst_plugin->itemData(index).toString();
|
||||
|
||||
bool enabled = GstEngine::SinkSupportsDevice(name);
|
||||
|
||||
ui_.gst_device->setEnabled(enabled);
|
||||
ui_.gst_device_label->setEnabled(enabled);
|
||||
}
|
||||
|
|
|
@ -56,6 +56,8 @@ class SettingsDialog : public QDialog {
|
|||
|
||||
void ShowTrayIconToggled(bool on);
|
||||
|
||||
void GstPluginChanged(int index);
|
||||
|
||||
private:
|
||||
Ui::SettingsDialog ui_;
|
||||
bool loading_settings_;
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
<string>Playback</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../data/data.qrc">
|
||||
<iconset>
|
||||
<normaloff>:/media-playback-start-32.png</normaloff>:/media-playback-start-32.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
|
@ -60,7 +60,7 @@
|
|||
<string>Behaviour</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../data/data.qrc">
|
||||
<iconset>
|
||||
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
|
@ -69,7 +69,7 @@
|
|||
<string>Notifications</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../data/data.qrc">
|
||||
<iconset>
|
||||
<normaloff>:/lightbulb.png</normaloff>:/lightbulb.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
|
@ -78,7 +78,7 @@
|
|||
<string>Music Library</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../data/data.qrc">
|
||||
<iconset>
|
||||
<normaloff>:/library.png</normaloff>:/library.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
|
@ -87,7 +87,7 @@
|
|||
<string>Last.fm</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../data/data.qrc">
|
||||
<iconset>
|
||||
<normaloff>:/last.fm/as.png</normaloff>:/last.fm/as.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
|
@ -108,7 +108,7 @@
|
|||
<item>
|
||||
<widget class="QStackedWidget" name="stacked_widget">
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="playback_page">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
|
@ -212,6 +212,26 @@
|
|||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="LineEdit" name="gst_device">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="hint" stdset="0">
|
||||
<string>Leave blank for the default. Examples: "/dev/dsp", "front", etc.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="gst_device_label">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Output device</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -516,6 +536,11 @@
|
|||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>LineEdit</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>lineedit.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>LastFMConfig</class>
|
||||
<extends>QWidget</extends>
|
||||
|
@ -546,9 +571,7 @@
|
|||
<tabstop>notifications_fg_choose</tabstop>
|
||||
<tabstop>buttonBox</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="../data/data.qrc"/>
|
||||
</resources>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>list</sender>
|
||||
|
|
|
@ -732,6 +732,12 @@ msgstr ""
|
|||
msgid "Choose automatically"
|
||||
msgstr "Automaticky stáhnout"
|
||||
|
||||
msgid "Leave blank for the default. Examples: \"/dev/dsp\", \"front\", etc."
|
||||
msgstr ""
|
||||
|
||||
msgid "Output device"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
msgid "Show tray icon"
|
||||
msgstr "Zobrazit ikonu v &systémovém panelu"
|
||||
|
|
|
@ -735,6 +735,12 @@ msgstr ""
|
|||
msgid "Choose automatically"
|
||||
msgstr "Αυτόματο κατέβασμα"
|
||||
|
||||
msgid "Leave blank for the default. Examples: \"/dev/dsp\", \"front\", etc."
|
||||
msgstr ""
|
||||
|
||||
msgid "Output device"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
msgid "Show tray icon"
|
||||
msgstr "&Εμφάνιση εικονιδίου συστήματος"
|
||||
|
|
|
@ -738,6 +738,12 @@ msgstr ""
|
|||
msgid "Choose automatically"
|
||||
msgstr "Obtener carátula"
|
||||
|
||||
msgid "Leave blank for the default. Examples: \"/dev/dsp\", \"front\", etc."
|
||||
msgstr ""
|
||||
|
||||
msgid "Output device"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
msgid "Show tray icon"
|
||||
msgstr "&Mostrar icono de la bandeja"
|
||||
|
|
|
@ -736,6 +736,12 @@ msgstr ""
|
|||
msgid "Choose automatically"
|
||||
msgstr "Récupérer automatiquement"
|
||||
|
||||
msgid "Leave blank for the default. Examples: \"/dev/dsp\", \"front\", etc."
|
||||
msgstr ""
|
||||
|
||||
msgid "Output device"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
msgid "Show tray icon"
|
||||
msgstr "&Afficher l'icône"
|
||||
|
|
|
@ -728,6 +728,12 @@ msgstr ""
|
|||
msgid "Choose automatically"
|
||||
msgstr "Pobierz automatycznie"
|
||||
|
||||
msgid "Leave blank for the default. Examples: \"/dev/dsp\", \"front\", etc."
|
||||
msgstr ""
|
||||
|
||||
msgid "Output device"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
msgid "Show tray icon"
|
||||
msgstr "&Pokaż ikonę w trayu"
|
||||
|
|
|
@ -728,6 +728,12 @@ msgstr ""
|
|||
msgid "Choose automatically"
|
||||
msgstr ""
|
||||
|
||||
msgid "Leave blank for the default. Examples: \"/dev/dsp\", \"front\", etc."
|
||||
msgstr ""
|
||||
|
||||
msgid "Output device"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
msgid "Show tray icon"
|
||||
msgstr "Показать секцию"
|
||||
|
|
|
@ -733,6 +733,12 @@ msgstr ""
|
|||
msgid "Choose automatically"
|
||||
msgstr "Získavať automaticky"
|
||||
|
||||
msgid "Leave blank for the default. Examples: \"/dev/dsp\", \"front\", etc."
|
||||
msgstr ""
|
||||
|
||||
msgid "Output device"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
msgid "Show tray icon"
|
||||
msgstr "&Zobraziť tray ikonu"
|
||||
|
|
|
@ -720,6 +720,12 @@ msgstr ""
|
|||
msgid "Choose automatically"
|
||||
msgstr ""
|
||||
|
||||
msgid "Leave blank for the default. Examples: \"/dev/dsp\", \"front\", etc."
|
||||
msgstr ""
|
||||
|
||||
msgid "Output device"
|
||||
msgstr ""
|
||||
|
||||
msgid "Show tray icon"
|
||||
msgstr ""
|
||||
|
||||
|
|
Loading…
Reference in New Issue