diff options
author | Aaron Boxer <aaron.boxer@collabora.com> | 2019-03-28 14:24:42 -0400 |
---|---|---|
committer | Aaron Boxer <aaron.boxer@collabora.com> | 2019-04-01 17:11:36 -0400 |
commit | b2cc8a57d4b1f9d7d399606d194a55583b3639df (patch) | |
tree | 0d4eadba22f43225e5f88c1c942c6739ece8bdb8 /ext | |
parent | be579c426d2a6c769e59cc1f5d6adf4416813c4a (diff) | |
download | gst-libav-b2cc8a57d4b1f9d7d399606d194a55583b3639df.tar.gz |
avviddec: do not add 708 caption meta if already exists
(this is only used for CEA 708 raw data). another element
such as mpegvideoparse may have already added the meta.
Diffstat (limited to 'ext')
-rw-r--r-- | ext/libav/gstavviddec.c | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/ext/libav/gstavviddec.c b/ext/libav/gstavviddec.c index 8c9a794..374bd9e 100644 --- a/ext/libav/gstavviddec.c +++ b/ext/libav/gstavviddec.c @@ -1598,12 +1598,35 @@ gst_ffmpegviddec_video_frame (GstFFMpegVidDec * ffmpegdec, AVFrameSideData *side_data = av_frame_get_side_data (ffmpegdec->picture, AV_FRAME_DATA_A53_CC); if (side_data) { - GST_LOG_OBJECT (ffmpegdec, "Found CC of size %d", side_data->size); + GstVideoCaptionMeta *cc_meta = NULL; + gpointer iter = NULL; + gboolean found_708_raw_meta = FALSE; + + GST_LOG_OBJECT (ffmpegdec, + "Found CC side data of type AV_FRAME_DATA_A53_CC, size %d", + side_data->size); GST_MEMDUMP ("A53 CC", side_data->data, side_data->size); - out_frame->output_buffer = - gst_buffer_make_writable (out_frame->output_buffer); - gst_buffer_add_video_caption_meta (out_frame->output_buffer, - GST_VIDEO_CAPTION_TYPE_CEA708_RAW, side_data->data, side_data->size); + + while ((cc_meta = (GstVideoCaptionMeta *) + gst_buffer_iterate_meta_filtered (out_frame->input_buffer, &iter, + GST_VIDEO_CAPTION_META_API_TYPE))) { + if (cc_meta->caption_type != GST_VIDEO_CAPTION_TYPE_CEA708_RAW) + continue; + found_708_raw_meta = TRUE; + break; + } + + /* do not add CEA 708 caption meta if it already exists */ + if (!found_708_raw_meta) { + out_frame->output_buffer = + gst_buffer_make_writable (out_frame->output_buffer); + gst_buffer_add_video_caption_meta (out_frame->output_buffer, + GST_VIDEO_CAPTION_TYPE_CEA708_RAW, side_data->data, + side_data->size); + } else { + GST_LOG_OBJECT (ffmpegdec, + "CEA 708 caption meta already exists: will not add new caption meta"); + } } } |