rtphdrext: Set caps without attributes as the default

Most subclasses just use the simple function, so just let the base class
do it. It makes less code in subclasses.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/906>
This commit is contained in:
Olivier Crête 2021-09-23 16:01:40 -04:00 committed by GStreamer Marge Bot
parent 498740fe57
commit ba328fb98d
4 changed files with 12 additions and 13 deletions

View file

@ -34,6 +34,10 @@
#include <stdlib.h>
#include <string.h>
static gboolean
gst_rtp_header_extension_set_caps_from_attributes_default (GstRTPHeaderExtension
* ext, GstCaps * caps);
GST_DEBUG_CATEGORY_STATIC (rtphderext_debug);
#define GST_CAT_DEFAULT (rtphderext_debug)
@ -178,6 +182,8 @@ gst_rtp_header_extension_class_set_uri (GstRTPHeaderExtensionClass * klass,
static void
gst_rtp_header_extension_class_init (GstRTPHeaderExtensionClass * klass)
{
klass->set_caps_from_attributes =
gst_rtp_header_extension_set_caps_from_attributes_default;
}
static void
@ -620,8 +626,8 @@ gst_rtp_header_extension_get_sdp_caps_field_name (GstRTPHeaderExtension * ext)
return g_strdup_printf ("extmap-%u", priv->ext_id);
}
/**
* gst_rtp_header_extension_set_caps_from_attributes_simple_sdp:
/*
* gst_rtp_header_extension_set_caps_from_attributes_default
* @ext: the #GstRTPHeaderExtension
* @caps: #GstCaps to write fields into
*
@ -633,12 +639,11 @@ gst_rtp_header_extension_get_sdp_caps_field_name (GstRTPHeaderExtension * ext)
* advertised in @caps.
*
* Returns: whether the @ext attributes could be set on @caps.
*
* Since: 1.20
*/
gboolean
gst_rtp_header_extension_set_caps_from_attributes_simple_sdp
(GstRTPHeaderExtension * ext, GstCaps * caps) {
static gboolean
gst_rtp_header_extension_set_caps_from_attributes_default (GstRTPHeaderExtension
* ext, GstCaps * caps)
{
gchar *field_name = gst_rtp_header_extension_get_sdp_caps_field_name (ext);
GstStructure *s = gst_caps_get_structure (caps, 0);

View file

@ -247,8 +247,6 @@ GstRTPHeaderExtension * gst_rtp_header_extension_create_from_uri (const gchar *
GST_RTP_API
gchar * gst_rtp_header_extension_get_sdp_caps_field_name (GstRTPHeaderExtension * ext);
GST_RTP_API
gboolean gst_rtp_header_extension_set_caps_from_attributes_simple_sdp (GstRTPHeaderExtension * ext, GstCaps *caps);
G_END_DECLS

View file

@ -451,8 +451,6 @@ static void
gst_rtp_header_extension_colorspace_set_non_rtp_sink_caps;
rtp_hdr_class->update_non_rtp_src_caps =
gst_rtp_header_extension_colorspace_update_non_rtp_src_caps;
rtp_hdr_class->set_caps_from_attributes =
gst_rtp_header_extension_set_caps_from_attributes_simple_sdp;
gst_element_class_set_static_metadata (gstelement_class,
"Color Space", GST_RTP_HDREXT_ELEMENT_CLASS,

View file

@ -104,8 +104,6 @@ gst_rtp_header_extension_twcc_class_init (GstRTPHeaderExtensionTWCCClass *
rtp_hdr_class->get_max_size = gst_rtp_header_extension_twcc_get_max_size;
rtp_hdr_class->write = gst_rtp_header_extension_twcc_write;
rtp_hdr_class->read = gst_rtp_header_extension_twcc_read;
rtp_hdr_class->set_caps_from_attributes =
gst_rtp_header_extension_set_caps_from_attributes_simple_sdp;
gst_element_class_set_static_metadata (gstelement_class,
"Transport Wide Congestion Control", GST_RTP_HDREXT_ELEMENT_CLASS,