rtpbasedepayload: Add "extensions" property for the currently enabled extensions

This works the same way as the one from `rtpbasepayload`.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6163>
This commit is contained in:
Sebastian Dröge 2024-02-21 12:53:53 +02:00 committed by GStreamer Marge Bot
parent 08d4527d22
commit 5ec73afe75
2 changed files with 77 additions and 0 deletions

View file

@ -2633,6 +2633,19 @@ the need to handle these extensions manually using the
GstRTPBaseDepayload::request-extension: signal.</doc> GstRTPBaseDepayload::request-extension: signal.</doc>
<type name="gboolean" c:type="gboolean"/> <type name="gboolean" c:type="gboolean"/>
</property> </property>
<property name="extensions" version="1.24" transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-base/gst-libs/gst/rtp/gstrtpbasedepayload.c">A list of already enabled RTP header extensions. This may be useful for finding
out which extensions are already enabled (with add-extension signal) and picking a non-conflicting
ID for a new extension that needs to be added on top of the existing ones.
Note that the value returned by reading this property is not dynamically updated when the set of
enabled extensions changes by any of existing action signals. Rather, it represents the current state
at the time the property is read.
Dynamic updates of this property can be received by subscribing to its corresponding "notify" signal, i.e.
"notify::extensions".</doc>
<type name="Gst.ValueArray"/>
</property>
<property name="max-reorder" version="1.18" writable="1" transfer-ownership="none"> <property name="max-reorder" version="1.18" writable="1" transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-base/gst-libs/gst/rtp/gstrtpbasedepayload.c">Max seqnum reorder before the sender is assumed to have restarted. <doc xml:space="preserve" filename="../subprojects/gst-plugins-base/gst-libs/gst/rtp/gstrtpbasedepayload.c">Max seqnum reorder before the sender is assumed to have restarted.

View file

@ -140,9 +140,12 @@ enum
PROP_SOURCE_INFO, PROP_SOURCE_INFO,
PROP_MAX_REORDER, PROP_MAX_REORDER,
PROP_AUTO_HEADER_EXTENSION, PROP_AUTO_HEADER_EXTENSION,
PROP_EXTENSIONS,
PROP_LAST PROP_LAST
}; };
static GParamSpec *gst_rtp_base_depayload_extensions_pspec;
static void gst_rtp_base_depayload_finalize (GObject * object); static void gst_rtp_base_depayload_finalize (GObject * object);
static void gst_rtp_base_depayload_set_property (GObject * object, static void gst_rtp_base_depayload_set_property (GObject * object,
guint prop_id, const GValue * value, GParamSpec * pspec); guint prop_id, const GValue * value, GParamSpec * pspec);
@ -396,6 +399,33 @@ gst_rtp_base_depayload_class_init (GstRTPBaseDepayloadClass * klass)
G_CALLBACK (gst_rtp_base_depayload_clear_extensions), NULL, NULL, NULL, G_CALLBACK (gst_rtp_base_depayload_clear_extensions), NULL, NULL, NULL,
G_TYPE_NONE, 0); G_TYPE_NONE, 0);
gst_rtp_base_depayload_extensions_pspec = gst_param_spec_array ("extensions",
"RTP header extensions",
"A list of already enabled RTP header extensions",
g_param_spec_object ("extension", "RTP header extension",
"An already enabled RTP extension", GST_TYPE_RTP_HEADER_EXTENSION,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS),
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
/**
* GstRTPBaseDepayload:extensions:
*
* A list of already enabled RTP header extensions. This may be useful for finding
* out which extensions are already enabled (with add-extension signal) and picking a non-conflicting
* ID for a new extension that needs to be added on top of the existing ones.
*
* Note that the value returned by reading this property is not dynamically updated when the set of
* enabled extensions changes by any of existing action signals. Rather, it represents the current state
* at the time the property is read.
*
* Dynamic updates of this property can be received by subscribing to its corresponding "notify" signal, i.e.
* "notify::extensions".
*
* Since: 1.24
*/
g_object_class_install_property (G_OBJECT_CLASS (klass),
PROP_EXTENSIONS, gst_rtp_base_depayload_extensions_pspec);
gstelement_class->change_state = gst_rtp_base_depayload_change_state; gstelement_class->change_state = gst_rtp_base_depayload_change_state;
klass->packet_lost = gst_rtp_base_depayload_packet_lost; klass->packet_lost = gst_rtp_base_depayload_packet_lost;
@ -687,6 +717,9 @@ gst_rtp_base_depayload_setcaps (GstRTPBaseDepayload * filter, GstCaps * caps)
filter->priv->header_exts); filter->priv->header_exts);
GST_OBJECT_UNLOCK (filter); GST_OBJECT_UNLOCK (filter);
g_object_notify_by_pspec (G_OBJECT (filter),
gst_rtp_base_depayload_extensions_pspec);
ext_out: ext_out:
g_ptr_array_unref (to_add); g_ptr_array_unref (to_add);
g_ptr_array_unref (to_remove); g_ptr_array_unref (to_remove);
@ -1238,6 +1271,9 @@ gst_rtp_base_depayload_add_extension (GstRTPBaseDepayload * rtpbasepayload,
GST_OBJECT_LOCK (rtpbasepayload); GST_OBJECT_LOCK (rtpbasepayload);
g_ptr_array_add (rtpbasepayload->priv->header_exts, gst_object_ref (ext)); g_ptr_array_add (rtpbasepayload->priv->header_exts, gst_object_ref (ext));
GST_OBJECT_UNLOCK (rtpbasepayload); GST_OBJECT_UNLOCK (rtpbasepayload);
g_object_notify_by_pspec (G_OBJECT (rtpbasepayload),
gst_rtp_base_depayload_extensions_pspec);
} }
static void static void
@ -1246,6 +1282,31 @@ gst_rtp_base_depayload_clear_extensions (GstRTPBaseDepayload * rtpbasepayload)
GST_OBJECT_LOCK (rtpbasepayload); GST_OBJECT_LOCK (rtpbasepayload);
g_ptr_array_set_size (rtpbasepayload->priv->header_exts, 0); g_ptr_array_set_size (rtpbasepayload->priv->header_exts, 0);
GST_OBJECT_UNLOCK (rtpbasepayload); GST_OBJECT_UNLOCK (rtpbasepayload);
g_object_notify_by_pspec (G_OBJECT (rtpbasepayload),
gst_rtp_base_depayload_extensions_pspec);
}
static void
gst_rtp_base_depayload_get_extensions (GstRTPBaseDepayload * depayload,
GValue * out_value)
{
GPtrArray *extensions;
guint i;
GST_OBJECT_LOCK (depayload);
extensions = depayload->priv->header_exts;
for (i = 0; i < extensions->len; ++i) {
GValue value = G_VALUE_INIT;
g_value_init (&value, GST_TYPE_RTP_HEADER_EXTENSION);
g_value_set_object (&value, g_ptr_array_index (extensions, i));
gst_value_array_append_and_take_value (out_value, &value);
}
GST_OBJECT_UNLOCK (depayload);
} }
static gboolean static gboolean
@ -1809,6 +1870,9 @@ gst_rtp_base_depayload_get_property (GObject * object, guint prop_id,
case PROP_AUTO_HEADER_EXTENSION: case PROP_AUTO_HEADER_EXTENSION:
g_value_set_boolean (value, priv->auto_hdr_ext); g_value_set_boolean (value, priv->auto_hdr_ext);
break; break;
case PROP_EXTENSIONS:
gst_rtp_base_depayload_get_extensions (depayload, value);
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; break;