videoparse: Only add a single closed caption meta
authorEunhye Choi <eunhae1.choi@samsung.com>
Wed, 14 Jul 2021 10:00:24 +0000 (19:00 +0900)
committerEunhye Choi <eunhae1.choi@samsung.com>
Wed, 14 Jul 2021 10:00:26 +0000 (19:00 +0900)
Only add a single closed caption meta

Otherwise, having a stream go through a parser multiple times would
result in duplicate closed caption meta.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1396>

upstream commit id : 31d5d04bb1f5e3f6acdef8460193019237ecf5df

Change-Id: I587de0415e78e9e0de21ef079e594bec9bfedabd

gst/videoparsers/gsth264parse.c
gst/videoparsers/gstmpegvideoparse.c
packaging/gst-plugins-bad.spec

index a0348ba..3b74949 100644 (file)
@@ -2598,9 +2598,20 @@ gst_h264_parse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
   }
 
   if (h264parse->closedcaptions_size > 0) {
+#ifdef TIZEN_FEATURE_UPSTREAM
+    if (!gst_buffer_get_meta (buffer, GST_VIDEO_CAPTION_META_API_TYPE)) {
+      gst_buffer_add_video_caption_meta (buffer,
+          h264parse->closedcaptions_type, h264parse->closedcaptions,
+          h264parse->closedcaptions_size);
+    } else {
+      GST_DEBUG_OBJECT (h264parse, "Closed caption data already found on buffer, "
+          "discarding to avoid duplication");
+    }
+#else
     gst_buffer_add_video_caption_meta (buffer,
         h264parse->closedcaptions_type, h264parse->closedcaptions,
         h264parse->closedcaptions_size);
+#endif
 
     h264parse->closedcaptions_type = GST_VIDEO_CAPTION_TYPE_UNKNOWN;
     h264parse->closedcaptions_size = 0;
index eef79bc..c61ea70 100644 (file)
@@ -1113,9 +1113,20 @@ gst_mpegv_parse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
       buf = frame->buffer = gst_buffer_make_writable (frame->buffer);
     }
 
+#ifdef TIZEN_FEATURE_UPSTREAM
+    if (!gst_buffer_get_meta (buf, GST_VIDEO_CAPTION_META_API_TYPE)) {
+      gst_buffer_add_video_caption_meta (buf,
+          mpvparse->closedcaptions_type, mpvparse->closedcaptions,
+          mpvparse->closedcaptions_size);
+    } else {
+      GST_DEBUG_OBJECT (mpvparse, "Closed caption data already found on buffer, "
+          "discarding to avoid duplication");
+    }
+#else
     gst_buffer_add_video_caption_meta (buf,
         mpvparse->closedcaptions_type, mpvparse->closedcaptions,
         mpvparse->closedcaptions_size);
+#endif
 
     mpvparse->closedcaptions_type = GST_VIDEO_CAPTION_TYPE_UNKNOWN;
     mpvparse->closedcaptions_size = 0;
index 50b891f..2e1e716 100644 (file)
@@ -4,7 +4,7 @@
 
 Name:           gst-plugins-bad
 Version:        1.16.2
-Release:        20
+Release:        21
 Summary:        GStreamer Streaming-Media Framework Plug-Ins
 License:        LGPL-2.0+
 Group:          Multimedia/Framework