From 0125d7525af00aef5e32792acb16ad550596e196 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Wed, 27 Apr 2022 09:22:40 +0200 Subject: [PATCH] parsebin: Expose streams of unknown type This actually respects the existing `expose-all-streams` property by exposing them and having them present in the stream collection (as streams of type unknown). Fixes #1179 Part-of: --- .../gst/playback/gstparsebin.c | 28 +++++++++++++++++-- subprojects/gst-plugins-base/tools/gst-play.c | 2 +- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/subprojects/gst-plugins-base/gst/playback/gstparsebin.c b/subprojects/gst-plugins-base/gst/playback/gstparsebin.c index c1b7cae9dd..a8dca67fa3 100644 --- a/subprojects/gst-plugins-base/gst/playback/gstparsebin.c +++ b/subprojects/gst-plugins-base/gst/playback/gstparsebin.c @@ -1393,10 +1393,32 @@ analyze_new_pad (GstParseBin * parsebin, GstElement * src, GstPad * pad, if (factories == NULL) goto expose_pad; - /* if the array is empty, we have a type for which we have no parser */ + /* if the array is empty, we have a type for which we have no handler */ if (factories->n_values == 0) { - /* if not we have a unhandled type with no compatible factories */ g_value_array_free (factories); + + if (parsebin->expose_allstreams) { + GstStream *newstream; + GST_LOG_OBJECT (parsepad, "Existing GstStream %" GST_PTR_FORMAT, + parsepad->active_stream); + /* If we expose all streams, we only need to inform the application about + * a missing handler but still expose it. We also make sure the stream + * type is unknown. */ + g_assert (parsepad->active_stream); + newstream = + gst_stream_new (gst_stream_get_stream_id (parsepad->active_stream), + caps, GST_STREAM_TYPE_UNKNOWN, + gst_stream_get_stream_flags (parsepad->active_stream)); + gst_object_replace ((GstObject **) & parsepad->active_stream, + (GstObject *) newstream); + GST_LOG_OBJECT (parsepad, "New GstStream %" GST_PTR_FORMAT, + parsepad->active_stream); + + gst_element_post_message (GST_ELEMENT_CAST (parsebin), + gst_missing_decoder_message_new (GST_ELEMENT_CAST (parsebin), caps)); + goto expose_pad; + } + /* Else we will bail out */ gst_object_unref (parsepad); goto unknown_type; } @@ -4028,8 +4050,10 @@ gst_parse_pad_stream_start_event (GstParsePad * parsepad, GstEvent * event) GST_PTR_FORMAT, caps); if (repeat_event) { + GST_LOG_OBJECT (parsepad, "Using previously created GstStream"); stream = gst_object_ref (parsepad->active_stream); } else { + GST_LOG_OBJECT (parsepad, "Creating unknown GstStream"); stream = gst_stream_new (stream_id, NULL, GST_STREAM_TYPE_UNKNOWN, streamflags); diff --git a/subprojects/gst-plugins-base/tools/gst-play.c b/subprojects/gst-plugins-base/tools/gst-play.c index 8d0b697ede..1f9e89a43f 100644 --- a/subprojects/gst-plugins-base/tools/gst-play.c +++ b/subprojects/gst-plugins-base/tools/gst-play.c @@ -659,7 +659,7 @@ play_bus_msg (GstBus * bus, GstMessage * msg, gpointer user_data) } else if (type & GST_STREAM_TYPE_TEXT) { play->cur_text_sid = g_strdup (stream_id); } else { - gst_print ("Unknown stream type with stream-id %s", stream_id); + gst_print ("Unknown stream type with stream-id %s\n", stream_id); } gst_object_unref (stream); }