diff --git a/girs/GstPbutils-1.0.gir b/girs/GstPbutils-1.0.gir index d3389779b9..a8022fa6b9 100644 --- a/girs/GstPbutils-1.0.gir +++ b/girs/GstPbutils-1.0.gir @@ -4763,6 +4763,37 @@ installation mechanisms using one of the two above-mentioned functions.</doc> </parameter> </parameters> </function> + <function name="missing_plugin_message_get_stream_id" c:identifier="gst_missing_plugin_message_get_stream_id" version="1.26"> + <doc xml:space="preserve" filename="../subprojects/gst-plugins-base/gst-libs/gst/pbutils/missing-plugins.c">Get the stream-id of the stream for which an element is missing.</doc> + <source-position filename="../subprojects/gst-plugins-base/gst-libs/gst/pbutils/missing-plugins.h"/> + <return-value transfer-ownership="none" nullable="1"> + <doc xml:space="preserve" filename="../subprojects/gst-plugins-base/gst-libs/gst/pbutils/missing-plugins.c">The stream-id or %NULL if none is specified.</doc> + <type name="utf8" c:type="const gchar*"/> + </return-value> + <parameters> + <parameter name="msg" transfer-ownership="none"> + <doc xml:space="preserve" filename="../subprojects/gst-plugins-base/gst-libs/gst/pbutils/missing-plugins.c">A missing-plugin #GstMessage of type #GST_MESSAGE_ELEMENT</doc> + <type name="Gst.Message" c:type="GstMessage*"/> + </parameter> + </parameters> + </function> + <function name="missing_plugin_message_set_stream_id" c:identifier="gst_missing_plugin_message_set_stream_id" version="1.26"> + <doc xml:space="preserve" filename="../subprojects/gst-plugins-base/gst-libs/gst/pbutils/missing-plugins.c">Set the stream-id of the stream for which an element is missing.</doc> + <source-position filename="../subprojects/gst-plugins-base/gst-libs/gst/pbutils/missing-plugins.h"/> + <return-value transfer-ownership="none"> + <type name="none" c:type="void"/> + </return-value> + <parameters> + <parameter name="msg" transfer-ownership="none"> + <doc xml:space="preserve" filename="../subprojects/gst-plugins-base/gst-libs/gst/pbutils/missing-plugins.c">A missing-plugin #GstMessage of type #GST_MESSAGE_ELEMENT</doc> + <type name="Gst.Message" c:type="GstMessage*"/> + </parameter> + <parameter name="stream_id" transfer-ownership="none"> + <doc xml:space="preserve" filename="../subprojects/gst-plugins-base/gst-libs/gst/pbutils/missing-plugins.c">The stream id for which an element is missing</doc> + <type name="utf8" c:type="const gchar*"/> + </parameter> + </parameters> + </function> <function name="missing_uri_sink_installer_detail_new" c:identifier="gst_missing_uri_sink_installer_detail_new"> <doc xml:space="preserve" filename="../subprojects/gst-plugins-base/gst-libs/gst/pbutils/missing-plugins.c">Returns an opaque string containing all the details about the missing element to be passed to an external installer called via diff --git a/subprojects/gst-plugins-base/gst-libs/gst/pbutils/missing-plugins.c b/subprojects/gst-plugins-base/gst-libs/gst/pbutils/missing-plugins.c index c0ddbf9573..e8f229be3b 100644 --- a/subprojects/gst-plugins-base/gst-libs/gst/pbutils/missing-plugins.c +++ b/subprojects/gst-plugins-base/gst-libs/gst/pbutils/missing-plugins.c @@ -518,6 +518,49 @@ error: } } +/** + * gst_missing_plugin_message_set_stream_id: + * @msg: A missing-plugin #GstMessage of type #GST_MESSAGE_ELEMENT + * @stream_id: The stream id for which an element is missing + * + * Set the stream-id of the stream for which an element is missing. + * + * Since: 1.26 + */ +void +gst_missing_plugin_message_set_stream_id (GstMessage * msg, + const gchar * stream_id) +{ + const GstStructure *structure; + + g_return_if_fail (gst_is_missing_plugin_message (msg)); + + structure = gst_message_get_structure (msg); + gst_structure_set ((GstStructure *) structure, "stream-id", G_TYPE_STRING, + stream_id, NULL); +} + +/** + * gst_missing_plugin_message_get_stream_id: + * @msg: A missing-plugin #GstMessage of type #GST_MESSAGE_ELEMENT + * + * Get the stream-id of the stream for which an element is missing. + * + * Since: 1.26 + * + * Returns: (nullable): The stream-id or %NULL if none is specified. + */ +const gchar * +gst_missing_plugin_message_get_stream_id (GstMessage * msg) +{ + const GstStructure *structure; + + g_return_val_if_fail (gst_is_missing_plugin_message (msg), NULL); + + structure = gst_message_get_structure (msg); + return gst_structure_get_string (structure, "stream-id"); +} + /** * gst_missing_plugin_message_get_description: * @msg: a missing-plugin #GstMessage of type #GST_MESSAGE_ELEMENT diff --git a/subprojects/gst-plugins-base/gst-libs/gst/pbutils/missing-plugins.h b/subprojects/gst-plugins-base/gst-libs/gst/pbutils/missing-plugins.h index c1e6c42e88..26245382b2 100644 --- a/subprojects/gst-plugins-base/gst-libs/gst/pbutils/missing-plugins.h +++ b/subprojects/gst-plugins-base/gst-libs/gst/pbutils/missing-plugins.h @@ -49,6 +49,13 @@ GST_PBUTILS_API GstMessage * gst_missing_encoder_message_new (GstElement * element, const GstCaps * encode_caps); +GST_PBUTILS_API +void gst_missing_plugin_message_set_stream_id(GstMessage *msg, + const gchar *stream_id); + +GST_PBUTILS_API +const gchar *gst_missing_plugin_message_get_stream_id (GstMessage *msg); + /* * functions for use by applications when dealing with missing-plugin messages */ diff --git a/subprojects/gst-plugins-base/tests/check/libs/pbutils.c b/subprojects/gst-plugins-base/tests/check/libs/pbutils.c index ae52205ca0..927d11a4e3 100644 --- a/subprojects/gst-plugins-base/tests/check/libs/pbutils.c +++ b/subprojects/gst-plugins-base/tests/check/libs/pbutils.c @@ -199,6 +199,7 @@ GST_START_TEST (test_pb_utils_post_missing_messages) msg = gst_missing_decoder_message_new (pipeline, caps); fail_unless (msg != NULL); fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_ELEMENT); + gst_missing_plugin_message_set_stream_id (msg, "teststreamid"); fail_unless (gst_message_get_structure (msg) != NULL); s = gst_message_get_structure (msg); fail_unless (gst_structure_has_name (s, "missing-plugin")); @@ -207,6 +208,8 @@ GST_START_TEST (test_pb_utils_post_missing_messages) fail_unless (gst_structure_has_field_typed (s, "detail", GST_TYPE_CAPS)); fail_unless (gst_structure_has_field_typed (s, "name", G_TYPE_STRING)); fail_unless (gst_structure_get_string (s, "name") != NULL); + fail_unless_equals_string (gst_missing_plugin_message_get_stream_id (msg), + "teststreamid"); missing_msg_check_getters (msg); gst_message_unref (msg);