From b894bedeb3d47c258705af3e54718043f1bb0b9b Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Thu, 22 Feb 2018 15:57:24 +0100 Subject: [PATCH] avvidec: Expose Closed Caption as GstVideoCaptionMeta --- ext/libav/gstavviddec.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ext/libav/gstavviddec.c b/ext/libav/gstavviddec.c index f9c6096406..63d74c851a 100644 --- a/ext/libav/gstavviddec.c +++ b/ext/libav/gstavviddec.c @@ -32,6 +32,7 @@ #include #include #include +#include #include "gstav.h" #include "gstavcodecmap.h" @@ -1635,6 +1636,19 @@ gst_ffmpegviddec_video_frame (GstFFMpegVidDec * ffmpegdec, GST_VIDEO_BUFFER_FLAG_INTERLACED); } + { + 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); + 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); + } + } + /* cleaning time */ /* so we decoded this frame, frames preceding it in decoding order * that still do not have a buffer allocated seem rather useless,