diff --git a/gst/playback/gstdecodebin3.c b/gst/playback/gstdecodebin3.c index b3e77ff20a..712975fbba 100644 --- a/gst/playback/gstdecodebin3.c +++ b/gst/playback/gstdecodebin3.c @@ -579,6 +579,10 @@ gst_decodebin3_class_init (GstDecodebin3Class * klass) * This signal is emitted whenever @decodebin needs to decide whether * to expose a @stream of a given @collection. * + * Note that the prefered way to select streams is to listen to + * GST_MESSAGE_STREAM_COLLECTION on the bus and send a + * GST_EVENT_SELECT_STREAMS with the streams the user wants. + * * Returns: 1 if the stream should be selected, 0 if it shouldn't be selected. * A value of -1 (default) lets @decodebin decide what to do with the stream. * */ @@ -922,6 +926,7 @@ gst_decodebin3_input_pad_unlink (GstPad * pad, GstObject * parent) if (dbin->collection) gst_object_unref (dbin->collection); dbin->collection = collection; + dbin->select_streams_seqnum = GST_SEQNUM_INVALID; msg = gst_message_new_stream_collection ((GstObject *) dbin, @@ -1161,14 +1166,15 @@ update_requested_selection (GstDecodebin3 * dbin) } /* 4. If the user didn't explicitly selected all streams, match one stream of each type */ - if (!all_user_selected && !dbin->requested_selection) { + if (!all_user_selected && dbin->select_streams_seqnum == GST_SEQNUM_INVALID) { for (i = 0; i < nb; i++) { GstStream *stream = gst_stream_collection_get_stream (collection, i); GstStreamType curtype = gst_stream_get_stream_type (stream); if (!(used_types & curtype)) { const gchar *sid = gst_stream_get_stream_id (stream); - GST_DEBUG_OBJECT (dbin, "Selecting stream '%s' of type %s", - sid, gst_stream_type_get_name (curtype)); + GST_DEBUG_OBJECT (dbin, + "Automatically selecting stream '%s' of type %s", sid, + gst_stream_type_get_name (curtype)); tmp = g_list_append (tmp, (gchar *) sid); used_types |= curtype; } @@ -1453,6 +1459,7 @@ handle_stream_collection (GstDecodebin3 * dbin, /* dbin->pending_collection = */ /* g_list_append (dbin->pending_collection, collection); */ } + dbin->select_streams_seqnum = GST_SEQNUM_INVALID; SELECTION_UNLOCK (dbin); } diff --git a/gst/playback/gstplaybin3.c b/gst/playback/gstplaybin3.c index 8c76e86352..5319c17856 100644 --- a/gst/playback/gstplaybin3.c +++ b/gst/playback/gstplaybin3.c @@ -85,6 +85,19 @@ * setting the format passed to GST_FORMAT_TIME. If the query was successful, * the duration or position will have been returned in units of nanoseconds. * + * ## Selecting streams + * + * The recommended way to select streams (instead of the default selection) is + * to listen to GST_MESSAGE_STREAM_COLLECTION messages on the GstBus and send a + * GST_EVENT_SELECT_STREAMS on the pipeline with the selected streams. This + * provides more information and flexibility compared to the legacy #GstPlayBin + * property and signal-based mechanism. + * + * Note: The application should not assume that collections will not change + * throughout a single file. If it wishes to modify the default selection, it + * should always respond to new collections posted on the bus with a + * GST_EVENT_SELECT_STREAMS. + * * ## Advanced Usage: specifying the audio and video sink * * By default, if no audio sink or video sink has been specified via the diff --git a/gst/playback/gsturidecodebin3.c b/gst/playback/gsturidecodebin3.c index fddce9ac16..d9971e0419 100644 --- a/gst/playback/gsturidecodebin3.c +++ b/gst/playback/gsturidecodebin3.c @@ -483,6 +483,10 @@ gst_uri_decode_bin3_class_init (GstURIDecodeBin3Class * klass) * This signal is emitted whenever @decodebin needs to decide whether * to expose a @stream of a given @collection. * + * Note that the prefered way to select streams is to listen to + * GST_MESSAGE_STREAM_COLLECTION on the bus and send a + * GST_EVENT_SELECT_STREAMS with the streams the user wants. + * * Returns: 1 if the stream should be selected, 0 if it shouldn't be selected. * A value of -1 (default) lets @decodebin decide what to do with the stream. * */