rtp: h265: use common meta utility functions
authorTim-Philipp Müller <tim@centricular.com>
Tue, 16 Feb 2016 00:14:27 +0000 (00:14 +0000)
committerTim-Philipp Müller <tim@centricular.com>
Tue, 16 Feb 2016 00:25:46 +0000 (00:25 +0000)
https://bugzilla.gnome.org/show_bug.cgi?id=761606

gst/rtp/gstrtph265depay.c
gst/rtp/gstrtph265depay.h
gst/rtp/gstrtph265pay.c

index 64dcf12..59685b8 100644 (file)
@@ -29,6 +29,7 @@
 #include <gst/rtp/gstrtpbuffer.h>
 #include <gst/video/video.h>
 #include "gstrtph265depay.h"
 #include <gst/rtp/gstrtpbuffer.h>
 #include <gst/video/video.h>
 #include "gstrtph265depay.h"
+#include "gstrtputils.h"
 
 GST_DEBUG_CATEGORY_STATIC (rtph265depay_debug);
 #define GST_CAT_DEFAULT (rtph265depay_debug)
 
 GST_DEBUG_CATEGORY_STATIC (rtph265depay_debug);
 #define GST_CAT_DEFAULT (rtph265depay_debug)
@@ -939,70 +940,6 @@ gst_rtp_h265_complete_au (GstRtpH265Depay * rtph265depay,
 
 #define NAL_TYPE_IS_KEY(nt) (NAL_TYPE_IS_PARAMETER_SET(nt) || NAL_TYPE_IS_CODED_SLICE_SEGMENT(nt))
 
 
 #define NAL_TYPE_IS_KEY(nt) (NAL_TYPE_IS_PARAMETER_SET(nt) || NAL_TYPE_IS_CODED_SLICE_SEGMENT(nt))
 
-static gboolean
-foreach_metadata_copy (GstBuffer * inbuf, GstMeta ** meta, gpointer user_data)
-{
-  CopyMetaData *data = user_data;
-  GstElement *element = data->element;
-  GstBuffer *outbuf = data->outbuf;
-  GQuark copy_tag = data->copy_tag;
-  const GstMetaInfo *info = (*meta)->info;
-  const gchar *const *tags = gst_meta_api_type_get_tags (info->api);
-
-  if (!tags || (copy_tag != 0 && g_strv_length ((gchar **) tags) == 1
-          && gst_meta_api_type_has_tag (info->api, copy_tag))) {
-    GstMetaTransformCopy copy_data = { FALSE, 0, -1 };
-    GST_DEBUG_OBJECT (element, "copy metadata %s", g_type_name (info->api));
-    /* simply copy then */
-    info->transform_func (outbuf, *meta, inbuf,
-        _gst_meta_transform_copy, &copy_data);
-  } else {
-    GST_DEBUG_OBJECT (element, "not copying metadata %s",
-        g_type_name (info->api));
-  }
-
-  return TRUE;
-}
-
-/* TODO: Should probably make copy_tag an array at some point */
-void
-gst_rtp_copy_meta (GstElement * element, GstBuffer * outbuf, GstBuffer * inbuf,
-    GQuark copy_tag)
-{
-  CopyMetaData data = { element, outbuf, copy_tag };
-
-  gst_buffer_foreach_meta (inbuf, foreach_metadata_copy, &data);
-}
-
-static gboolean
-foreach_metadata_drop (GstBuffer * inbuf, GstMeta ** meta, gpointer user_data)
-{
-  DropMetaData *data = user_data;
-  GstElement *element = data->element;
-  GQuark keep_tag = data->keep_tag;
-  const GstMetaInfo *info = (*meta)->info;
-  const gchar *const *tags = gst_meta_api_type_get_tags (info->api);
-
-  if (!tags || (keep_tag != 0 && g_strv_length ((gchar **) tags) == 1
-          && gst_meta_api_type_has_tag (info->api, keep_tag))) {
-    GST_DEBUG_OBJECT (element, "keeping metadata %s", g_type_name (info->api));
-  } else {
-    GST_DEBUG_OBJECT (element, "dropping metadata %s", g_type_name (info->api));
-    *meta = NULL;
-  }
-
-  return TRUE;
-}
-
-/* TODO: Should probably make keep_tag an array at some point */
-static void
-gst_rtp_drop_meta (GstElement * element, GstBuffer * buf, GQuark keep_tag)
-{
-  DropMetaData data = { element, keep_tag };
-
-  gst_buffer_foreach_meta (buf, foreach_metadata_drop, &data);
-}
-
 static GstBuffer *
 gst_rtp_h265_depay_handle_nal (GstRtpH265Depay * rtph265depay, GstBuffer * nal,
     GstClockTime in_timestamp, gboolean marker)
 static GstBuffer *
 gst_rtp_h265_depay_handle_nal (GstRtpH265Depay * rtph265depay, GstBuffer * nal,
     GstClockTime in_timestamp, gboolean marker)
index 0a919c9..ecb910d 100644 (file)
@@ -100,8 +100,6 @@ typedef struct
   GQuark keep_tag;
 } DropMetaData;
 
   GQuark keep_tag;
 } DropMetaData;
 
-void gst_rtp_copy_meta (GstElement * element, GstBuffer *outbuf, GstBuffer *inbuf, GQuark copy_tag);
-
 GType gst_rtp_h265_depay_get_type (void);
 
 gboolean gst_rtp_h265_depay_plugin_init (GstPlugin * plugin);
 GType gst_rtp_h265_depay_get_type (void);
 
 gboolean gst_rtp_h265_depay_plugin_init (GstPlugin * plugin);
index db8800b..dceb61e 100644 (file)
@@ -33,7 +33,7 @@
 #include "gstrtph265depay.h"
 
 #include "gstrtph265pay.h"
 #include "gstrtph265depay.h"
 
 #include "gstrtph265pay.h"
-
+#include "gstrtputils.h"
 
 GST_DEBUG_CATEGORY_STATIC (rtph265pay_debug);
 #define GST_CAT_DEFAULT (rtph265pay_debug)
 
 GST_DEBUG_CATEGORY_STATIC (rtph265pay_debug);
 #define GST_CAT_DEFAULT (rtph265pay_debug)