From c48c193b56480d286935a6d97071ad8caa19b99e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim-Philipp=20M=C3=BCller?= Date: Tue, 22 Feb 2011 12:56:48 +0000 Subject: [PATCH] playbin2, uridecodebin: add "source-setup" signal Add "source-setup" signal for convenience and discoverability. No need to figure out "notify::source", look up the notify callback signature, then do an g_object_get() to get the source element.. https://bugzilla.gnome.org/show_bug.cgi?id=626152 --- gst/playback/gstplaybin2.c | 22 ++++++++++++++++++++++ gst/playback/gsturidecodebin.c | 22 ++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/gst/playback/gstplaybin2.c b/gst/playback/gstplaybin2.c index 2f2a42e..30aa716 100644 --- a/gst/playback/gstplaybin2.c +++ b/gst/playback/gstplaybin2.c @@ -509,6 +509,7 @@ enum SIGNAL_GET_VIDEO_PAD, SIGNAL_GET_AUDIO_PAD, SIGNAL_GET_TEXT_PAD, + SIGNAL_SOURCE_SETUP, LAST_SIGNAL }; @@ -911,6 +912,24 @@ gst_play_bin_class_init (GstPlayBinClass * klass) gst_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT); /** + * GstPlayBin2::source-setup: + * @playbin: a #GstPlayBin2 + * @source: source element + * + * This signal is emitted after the source element has been created, so + * it can be configured by setting additional properties (e.g. set a + * proxy server for an http source, or set the device and read speed for + * an audio cd source). This is functionally equivalent to connecting to + * the notify::source signal, but more convenient. + * + * Since: 0.10.33 + */ + gst_play_bin_signals[SIGNAL_SOURCE_SETUP] = + g_signal_new ("source-setup", G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, 0, NULL, NULL, + gst_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GST_TYPE_ELEMENT); + + /** * GstPlayBin2::get-video-tags * @playbin: a #GstPlayBin2 * @stream: a video stream number @@ -3121,6 +3140,9 @@ notify_source_cb (GstElement * uridecodebin, GParamSpec * pspec, GST_OBJECT_UNLOCK (playbin); g_object_notify (G_OBJECT (playbin), "source"); + + g_signal_emit (playbin, gst_play_bin_signals[SIGNAL_SOURCE_SETUP], + 0, playbin->source); } /* must be called with the group lock */ diff --git a/gst/playback/gsturidecodebin.c b/gst/playback/gsturidecodebin.c index af2d3dd..f4551e3 100644 --- a/gst/playback/gsturidecodebin.c +++ b/gst/playback/gsturidecodebin.c @@ -149,6 +149,7 @@ enum SIGNAL_AUTOPLUG_SELECT, SIGNAL_DRAINED, SIGNAL_AUTOPLUG_SORT, + SIGNAL_SOURCE_SETUP, LAST_SIGNAL }; @@ -618,6 +619,24 @@ gst_uri_decode_bin_class_init (GstURIDecodeBinClass * klass) G_STRUCT_OFFSET (GstURIDecodeBinClass, drained), NULL, NULL, gst_marshal_VOID__VOID, G_TYPE_NONE, 0, G_TYPE_NONE); + /** + * GstURIDecodeBin::source-setup: + * @bin: the uridecodebin. + * @source: source element + * + * This signal is emitted after the source element has been created, so + * it can be configured by setting additional properties (e.g. set a + * proxy server for an http source, or set the device and read speed for + * an audio cd source). This is functionally equivalent to connecting to + * the notify::source signal, but more convenient. + * + * Since: 0.10.33 + */ + gst_uri_decode_bin_signals[SIGNAL_SOURCE_SETUP] = + g_signal_new ("source-setup", G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, 0, NULL, NULL, + gst_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GST_TYPE_ELEMENT); + gstelement_class->query = GST_DEBUG_FUNCPTR (gst_uri_decode_bin_query); gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_uri_decode_bin_change_state); @@ -1877,6 +1896,9 @@ setup_source (GstURIDecodeBin * decoder) /* notify of the new source used */ g_object_notify (G_OBJECT (decoder), "source"); + g_signal_emit (decoder, gst_uri_decode_bin_signals[SIGNAL_SOURCE_SETUP], + 0, decoder->source); + /* remove the old decoders now, if any */ remove_decoders (decoder, FALSE); -- 2.7.4