Hi! Attached patch fixes reading Closed Captions from a field-encoded mpeg2video sample from the libav-user mailing list.
Please review, Carl Eugen
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); + } + if (s->avctx->hwaccel && (s->avctx->slice_flags & SLICE_FLAG_ALLOW_FIELD)) { if ((ret = s->avctx->hwaccel->end_frame(s->avctx)) < 0) { -- 1.7.10.4
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel