On Wed, Nov 28, 2018 at 10:48:17PM +0100, Carl Eugen Hoyos wrote:
> Hi!
> 
> Attached patch fixes reading Closed Captions from a field-encoded
> mpeg2video sample from the libav-user mailing list.
> 
> Please review, Carl Eugen

>  mpeg12dec.c |   11 +++++++++++
>  1 file changed, 11 insertions(+)
> 777c30f845680de35a26279d23206baf4d4b4dfd  
> 0001-lavc-mpeg12dec-Read-Closed-Captions-from-second-fiel.patch
> From 045a485ffedb3344560070a58a2def659be81700 Mon Sep 17 00:00:00 2001
> From: Carl Eugen Hoyos <ceffm...@gmail.com>
> Date: Wed, 28 Nov 2018 22:45:00 +0100
> Subject: [PATCH] lavc/mpeg12dec: Read Closed Captions from second field.
> 
> ---
>  libavcodec/mpeg12dec.c |   11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
> index 83e5378..c0a54a8 100644
> --- a/libavcodec/mpeg12dec.c
> +++ b/libavcodec/mpeg12dec.c
> @@ -1664,6 +1664,17 @@ static int mpeg_field_start(MpegEncContext *s, const 
> uint8_t *buf, int buf_size)
>              return AVERROR_INVALIDDATA;
>          }
>  
> +        if (s1->a53_caption) {
> +            AVFrameSideData *sd;
> +            av_frame_remove_side_data(s->current_picture_ptr->f, 
> AV_FRAME_DATA_A53_CC);
> +            sd = av_frame_new_side_data(
> +                s->current_picture_ptr->f, AV_FRAME_DATA_A53_CC,
> +                s1->a53_caption_size);
> +            if (sd)
> +                memcpy(sd->data, s1->a53_caption, s1->a53_caption_size);
> +            av_freep(&s1->a53_caption);
> +        }

This is probably ok if only one field has data Attached to it, but if both
have then both should be exported. Also the user should have some way to
find out which of 2 fields data came from


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No human being will ever know the Truth, for even if they happen to say it
by chance, they would not even known they had done so. -- Xenophanes

Attachment: signature.asc
Description: PGP signature

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to