From 166c5333ca8518d2033cd51c4cd40283612b8b3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 24 Nov 2016 14:41:59 +0200 Subject: [PATCH] timecodestamper: Remove all existing timecode metas if requested to override existing --- gst/timecode/gsttimecodestamper.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/gst/timecode/gsttimecodestamper.c b/gst/timecode/gsttimecodestamper.c index d9302895b6..4cbdc683d3 100644 --- a/gst/timecode/gsttimecodestamper.c +++ b/gst/timecode/gsttimecodestamper.c @@ -341,6 +341,16 @@ gst_timecodestamper_sink_event (GstBaseTransform * trans, GstEvent * event) return ret; } +static gboolean +remove_timecode_meta (GstBuffer * buffer, GstMeta ** meta, gpointer user_data) +{ + if (meta && *meta && (*meta)->info->api == GST_VIDEO_TIME_CODE_META_API_TYPE) { + *meta = NULL; + } + + return TRUE; +} + static GstFlowReturn gst_timecodestamper_transform_ip (GstBaseTransform * vfilter, GstBuffer * buffer) @@ -350,10 +360,13 @@ gst_timecodestamper_transform_ip (GstBaseTransform * vfilter, GST_OBJECT_LOCK (timecodestamper); if (gst_buffer_get_video_time_code_meta (buffer) - && timecodestamper->override_existing == FALSE) { + && !timecodestamper->override_existing) { GST_OBJECT_UNLOCK (timecodestamper); return GST_FLOW_OK; + } else if (timecodestamper->override_existing) { + gst_buffer_foreach_meta (buffer, remove_timecode_meta, NULL); } + if (timecodestamper->source_clock != NULL) { if (timecodestamper->current_tc->hours == 0 && timecodestamper->current_tc->minutes == 0