summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuis de Bethencourt <luisbg@osg.samsung.com>2016-02-05 15:34:51 +0000
committerTim-Philipp Müller <tim@centricular.com>2016-02-16 00:24:41 +0000
commit139108c83a5822fd855750872520c3cfdc5fec48 (patch)
tree550db9614272aefa65814128a04f7bf21e34f58b
parent403ac009fa9e5f28351570b186a3fe2ab4cef033 (diff)
downloadgstreamer-plugins-good-139108c83a5822fd855750872520c3cfdc5fec48.tar.gz
gstrtph265depay: keep consistency with rtph264depay
Use gst_rtp_drop_meta() and the same function prototype for gst_rtp_copy_meta() to keep consistency with the RTP elements in gst-plugins-good
-rw-r--r--gst/rtp/gstrtph265depay.c31
-rw-r--r--gst/rtp/gstrtph265depay.h6
2 files changed, 27 insertions, 10 deletions
diff --git a/gst/rtp/gstrtph265depay.c b/gst/rtp/gstrtph265depay.c
index b7e07e19d..64dcf12ce 100644
--- a/gst/rtp/gstrtph265depay.c
+++ b/gst/rtp/gstrtph265depay.c
@@ -945,12 +945,12 @@ 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 || (g_strv_length ((gchar **) tags) == 1
- && gst_meta_api_type_has_tag (info->api,
- g_quark_from_string (GST_META_TAG_VIDEO_STR)))) {
+ 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 */
@@ -977,22 +977,32 @@ gst_rtp_copy_meta (GstElement * element, GstBuffer * outbuf, GstBuffer * inbuf,
static gboolean
foreach_metadata_drop (GstBuffer * inbuf, GstMeta ** meta, gpointer user_data)
{
- GstRtpH265Depay *depay = 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 || (g_strv_length ((gchar **) tags) == 1
- && gst_meta_api_type_has_tag (info->api,
- g_quark_from_string (GST_META_TAG_VIDEO_STR)))) {
- GST_DEBUG_OBJECT (depay, "keeping metadata %s", g_type_name (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 (depay, "dropping metadata %s", g_type_name (info->api));
+ 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)
@@ -1099,7 +1109,8 @@ gst_rtp_h265_depay_handle_nal (GstRtpH265Depay * rtph265depay, GstBuffer * nal,
}
outbuf = gst_buffer_make_writable (outbuf);
- gst_buffer_foreach_meta (outbuf, foreach_metadata_drop, depayload);
+ gst_rtp_drop_meta (GST_ELEMENT_CAST (rtph265depay), outbuf,
+ g_quark_from_static_string (GST_META_TAG_VIDEO_STR));
GST_BUFFER_PTS (outbuf) = out_timestamp;
diff --git a/gst/rtp/gstrtph265depay.h b/gst/rtp/gstrtph265depay.h
index 9f50ac60e..dba837d54 100644
--- a/gst/rtp/gstrtph265depay.h
+++ b/gst/rtp/gstrtph265depay.h
@@ -94,6 +94,12 @@ typedef struct
GQuark copy_tag;
} CopyMetaData;
+typedef struct
+{
+ GstElement *element;
+ 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);