rtphdrext: Set caps without attributes as the default
authorOlivier CrĂȘte <olivier.crete@collabora.com>
Thu, 23 Sep 2021 20:01:40 +0000 (16:01 -0400)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Tue, 28 Sep 2021 20:04:55 +0000 (20:04 +0000)
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>

subprojects/gst-plugins-base/gst-libs/gst/rtp/gstrtphdrext.c
subprojects/gst-plugins-base/gst-libs/gst/rtp/gstrtphdrext.h
subprojects/gst-plugins-good/gst/rtp/gstrtphdrext-colorspace.c
subprojects/gst-plugins-good/gst/rtpmanager/gstrtphdrext-twcc.c

index f364268..6101c75 100644 (file)
 #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);
 
index aedc1a6..76e7775 100644 (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
 
index c099db2..f8a73df 100644 (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,
index bbf2b5e..2457337 100644 (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,