diff options
| author | Sean Davis <smd.seandavis@gmail.com> | 2014-06-15 23:14:17 -0400 |
|---|---|---|
| committer | Sean Davis <smd.seandavis@gmail.com> | 2014-06-15 23:14:17 -0400 |
| commit | b86a4a5825995ed62a392aa9432da0ae87226bd0 (patch) | |
| tree | 5d1f5cfe4c54a3932224494cc9a87321eac50e32 | |
| parent | 0c963caae26d3b1448a4f2cae2227a26f0317736 (diff) | |
| download | parole-b86a4a5825995ed62a392aa9432da0ae87226bd0.tar.gz | |
Add video sink selection to preferences, other is cluttersink experimental
| -rw-r--r-- | data/interfaces/parole-settings.ui | 397 | ||||
| -rw-r--r-- | src/gst/parole-gst.c | 39 | ||||
| -rw-r--r-- | src/main.c | 36 | ||||
| -rw-r--r-- | src/parole-conf-dialog.c | 221 | ||||
| -rw-r--r-- | src/parole-conf.c | 36 |
5 files changed, 435 insertions, 294 deletions
diff --git a/data/interfaces/parole-settings.ui b/data/interfaces/parole-settings.ui index b113224..d540184 100644 --- a/data/interfaces/parole-settings.ui +++ b/data/interfaces/parole-settings.ui @@ -14,6 +14,28 @@ <column type="gchararray"/> </columns> </object> + <object class="GtkListStore" id="liststore2"> + <columns> + <!-- column-name sink_name --> + <column type="gchararray"/> + <!-- column-name sink_displayed --> + <column type="gchararray"/> + </columns> + <data> + <row> + <col id="0">xvimagesink</col> + <col id="1" translatable="yes">X Window System (X11/XShm/Xv)</col> + </row> + <row> + <col id="0">ximagesink</col> + <col id="1" translatable="yes">X Window System (No Xv)</col> + </row> + <row> + <col id="0">cluttersink</col> + <col id="1" translatable="yes">Other (Configure with Xfconf)</col> + </row> + </data> + </object> <object class="XfceTitledDialog" id="settings-dialog"> <property name="can_focus">False</property> <property name="title" translatable="yes">Parole Settings</property> @@ -68,23 +90,25 @@ <object class="GtkBox" id="box1"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="margin">12</property> + <property name="margin_left">12</property> + <property name="margin_right">24</property> + <property name="margin_top">12</property> + <property name="margin_bottom">12</property> <property name="orientation">vertical</property> <property name="spacing">18</property> <child> <object class="GtkFrame" id="frame1"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="margin_bottom">6</property> <property name="label_xalign">0</property> <property name="shadow_type">none</property> - <property name="margin_right">12</property> - <property name="margin_bottom">6</property> <child> <object class="GtkAlignment" id="alignment1"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="left_padding">12</property> <property name="margin_top">6</property> + <property name="left_padding">12</property> <child> <object class="GtkBox" id="box7"> <property name="visible">True</property> @@ -137,10 +161,9 @@ <object class="GtkFrame" id="frame2"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="margin_bottom">6</property> <property name="label_xalign">0</property> <property name="shadow_type">none</property> - <property name="margin_right">12</property> - <property name="margin_bottom">6</property> <child> <object class="GtkAlignment" id="alignment2"> <property name="visible">True</property> @@ -150,10 +173,10 @@ <object class="GtkBox" id="box2"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="orientation">vertical</property> - <property name="spacing">6</property> <property name="margin_top">6</property> <property name="margin_bottom">6</property> + <property name="orientation">vertical</property> + <property name="spacing">6</property> <child> <object class="GtkBox" id="box8"> <property name="visible">True</property> @@ -256,16 +279,15 @@ <object class="GtkFrame" id="frame3"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="margin_bottom">6</property> <property name="label_xalign">0</property> <property name="shadow_type">none</property> - <property name="margin_right">12</property> - <property name="margin_bottom">6</property> <child> <object class="GtkAlignment" id="alignment3"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="left_padding">12</property> <property name="margin_top">6</property> + <property name="left_padding">12</property> <child> <object class="GtkBox" id="box9"> <property name="visible">True</property> @@ -327,190 +349,273 @@ </packing> </child> <child> - <object class="GtkFrame" id="frame-display"> + <object class="GtkBox" id="box4"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="margin_left">12</property> <property name="margin_right">24</property> <property name="margin_top">12</property> <property name="margin_bottom">12</property> - <property name="label_xalign">0</property> - <property name="shadow_type">none</property> + <property name="orientation">vertical</property> + <property name="spacing">18</property> <child> - <object class="GtkAlignment" id="alignment4"> + <object class="GtkFrame" id="frame4"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="left_padding">12</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> <child> - <object class="GtkBox" id="box10"> + <object class="GtkAlignment" id="alignment7"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="orientation">vertical</property> + <property name="left_padding">12</property> <child> - <object class="GtkGrid" id="grid1"> + <object class="GtkBox" id="box11"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="margin_top">6</property> - <property name="row_spacing">6</property> - <property name="column_spacing">6</property> + <property name="orientation">vertical</property> + <property name="spacing">6</property> <child> - <object class="GtkLabel" id="label9"> + <object class="GtkComboBox" id="combobox-sink"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Brightness:</property> + <property name="model">liststore2</property> + <property name="button_sensitivity">on</property> + <signal name="changed" handler="parole_conf_dialog_sink_plugin_changed_cb" swapped="no"/> + <child> + <object class="GtkCellRendererText" id="cellrenderertext2"/> + <attributes> + <attribute name="text">1</attribute> + </attributes> + </child> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> </packing> </child> <child> - <object class="GtkLabel" id="label10"> + <object class="GtkLabel" id="label19"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="xalign">0</property> - <property name="label" translatable="yes">Contrast:</property> + <property name="label" translatable="yes"><i>Changes to this field require Parole to be restarted.</i></property> + <property name="use_markup">True</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> </packing> </child> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="label18"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes"><b>Video Output</b></property> + <property name="use_markup">True</property> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkFrame" id="frame-display"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment" id="alignment4"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="left_padding">12</property> + <child> + <object class="GtkBox" id="box10"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> <child> - <object class="GtkLabel" id="label11"> + <object class="GtkGrid" id="grid1"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Hue:</property> + <property name="margin_top">6</property> + <property name="row_spacing">6</property> + <property name="column_spacing">6</property> + <child> + <object class="GtkLabel" id="label9"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Brightness:</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label10"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Contrast:</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label11"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Hue:</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">3</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label12"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Saturation:</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">2</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkScale" id="brightness"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="draw_value">False</property> + <signal name="value-changed" handler="brightness_value_changed_cb" swapped="no"/> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkScale" id="contrast"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="draw_value">False</property> + <signal name="value-changed" handler="contrast_value_changed_cb" swapped="no"/> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkScale" id="hue"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="draw_value">False</property> + <signal name="value-changed" handler="hue_value_changed_cb" swapped="no"/> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">3</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkScale" id="saturation"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="draw_value">False</property> + <signal name="value-changed" handler="saturation_value_changed_cb" swapped="no"/> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">2</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">3</property> - <property name="width">1</property> - <property name="height">1</property> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">0</property> </packing> </child> <child> - <object class="GtkLabel" id="label12"> + <object class="GtkButtonBox" id="buttonbox2"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Saturation:</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">2</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkScale" id="brightness"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hexpand">True</property> - <property name="draw_value">False</property> - <signal name="value-changed" handler="brightness_value_changed_cb" swapped="no"/> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkScale" id="contrast"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="draw_value">False</property> - <signal name="value-changed" handler="contrast_value_changed_cb" swapped="no"/> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkScale" id="hue"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="draw_value">False</property> - <signal name="value-changed" handler="hue_value_changed_cb" swapped="no"/> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">3</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkScale" id="saturation"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="draw_value">False</property> - <signal name="value-changed" handler="saturation_value_changed_cb" swapped="no"/> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">2</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkButtonBox" id="buttonbox2"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="layout_style">end</property> - <child> - <object class="GtkButton" id="reset-color"> - <property name="label" translatable="yes">Reset to defaults</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="image">image2</property> - <signal name="clicked" handler="reset_color_clicked_cb" swapped="no"/> + <property name="layout_style">end</property> + <child> + <object class="GtkButton" id="reset-color"> + <property name="label" translatable="yes">Reset to defaults</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="image">image2</property> + <signal name="clicked" handler="reset_color_clicked_cb" swapped="no"/> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> </object> <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">0</property> + <property name="position">1</property> </packing> </child> </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> </child> </object> </child> + <child type="label"> + <object class="GtkLabel" id="label15"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes"><b>Color Balance</b></property> + <property name="use_markup">True</property> + </object> + </child> </object> - </child> - <child type="label"> - <object class="GtkLabel" id="label15"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes"><b>Color Balance</b></property> - <property name="use_markup">True</property> - </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> </child> </object> <packing> @@ -542,8 +647,8 @@ <object class="GtkAlignment" id="alignment5"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="left_padding">12</property> <property name="margin_top">6</property> + <property name="left_padding">12</property> <child> <object class="GtkGrid" id="grid3"> <property name="visible">True</property> @@ -783,7 +888,7 @@ <property name="can_focus">True</property> <property name="receives_default">True</property> <property name="hexpand">True</property> - <property name="font">Sans Bold 20</property> + <property name="font">Sans 12</property> <property name="preview_text"/> <property name="show_preview_entry">False</property> <property name="use_font">True</property> diff --git a/src/gst/parole-gst.c b/src/gst/parole-gst.c index 9ab4387..1010e13 100644 --- a/src/gst/parole-gst.c +++ b/src/gst/parole-gst.c @@ -95,6 +95,13 @@ typedef enum } GstPlayFlags; +typedef enum +{ + XIMAGESINK, + XVIMAGESINK, + CLUTTERSINK +} ParoleGstVideoSink; + struct ParoleGstPrivate { GstElement *playbin; @@ -136,7 +143,7 @@ struct ParoleGstPrivate /* * xvimage sink has brightness+hue+saturation+contrast. */ - gboolean xvimage_sink; + ParoleGstVideoSink image_sink; gulong sig1; gulong sig2; @@ -426,7 +433,7 @@ parole_gst_set_video_color_balance (ParoleGst *gst) gint hue_value; gint saturation_value; - if ( !gst->priv->xvimage_sink) + if ( gst->priv->image_sink != XVIMAGESINK ) return; g_object_get (G_OBJECT (gst->priv->playbin), @@ -463,7 +470,7 @@ parole_gst_set_video_overlay (ParoleGst *gst) GstElement *video_sink; #if GTK_CHECK_VERSION(3,8,0) #else - gboolean enable_xv; + gchar *videosink; #endif g_object_get (G_OBJECT (gst->priv->playbin), @@ -484,9 +491,9 @@ parole_gst_set_video_overlay (ParoleGst *gst) #if GTK_CHECK_VERSION(3,8,0) #else g_object_get (G_OBJECT (gst->priv->conf), - "enable-xv", &enable_xv, + "videosink", &videosink, NULL); - if (enable_xv) + if (g_strcmp0(videosink, "ximagesink") == 0) { g_object_set(video_sink, "autopaint-colorkey", FALSE, "colorkey", 0x080810, NULL); @@ -2147,12 +2154,12 @@ parole_gst_constructed (GObject *object) { ParoleGst *gst; - gboolean enable_xv; + gchar *videosink = NULL; gst = PAROLE_GST (object); g_object_get (G_OBJECT (gst->priv->conf), - "enable-xv", &enable_xv, + "videosink", &videosink, NULL); #if GST_CHECK_VERSION(1, 0, 0) @@ -2191,16 +2198,22 @@ parole_gst_constructed (GObject *object) g_error ("autoaudiosink load failed"); } - if (enable_xv) + if (g_strcmp0(videosink, "xvimagesink") == 0) { gst->priv->video_sink = gst_element_factory_make ("xvimagesink", "video"); - gst->priv->xvimage_sink = TRUE; + gst->priv->image_sink = XVIMAGESINK; + } + + if (g_strcmp0(videosink, "cluttersink") == 0) + { + gst->priv->video_sink = gst_element_factory_make ("cluttersink", "video"); + gst->priv->image_sink = CLUTTERSINK; } if ( G_UNLIKELY (gst->priv->video_sink == NULL) ) { - gst->priv->xvimage_sink = FALSE; - g_debug ("%s trying to load ximagesink", enable_xv ? "xvimagesink not found " : "xv disabled "); + gst->priv->image_sink = XIMAGESINK; + g_debug ("%s trying to load ximagesink", g_strcmp0(videosink, "xvimagesink") ? "xvimagesink not found " : "xv disabled "); gst->priv->video_sink = gst_element_factory_make ("ximagesink", "video"); if ( G_UNLIKELY (gst->priv->video_sink == NULL) ) @@ -2208,7 +2221,7 @@ parole_gst_constructed (GObject *object) GError *error; error = g_error_new (1, 0, _("Unable to load \"%s\" plugin" ", check your GStreamer installation."), - enable_xv ? "xvimagesink" : "ximagesink"); + videosink); parole_gst_show_error (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (gst))), error); g_error_free (error); @@ -2779,7 +2792,7 @@ gint64 parole_gst_get_stream_position (ParoleGst *gst) gboolean parole_gst_get_is_xvimage_sink (ParoleGst *gst) { - return gst->priv->xvimage_sink; + return gst->priv->image_sink == XVIMAGESINK; } void @@ -209,41 +209,6 @@ parole_send_message (const gchar *message) } -/** - * xv_option_given: - * @name : name of the option. - * @value : "TRUE"/"true" to enable xv hardware extensions or "FALSE"/"false" to - * disable the xv hardware extensions. - * @data : user-data passed by the callback function. - * @error : a #GError to store encoutered errors. - * - * Toggle the XV hardware extension via cli argument. - **/ -static gboolean -xv_option_given (const gchar *name, const gchar *value, gpointer data, GError **error) -{ - gboolean enabled = TRUE; - ParoleConf *conf; - - if ( !g_strcmp0 (value, "TRUE") || !g_strcmp0 (value, "true")) - enabled = TRUE; - else if (!g_strcmp0 (value, "FALSE") || !g_strcmp0 (value, "false")) - enabled = FALSE; - else - { - g_set_error (error, 0, 0, "%s %s : %s", name, _("Unknown argument "), value); - return FALSE; - } - - conf = parole_conf_new (); - g_object_set (G_OBJECT (conf), - "enable-xv", enabled, - NULL); - - g_object_unref(conf); - exit (0); -} - int main (int argc, char **argv) { ParolePlayer *player; @@ -276,7 +241,6 @@ int main (int argc, char **argv) { "new-instance", 'i', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &new_instance, N_("Open a new instance"), NULL }, { "no-plugins", 'n', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &no_plugins, N_("Do not load plugins"), NULL }, { "device", 'd', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_STRING, &device, N_("Set Audio-CD/VCD/DVD device path"), NULL }, - { "xv", '\0', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_CALLBACK, (GOptionArgFunc) xv_option_given, N_("Enable/Disable XV support (true or false, default=true)"), NULL}, { "embedded", 'E', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &embedded, N_("Start in embedded mode"), NULL }, { "fullscreen", 'F', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &fullscreen, N_("Start in fullscreen mode"), NULL }, { "play", 'p', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &play, N_("Play or pause if already playing"), NULL }, diff --git a/src/parole-conf-dialog.c b/src/parole-conf-dialog.c index 00b7f2c..cc540ad 100644 --- a/src/parole-conf-dialog.c +++ b/src/parole-conf-dialog.c @@ -41,22 +41,26 @@ * GtkBuilder Callbacks */ -void parole_conf_dialog_response_cb (GtkDialog *dialog, - gint response_id, +void parole_conf_dialog_response_cb (GtkDialog *dialog, + gint response_id, ParoleConfDialog *self); -void +void parole_conf_dialog_vis_plugin_changed_cb (GtkComboBox *widget, ParoleConfDialog *self); +void +parole_conf_dialog_sink_plugin_changed_cb (GtkComboBox *widget, + ParoleConfDialog *self); + void parole_conf_dialog_font_set_cb (GtkFontButton *button, ParoleConfDialog *self); - + void parole_conf_dialog_enable_vis_changed_cb (GObject *object, GParamSpec *pspec, gpointer *data); - -void + +void parole_conf_dialog_subtitle_encoding_changed_cb (GtkComboBox *widget, ParoleConfDialog *self); @@ -72,9 +76,9 @@ void hue_value_changed_cb (GtkRange *range, void saturation_value_changed_cb (GtkRange *range, ParoleConfDialog *self); -void reset_color_clicked_cb (GtkButton *button, +void reset_color_clicked_cb (GtkButton *button, ParoleConfDialog *self); - + /* * End of GtkBuilder callbacks */ @@ -85,10 +89,11 @@ void reset_color_clicked_cb (GtkButton *button, struct ParoleConfDialogPrivate { ParoleConf *conf; - + GHashTable *vis_plugins; - + GtkWidget *vis_combox; + GtkWidget *sink_combox; GtkWidget *toggle_vis; GtkWidget *toggle_subtitle; GtkWidget *font_button; @@ -102,7 +107,7 @@ struct ParoleConfDialogPrivate G_DEFINE_TYPE (ParoleConfDialog, parole_conf_dialog, G_TYPE_OBJECT) /* Destroy the dialog */ -static void +static void parole_conf_dialog_destroy (GtkWidget *widget, ParoleConfDialog *self) { gtk_widget_hide(widget); @@ -132,7 +137,7 @@ void parole_conf_dialog_response_cb (GtkDialog *dialog, gint response_id, Parole /* Change subtitle encoding */ void parole_conf_dialog_subtitle_encoding_changed_cb (GtkComboBox *widget, ParoleConfDialog *self) { - g_object_set (G_OBJECT (self->priv->conf), + g_object_set (G_OBJECT (self->priv->conf), "subtitle-encoding", parole_subtitle_encoding_get_selected (widget), NULL); } @@ -145,7 +150,7 @@ void parole_conf_dialog_enable_vis_changed_cb (GObject *object, gboolean active; ParoleConfDialog *self; self = PAROLE_CONF_DIALOG(data); - + active = gtk_switch_get_active (GTK_SWITCH(GTK_WIDGET(object))); gtk_widget_set_sensitive (self->priv->vis_combox, active); @@ -156,10 +161,10 @@ static void set_effect_value (ParoleConfDialog *self, GtkRange *range, const gchar *name) { gint value; - + value = gtk_range_get_value (range); - - g_object_set (G_OBJECT (self->priv->conf), + + g_object_set (G_OBJECT (self->priv->conf), name, value, NULL); } @@ -192,31 +197,53 @@ void parole_conf_dialog_vis_plugin_changed_cb (GtkComboBox *widget, ParoleConfD { gchar *active = NULL; GstElementFactory *f; - + GtkTreeIter iter; GtkTreeModel *model = gtk_combo_box_get_model(widget); - + if (gtk_combo_box_get_active_iter (widget, &iter)) gtk_tree_model_get (model, &iter, 0, &active, -1); else return; - + f = g_hash_table_lookup (self->priv->vis_plugins, active); - + if ( f ) { g_object_set (G_OBJECT (self->priv->conf), "vis-name", gst_object_get_name (GST_OBJECT (f)), NULL); } - + + g_free (active); +} + +void parole_conf_dialog_sink_plugin_changed_cb (GtkComboBox *widget, ParoleConfDialog *self) +{ + gchar *active = NULL; + + GtkTreeIter iter; + GtkTreeModel *model = gtk_combo_box_get_model(widget); + + if (gtk_combo_box_get_active_iter (widget, &iter)) + gtk_tree_model_get (model, &iter, 0, &active, -1); + else + return; + + if (g_strcmp0(active, "other") != 0) + { + g_object_set (G_OBJECT (self->priv->conf), + "videosink", g_strdup(active), + NULL); + } + g_free (active); } /* Change subtitle font */ void parole_conf_dialog_font_set_cb (GtkFontButton *button, ParoleConfDialog *self) { - g_object_set (G_OBJECT (self->priv->conf), + g_object_set (G_OBJECT (self->priv->conf), "subtitle-font", gtk_font_button_get_font_name (button), NULL); } @@ -228,7 +255,7 @@ parole_conf_dialog_finalize (GObject *object) ParoleConfDialog *self; self = PAROLE_CONF_DIALOG (object); - + g_object_unref (self->priv->conf); g_hash_table_destroy (self->priv->vis_plugins); @@ -252,7 +279,7 @@ parole_conf_dialog_init (ParoleConfDialog *self) { self->priv = PAROLE_CONF_DIALOG_GET_PRIVATE (self); self->priv->conf = parole_conf_new (); - + self->priv->vis_plugins = parole_vis_get_plugins (); } @@ -262,15 +289,15 @@ parole_conf_dialog_add_vis_plugins (gpointer key, gpointer value, GtkWidget *com { GtkListStore *store = GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(combox))); GtkTreeIter iter; - + gtk_list_store_append( store, &iter ); gtk_list_store_set( store, &iter, 0, (const gchar *) key, -1 ); - + g_object_unref (store); } /* Set the combobox to the default visualisation plugin */ -static gboolean +static gboolean parole_conf_dialog_set_default_vis_plugin (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, ParoleConfDialog *self) { @@ -278,17 +305,17 @@ parole_conf_dialog_set_default_vis_plugin (GtkTreeModel *model, GtkTreePath *pat gchar *vis_name; gchar *combox_text; gboolean ret = FALSE; - + g_object_get (G_OBJECT (self->priv->conf), "vis-name", &vis_name, NULL); - gtk_tree_model_get (model, iter, + gtk_tree_model_get (model, iter, 0, &combox_text, -1); f = g_hash_table_lookup (self->priv->vis_plugins, combox_text); - + if ( !g_strcmp0 (vis_name, "none") ) { if ( !g_strcmp0 (gst_object_get_name (GST_OBJECT (f)), "Goom") ) @@ -298,10 +325,39 @@ parole_conf_dialog_set_default_vis_plugin (GtkTreeModel *model, GtkTreePath *pat { ret = TRUE; } - + if ( ret == TRUE ) gtk_combo_box_set_active_iter (GTK_COMBO_BOX (self->priv->vis_combox), iter); - + + return ret; +} + +/* Set the combobox to the default sink plugin */ +static gboolean +parole_conf_dialog_set_default_sink_plugin (ParoleConfDialog *self) +{ + gchar *sink_name; + gchar *combox_text; + gboolean ret = FALSE; + + g_object_get (G_OBJECT (self->priv->conf), + "videosink", &sink_name, + NULL); + + if (g_strcmp0(sink_name, "xvimagesink") == 0) + { + gtk_combo_box_set_active (GTK_COMBO_BOX (self->priv->sink_combox), 0); + return TRUE; + } + + if (g_strcmp0(sink_name, "ximagesink") == 0) + { + gtk_combo_box_set_active (GTK_COMBO_BOX (self->priv->sink_combox), 1); + return TRUE; + } + + gtk_combo_box_set_active (GTK_COMBO_BOX (self->priv->sink_combox), 2); + return ret; } @@ -313,7 +369,7 @@ parole_conf_dialog_set_defaults (ParoleConfDialog *self) gboolean vis_enabled; gchar *subtitle_font; gchar *subtitle_encoding; - + g_object_get (G_OBJECT (self->priv->conf), "vis-enabled", &vis_enabled, "subtitle-font", &subtitle_font, @@ -322,17 +378,19 @@ parole_conf_dialog_set_defaults (ParoleConfDialog *self) /* Update widget-states according to settings */ gtk_widget_set_sensitive (self->priv->vis_combox, vis_enabled); - + model = gtk_combo_box_get_model (GTK_COMBO_BOX (self->priv->vis_combox)); - gtk_tree_model_foreach (model, + gtk_tree_model_foreach (model, (GtkTreeModelForeachFunc) parole_conf_dialog_set_default_vis_plugin, self); - + + parole_conf_dialog_set_default_sink_plugin (self); + parole_subtitle_encoding_set (GTK_COMBO_BOX (self->priv->encoding), subtitle_encoding); - + gtk_font_button_set_font_name (GTK_FONT_BUTTON (self->priv->font_button), subtitle_font); - + g_free (subtitle_font); g_free (subtitle_encoding); } @@ -351,33 +409,34 @@ void parole_conf_dialog_open (ParoleConfDialog *self, GtkWidget *parent) GtkWidget *dialog; GtkWidget *combox; gboolean with_display; - + GtkWidget *switch_widget; GtkAdjustment *adjustment; GValue step_increment = {0}; - + builder = parole_builder_new_from_string (parole_settings_ui, parole_settings_ui_length); - + dialog = GTK_WIDGET (gtk_builder_get_object (builder, "settings-dialog")); combox = GTK_WIDGET (gtk_builder_get_object (builder, "vis-combobox")); - + self->priv->toggle_vis = GTK_WIDGET (gtk_builder_get_object (builder, "enable-vis")); self->priv->toggle_subtitle = GTK_WIDGET (gtk_builder_get_object (builder, "enable-subtitle")); self->priv->font_button = GTK_WIDGET (gtk_builder_get_object (builder, "fontbutton")); self->priv->encoding = GTK_WIDGET (gtk_builder_get_object (builder, "encoding")); - + parole_subtitle_encoding_init (GTK_COMBO_BOX (self->priv->encoding)); - + g_hash_table_foreach (self->priv->vis_plugins, (GHFunc) parole_conf_dialog_add_vis_plugins, combox); - + gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (parent)); - + self->priv->vis_combox = combox; + self->priv->sink_combox = GTK_WIDGET (gtk_builder_get_object (builder, "vis-combobox")); parole_conf_dialog_set_defaults (self); - + with_display = parole_gst_get_is_xvimage_sink (PAROLE_GST (parole_gst_get ())); - + if ( !with_display ) { gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (builder, "frame-display"))); @@ -388,12 +447,12 @@ void parole_conf_dialog_open (ParoleConfDialog *self, GtkWidget *parent) gint contrast_value; gint hue_value; gint saturation_value; - + self->priv->brightness = GTK_WIDGET (gtk_builder_get_object (builder, "brightness")); self->priv->contrast = GTK_WIDGET (gtk_builder_get_object (builder, "contrast")); self->priv->hue = GTK_WIDGET (gtk_builder_get_object (builder, "hue")); self->priv->saturation = GTK_WIDGET (gtk_builder_get_object (builder, "saturation")); - + gtk_range_set_range (GTK_RANGE (self->priv->brightness), -1000, 1000); gtk_range_set_range (GTK_RANGE (self->priv->contrast), -1000, 1000); gtk_range_set_range (GTK_RANGE (self->priv->saturation), -1000, 1000); @@ -402,7 +461,7 @@ void parole_conf_dialog_open (ParoleConfDialog *self, GtkWidget *parent) gtk_scale_add_mark (GTK_SCALE (self->priv->contrast), 0, GTK_POS_BOTTOM, NULL); gtk_scale_add_mark (GTK_SCALE (self->priv->saturation), 0, GTK_POS_BOTTOM, NULL); gtk_scale_add_mark (GTK_SCALE (self->priv->hue), 0, GTK_POS_BOTTOM, NULL); - + /* Set the step increment on the sliders to make them keyboard friendly */ g_value_init(&step_increment, G_TYPE_DOUBLE); g_value_set_double(&step_increment, 10.0); @@ -421,69 +480,69 @@ void parole_conf_dialog_open (ParoleConfDialog *self, GtkWidget *parent) "hue", &hue_value, "saturation", &saturation_value, NULL); - + gtk_range_set_value (GTK_RANGE (self->priv->brightness), brightness_value); gtk_range_set_value (GTK_RANGE (self->priv->contrast), contrast_value); gtk_range_set_value (GTK_RANGE (self->priv->hue), hue_value); gtk_range_set_value (GTK_RANGE (self->priv->saturation), saturation_value); - + } - + /* General/Video/Disable screensaver while playing movies */ switch_widget = GTK_WIDGET (gtk_builder_get_object (builder, "reset-saver")); - g_object_bind_property(G_OBJECT (self->priv->conf), "reset-saver", - switch_widget, "active", + g_object_bind_property(G_OBJECT (self->priv->conf), "reset-saver", + switch_widget, "active", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL); - + /* General/Audio/Enable visualization while playing audio file */ switch_widget = GTK_WIDGET (gtk_builder_get_object (builder, "enable-vis")); - g_object_bind_property(G_OBJECT (self->priv->conf), "vis-enabled", - switch_widget, "active", + g_object_bind_property(G_OBJECT (self->priv->conf), "vis-enabled", + switch_widget, "active", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL); g_signal_connect(G_OBJECT(switch_widget), "notify::active", G_CALLBACK(parole_conf_dialog_enable_vis_changed_cb), self); - + /* General/Keyboard/Enable keyboard multimedia keys */ switch_widget = GTK_WIDGET (gtk_builder_get_object (builder, "multimedia-keys")); - g_object_bind_property(G_OBJECT (self->priv->conf), "multimedia-keys", - switch_widget, "active", + g_object_bind_property(G_OBJECT (self->priv->conf), "multimedia-keys", + switch_widget, "active", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL); - + /* Playlist/Always replace playlist with opened files */ switch_widget = GTK_WIDGET (gtk_builder_get_object (builder, "replace-playlist")); - g_object_bind_property(G_OBJECT (self->priv->conf), "replace-playlist", - switch_widget, "active", + g_object_bind_property(G_OBJECT (self->priv->conf), "replace-playlist", + switch_widget, "active", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL); - + /* Playlist/Check and remove duplicate media entries */ switch_widget = GTK_WIDGET (gtk_builder_get_object (builder, "remove-duplicated")); - g_object_bind_property(G_OBJECT (self->priv->conf), "remove-duplicated", - switch_widget, "active", + g_object_bind_property(G_OBJECT (self->priv->conf), "remove-duplicated", + switch_widget, "active", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL); - + /* Playlist/Start playing opened files */ switch_widget = GTK_WIDGET (gtk_builder_get_object (builder, "start-playing-opened")); - g_object_bind_property(G_OBJECT (self->priv->conf), "play-opened-files", - switch_widget, "active", + g_object_bind_property(G_OBJECT (self->priv->conf), "play-opened-files", + switch_widget, "active", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL); - + /* Playlist/Remember playlist */ switch_widget = GTK_WIDGET (gtk_builder_get_object (builder, "remember-playlist")); - g_object_bind_property(G_OBJECT (self->priv->conf), "remember-playlist", - switch_widget, "active", + g_object_bind_property(G_OBJECT (self->priv->conf), "remember-playlist", + switch_widget, "active", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL); - + /* Subtitles/Automatically show subtitles when playing movie file */ switch_widget = GTK_WIDGET (gtk_builder_get_object (builder, "enable-subtitle")); - g_object_bind_property(G_OBJECT (self->priv->conf), "enable-subtitle", - switch_widget, "active", + g_object_bind_property(G_OBJECT (self->priv->conf), "enable-subtitle", + switch_widget, "active", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL); - + g_signal_connect(G_OBJECT(dialog), "delete-event", G_CALLBACK(gtk_widget_hide_on_delete), NULL); - + gtk_builder_connect_signals (builder, self); - + g_object_unref (builder); - + gtk_widget_show (dialog); } diff --git a/src/parole-conf.c b/src/parole-conf.c index 31cabc6..6335d33 100644 --- a/src/parole-conf.c +++ b/src/parole-conf.c @@ -69,11 +69,11 @@ enum PROP_SUBTITLE_ENCODING, PROP_SUBTITLE_FONT, /* Video */ + PROP_VIDEO_SINK, PROP_ASPECT_RATIO, PROP_BRIGHTNESS, PROP_CONTRAST, PROP_DISABLE_SCREEN_SAVER, - PROP_ENABLE_XV, PROP_HUE, PROP_SATURATION, /* Window properties */ @@ -297,6 +297,8 @@ gchar *parole_conf_map_xfconf_property_name (const gchar *prop_name) value = g_strdup("subtitle-encoding"); if (g_strcmp0(prop_name, "/subtitles/font") == 0) value = g_strdup("subtitle-font"); + if (g_strcmp0(prop_name, "/video/videosink") == 0) + value = g_strdup("videosink"); if (g_strcmp0(prop_name, "/video/aspect-ratio") == 0) value = g_strdup("aspect-ratio"); if (g_strcmp0(prop_name, "/video/brightness") == 0) @@ -305,8 +307,6 @@ gchar *parole_conf_map_xfconf_property_name (const gchar *prop_name) value = g_strdup("contrast"); if (g_strcmp0(prop_name, "/video/disable-screensaver") == 0) value = g_strdup("reset-saver"); - if (g_strcmp0(prop_name, "/video/enable-xv") == 0) - value = g_strdup("enable-xv"); if (g_strcmp0(prop_name, "/video/hue") == 0) value = g_strdup("hue"); if (g_strcmp0(prop_name, "/video/saturation") == 0) @@ -700,6 +700,21 @@ parole_conf_class_init (ParoleConfClass *klass) G_PARAM_READWRITE)); /** + * ParoleConf:videosink: + * + * Xfconf property: /video/videosink + * + * GStreamer videosink to use for output. + **/ + g_object_class_install_property (object_class, + PROP_VIDEO_SINK, + g_param_spec_string ("videosink", + "/video/videosink", + NULL, + "xvimagesink", + G_PARAM_READWRITE)); + + /** * ParoleConf:aspect-ratio: * * Xfconf property: /video/aspect-ratio @@ -765,21 +780,6 @@ parole_conf_class_init (ParoleConfClass *klass) G_PARAM_READWRITE)); /** - * ParoleConf:enable-xv: - * - * Xfconf property: /video/enable-xv - * - * Enable xv hardware extensions. - **/ - g_object_class_install_property (object_class, - PROP_ENABLE_XV, - g_param_spec_boolean ("enable-xv", - "/video/enable-xv", - NULL, - TRUE, - G_PARAM_READWRITE)); - - /** * ParoleConf:hue: * * Xfconf property: /video/hue |