From cb95ba72cffa1ee575f3a40f2c78f31f99bd07b1 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Wed, 29 May 2024 14:56:28 +0200 Subject: [PATCH] decodebin3: Include the stream-id in ERROR/WARNING/INFO messages Allows application and other users to know to which stream the error/warning/info message originated from. Part-of: --- .../gst/playback/gstdecodebin3.c | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/subprojects/gst-plugins-base/gst/playback/gstdecodebin3.c b/subprojects/gst-plugins-base/gst/playback/gstdecodebin3.c index b0ac2f8efb..d69eddf268 100644 --- a/subprojects/gst-plugins-base/gst/playback/gstdecodebin3.c +++ b/subprojects/gst-plugins-base/gst/playback/gstdecodebin3.c @@ -2899,6 +2899,28 @@ gst_decodebin3_handle_message (GstBin * bin, GstMessage * message) } SELECTION_UNLOCK (dbin); } + case GST_MESSAGE_WARNING: + case GST_MESSAGE_ERROR: + case GST_MESSAGE_INFO: + { + GList *tmp; + /* Add the relevant stream-id if the message comes from a decoder */ + for (tmp = dbin->output_streams; tmp; tmp = tmp->next) { + DecodebinOutputStream *out = tmp->data; + GstStructure *structure; + if (out->decoder + && (GST_MESSAGE_SRC (message) == (GstObject *) out->decoder + || gst_object_has_as_ancestor (GST_MESSAGE_SRC (message), + (GstObject *) out->decoder))) { + message = gst_message_make_writable (message); + structure = gst_message_writable_details (message); + gst_structure_set (structure, "stream-id", G_TYPE_STRING, + out->slot->active_stream_id, NULL); + break; + } + } + break; + } default: break; }