avvidec: Expose Closed Caption as GstVideoCaptionMeta

This commit is contained in:
Edward Hervey 2018-02-22 15:57:24 +01:00 committed by Edward Hervey
parent a68dbb9c82
commit b894bedeb3

View file

@ -32,6 +32,7 @@
#include <gst/video/gstvideodecoder.h>
#include <gst/video/gstvideometa.h>
#include <gst/video/gstvideopool.h>
#include <gst/video/video-anc.h>
#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,