From 9fc6b4a0ec0291777196914c7d9c77ef01725853 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Tue, 5 Dec 2006 16:50:37 +0000 Subject: Have _can_set_volume behave properly, don't fail creating the video widget 2006-12-05 Bastien Nocera * src/backend/bacon-video-widget-gst-0.10.c: (bacon_video_widget_can_set_volume), (bacon_video_widget_new): Have _can_set_volume behave properly, don't fail creating the video widget if we can't create an audio sink and we're not in audio mode (Closes: #170719) --- ChangeLog | 8 ++++++++ src/backend/bacon-video-widget-gst-0.10.c | 34 +++++++++++++++++++++---------- 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index e0e6c20d3..d22616249 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-12-05 Bastien Nocera + + * src/backend/bacon-video-widget-gst-0.10.c: + (bacon_video_widget_can_set_volume), (bacon_video_widget_new): + Have _can_set_volume behave properly, don't fail creating the + video widget if we can't create an audio sink and we're not in audio + mode (Closes: #170719) + ============ Version 2.16.4 2006-11-28 Bastien Nocera diff --git a/src/backend/bacon-video-widget-gst-0.10.c b/src/backend/bacon-video-widget-gst-0.10.c index d49f54a18..b5ad5dfff 100644 --- a/src/backend/bacon-video-widget-gst-0.10.c +++ b/src/backend/bacon-video-widget-gst-0.10.c @@ -145,6 +145,7 @@ struct BaconVideoWidgetPrivate gboolean cursor_shown; gboolean fullscreen_mode; gboolean auto_resize; + gboolean uses_fakesink; gint video_width; /* Movie width */ gint video_height; /* Movie height */ @@ -2756,8 +2757,10 @@ bacon_video_widget_can_set_volume (BaconVideoWidget * bvw) g_return_val_if_fail (bvw != NULL, FALSE); g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), FALSE); g_return_val_if_fail (GST_IS_ELEMENT (bvw->priv->play), FALSE); - - return TRUE; + + if (bvw->priv->speakersetup == BVW_AUDIO_SOUND_AC3PASSTHRU) + return FALSE; + return !bvw->priv->uses_fakesink; } void @@ -4378,16 +4381,25 @@ bacon_video_widget_new (int width, int height, gst_element_set_state (audio_sink, GST_STATE_READY); success = poll_for_state_change (bvw, audio_sink, GST_STATE_READY, err); if (!success) { - if (err && !*err) { - g_warning ("Should have gotten an error message, please file a bug."); - g_set_error (err, BVW_ERROR, BVW_ERROR_VIDEO_PLUGIN, - _("Failed to open audio output. You may not have " - "permission to open the sound device, or the sound " - "server may not be running. " - "Please select another audio output in the Multimedia " - "Systems Selector.")); + /* Hopefully, fakesink should always work */ + gst_element_set_state (audio_sink, GST_STATE_NULL); + gst_object_unref (audio_sink); + audio_sink = NULL; + if (type != BVW_USE_TYPE_AUDIO) + audio_sink = gst_element_factory_make ("fakesink", "audio-sink"); + if (audio_sink == NULL) { + if (err && !*err) { + g_warning ("Should have gotten an error message, please file a bug."); + g_set_error (err, BVW_ERROR, BVW_ERROR_VIDEO_PLUGIN, + _("Failed to open audio output. You may not have " + "permission to open the sound device, or the sound " + "server may not be running. " + "Please select another audio output in the Multimedia " + "Systems Selector.")); + } + goto sink_error; } - goto sink_error; + bvw->priv->uses_fakesink = TRUE; } } else { g_set_error (err, BVW_ERROR, BVW_ERROR_VIDEO_PLUGIN, -- cgit v1.2.1