From ba328fb98d2dca7db8ec69cdc5eb5a56c464eb0b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Olivier=20Cr=C3=AAte?= Date: Thu, 23 Sep 2021 16:01:40 -0400 Subject: [PATCH] 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: --- .../gst-plugins-base/gst-libs/gst/rtp/gstrtphdrext.c | 19 ++++++++++++------- .../gst-plugins-base/gst-libs/gst/rtp/gstrtphdrext.h | 2 -- .../gst/rtp/gstrtphdrext-colorspace.c | 2 -- .../gst/rtpmanager/gstrtphdrext-twcc.c | 2 -- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/subprojects/gst-plugins-base/gst-libs/gst/rtp/gstrtphdrext.c b/subprojects/gst-plugins-base/gst-libs/gst/rtp/gstrtphdrext.c index f364268..6101c75 100644 --- a/subprojects/gst-plugins-base/gst-libs/gst/rtp/gstrtphdrext.c +++ b/subprojects/gst-plugins-base/gst-libs/gst/rtp/gstrtphdrext.c @@ -34,6 +34,10 @@ #include #include +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); diff --git a/subprojects/gst-plugins-base/gst-libs/gst/rtp/gstrtphdrext.h b/subprojects/gst-plugins-base/gst-libs/gst/rtp/gstrtphdrext.h index aedc1a6..76e7775 100644 --- a/subprojects/gst-plugins-base/gst-libs/gst/rtp/gstrtphdrext.h +++ b/subprojects/gst-plugins-base/gst-libs/gst/rtp/gstrtphdrext.h @@ -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 diff --git a/subprojects/gst-plugins-good/gst/rtp/gstrtphdrext-colorspace.c b/subprojects/gst-plugins-good/gst/rtp/gstrtphdrext-colorspace.c index c099db2..f8a73df 100644 --- a/subprojects/gst-plugins-good/gst/rtp/gstrtphdrext-colorspace.c +++ b/subprojects/gst-plugins-good/gst/rtp/gstrtphdrext-colorspace.c @@ -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, diff --git a/subprojects/gst-plugins-good/gst/rtpmanager/gstrtphdrext-twcc.c b/subprojects/gst-plugins-good/gst/rtpmanager/gstrtphdrext-twcc.c index bbf2b5e..2457337 100644 --- a/subprojects/gst-plugins-good/gst/rtpmanager/gstrtphdrext-twcc.c +++ b/subprojects/gst-plugins-good/gst/rtpmanager/gstrtphdrext-twcc.c @@ -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, -- 2.7.4