[FFmpeg-devel] [PATCH]lavc/mpeg12dec: Read Closed Captions from second field

Michael Niedermayer michael at niedermayer.cc
Thu Nov 29 19:55:24 EET 2018


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 <ceffmpeg at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20181129/e1935e73/attachment.sig>


More information about the ffmpeg-devel mailing list