diff mbox

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

Message ID 1504168610-2427-4-git-send-email-kjeyapal@akamai.com
State New
Headers show

Commit Message

Jeyapal, Karthick Aug. 31, 2017, 8:36 a.m. UTC
From: Karthick J <kjeyapal@akamai.com>

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

Comments

Hendrik Leppkes Aug. 31, 2017, 9:32 a.m. UTC | #1
On Thu, Aug 31, 2017 at 10:36 AM,  <kjeyapal@akamai.com> wrote:
> From: Karthick J <kjeyapal@akamai.com>
>
> Signed-off-by: Karthick J <kjeyapal@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;

Maybe this should be handled somewhere in generic code? This is hardly
a v210 property at all.

- Hendrik
diff mbox

Patch

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;