decodebin3: Store GstStreamCollection from upstream

If upstream provides stream collection, use/store them as soon as possible

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2784>
This commit is contained in:
Edward Hervey 2022-11-05 09:19:29 +01:00 committed by GStreamer Marge Bot
parent 64d775a44f
commit d14c14dcc4

View file

@ -491,6 +491,8 @@ gst_decodebin3_select_stream (GstDecodebin3 * dbin,
static GstPad *gst_decodebin3_request_new_pad (GstElement * element,
GstPadTemplate * temp, const gchar * name, const GstCaps * caps);
static void handle_stream_collection (GstDecodebin3 * dbin,
GstStreamCollection * collection, DecodebinInput * input);
static void gst_decodebin3_handle_message (GstBin * bin, GstMessage * message);
static GstStateChangeReturn gst_decodebin3_change_state (GstElement * element,
GstStateChange transition);
@ -1062,6 +1064,30 @@ sink_event_function (GstPad * sinkpad, GstDecodebin3 * dbin, GstEvent * event)
dbin->upstream_selected = TRUE;
break;
}
case GST_EVENT_STREAM_COLLECTION:
{
GstStreamCollection *collection = NULL;
gst_event_parse_stream_collection (event, &collection);
if (collection) {
INPUT_LOCK (dbin);
handle_stream_collection (dbin, collection, input);
gst_object_unref (collection);
INPUT_UNLOCK (dbin);
SELECTION_LOCK (dbin);
/* Post the (potentially) updated collection */
if (dbin->collection) {
GstMessage *msg;
msg =
gst_message_new_stream_collection ((GstObject *) dbin,
dbin->collection);
SELECTION_UNLOCK (dbin);
gst_element_post_message (GST_ELEMENT_CAST (dbin), msg);
update_requested_selection (dbin);
} else
SELECTION_UNLOCK (dbin);
}
break;
}
case GST_EVENT_CAPS:
{
GST_DEBUG_OBJECT (sinkpad,