From 14876d347b005006d12df1ba72c46e1461e10098 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Apr 02 2009 16:53:57 +0000 Subject: - Update patch to set the PA stream volume, avoids setting the volume when pulsesink isn't in a state where it has a stream (#488532) --- diff --git a/totem-use-pulsesink-volume.patch b/totem-use-pulsesink-volume.patch index 304fd0e..c23e1a7 100644 --- a/totem-use-pulsesink-volume.patch +++ b/totem-use-pulsesink-volume.patch @@ -1,18 +1,19 @@ Index: src/backend/bacon-video-widget-gst-0.10.c =================================================================== ---- src/backend/bacon-video-widget-gst-0.10.c (revision 5970) +--- src/backend/bacon-video-widget-gst-0.10.c (revision 6227) +++ src/backend/bacon-video-widget-gst-0.10.c (working copy) -@@ -166,7 +166,8 @@ +@@ -163,7 +163,9 @@ gboolean cursor_shown; gboolean fullscreen_mode; gboolean auto_resize; - gboolean uses_fakesink; + gboolean uses_audio_fakesink; + GstElement *pulse_audio_sink; ++ gdouble volume; gint video_width; /* Movie width */ gint video_height; /* Movie height */ -@@ -1892,6 +1893,11 @@ +@@ -1879,6 +1881,11 @@ g_free (bvw->priv->vis_element_name); bvw->priv->vis_element_name = NULL; @@ -24,7 +25,16 @@ Index: src/backend/bacon-video-widget-gst-0.10.c if (bvw->priv->vis_plugins_list) { g_list_free (bvw->priv->vis_plugins_list); bvw->priv->vis_plugins_list = NULL; -@@ -3145,7 +3151,7 @@ +@@ -1986,7 +1993,7 @@ + bacon_video_widget_get_show_cursor (bvw)); + break; + case PROP_VOLUME: +- g_value_set_double (value, bacon_video_widget_get_volume (bvw)); ++ g_value_set_double (value, bvw->priv->volume); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); +@@ -3133,7 +3140,7 @@ if (bvw->priv->speakersetup == BVW_AUDIO_SOUND_AC3PASSTHRU) return FALSE; @@ -33,43 +43,59 @@ Index: src/backend/bacon-video-widget-gst-0.10.c } void -@@ -3157,8 +3163,13 @@ +@@ -3145,8 +3152,25 @@ if (bacon_video_widget_can_set_volume (bvw) != FALSE) { volume = CLAMP (volume, 0.0, 1.0); - g_object_set (bvw->priv->play, "volume", - (gdouble) volume, NULL); + if (bvw->priv->pulse_audio_sink) { -+ g_object_set (bvw->priv->pulse_audio_sink, "volume", -+ (gdouble) volume, NULL); ++ GstState cur_state; ++ ++ gst_element_get_state (bvw->priv->pulse_audio_sink, &cur_state, NULL, 0); ++ if (cur_state == GST_STATE_READY || cur_state == GST_STATE_PLAYING) ++ { ++ gdouble new_vol; ++ g_object_set (bvw->priv->pulse_audio_sink, "volume", ++ (gdouble) volume, NULL); ++ got_set = TRUE; ++ ++ g_object_get (bvw->priv->pulse_audio_sink, "volume", &new_vol, NULL); ++ } + } else { + g_object_set (bvw->priv->play, "volume", + (gdouble) volume, NULL); + } ++ ++ bvw->priv->volume = volume; g_object_notify (G_OBJECT (bvw), "volume"); } } -@@ -3171,7 +3182,11 @@ +@@ -3159,9 +3183,7 @@ g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), 0.0); g_return_val_if_fail (GST_IS_ELEMENT (bvw->priv->play), 0.0); - g_object_get (G_OBJECT (bvw->priv->play), "volume", &vol, NULL); -+ if (bvw->priv->pulse_audio_sink) { -+ g_object_get (G_OBJECT (bvw->priv->pulse_audio_sink), "volume", &vol, NULL); -+ } else { -+ g_object_get (G_OBJECT (bvw->priv->play), "volume", &vol, NULL); -+ } - - return vol; +- +- return vol; ++ return bvw->priv->volume; } -@@ -4947,6 +4962,21 @@ + + void +@@ -4935,6 +4957,27 @@ g_mutex_unlock (bvw->priv->lock); } +static gboolean +notify_volume_idle_cb (BaconVideoWidget *bvw) +{ ++ gdouble vol; ++ ++ g_object_get (G_OBJECT (bvw->priv->pulse_audio_sink), "volume", &vol, NULL); ++ bvw->priv->volume = vol; ++ + g_object_notify (G_OBJECT (bvw), "volume"); ++ + return FALSE; +} + @@ -78,13 +104,13 @@ Index: src/backend/bacon-video-widget-gst-0.10.c + GParamSpec *pspec, + BaconVideoWidget *bvw) +{ -+ g_idle_add (notify_volume_idle_cb, bvw); ++ g_idle_add ((GSourceFunc) notify_volume_idle_cb, bvw); +} + GtkWidget * bacon_video_widget_new (int width, int height, BvwUseType type, GError ** err) -@@ -5014,15 +5044,18 @@ +@@ -5000,15 +5043,18 @@ cb_gconf, bvw, NULL, NULL); if (type == BVW_USE_TYPE_VIDEO || type == BVW_USE_TYPE_AUDIO) { @@ -111,7 +137,7 @@ Index: src/backend/bacon-video-widget-gst-0.10.c } } else { audio_sink = gst_element_factory_make ("fakesink", "audio-fake-sink"); -@@ -5171,9 +5204,19 @@ +@@ -5155,9 +5201,19 @@ /* make fakesink sync to the clock like a real sink */ g_object_set (audio_sink, "sync", TRUE, NULL); GST_DEBUG ("audio sink doesn't work, using fakesink instead"); diff --git a/totem.spec b/totem.spec index ace34b3..547114d 100644 --- a/totem.spec +++ b/totem.spec @@ -9,7 +9,7 @@ Summary: Movie player for GNOME Name: totem Version: 2.26.1 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2+ with exceptions Group: Applications/Multimedia URL: http://projects.gnome.org/totem/ @@ -478,6 +478,11 @@ fi %endif %changelog +* Thu Apr 02 2009 - Bastien Nocera - 2.26.1-2 +- Update patch to set the PA stream volume, avoids setting the + volume when pulsesink isn't in a state where it has a stream + (#488532) + * Wed Apr 01 2009 - Bastien Nocera - 2.26.1-1 - Update to 2.26.1