[FFmpeg-devel] [PATCH 4/4] avcodec/v210dec: Pass on the Closed Captions Side Data

kjeyapal at akamai.com kjeyapal at akamai.com
Thu Aug 31 11:36:50 EEST 2017


From: Karthick J <kjeyapal at akamai.com>

Signed-off-by: Karthick J <kjeyapal at akamai.com>
---
 libavcodec/v210dec.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/libavcodec/v210dec.c b/libavcodec/v210dec.c
index 9af9af6..7b0b68b 100644
--- a/libavcodec/v210dec.c
+++ b/libavcodec/v210dec.c
@@ -73,6 +73,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
     AVFrame *pic = data;
     const uint8_t *psrc = avpkt->data;
     uint16_t *y, *u, *v;
+    uint8_t *cc_data;
+    int cc_size;
 
     if (s->custom_stride )
         stride = s->custom_stride;
@@ -149,6 +151,16 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
             pic->top_field_first = 1;
     }
 
+    if ((cc_data = av_packet_get_side_data(avpkt, AV_PKT_DATA_A53_CC, &cc_size)) != NULL) {
+
+        AVFrameSideData *sd = av_frame_new_side_data(pic,
+                                                     AV_FRAME_DATA_A53_CC,
+                                                     cc_size);
+        if (sd)
+            memcpy(sd->data, cc_data, cc_size);
+        avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
+    }
+
     *got_frame      = 1;
 
     return avpkt->size;
-- 
1.9.1



More information about the ffmpeg-devel mailing list