[FFmpeg-devel] [PATCHv3] avcodec: Add support for Closed Caption export in h264

Michael Niedermayer michaelni at gmx.at
Fri Jul 3 14:06:21 CEST 2015


On Thu, Jul 02, 2015 at 08:18:13PM +0100, Kieran Kunhya wrote:
> ---
>  libavcodec/h264.c     | 11 +++++++++++
>  libavcodec/h264.h     |  2 ++
>  libavcodec/h264_sei.c | 35 ++++++++++++++++++++++++++++++++++-
>  3 files changed, 47 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/h264.c b/libavcodec/h264.c
> index 1cbd4cb..1569ec8 100644
> --- a/libavcodec/h264.c
> +++ b/libavcodec/h264.c
> @@ -609,6 +609,8 @@ static int h264_init_context(AVCodecContext *avctx, H264Context *h)
>      h->prev_frame_num        = -1;
>      h->sei_fpa.frame_packing_arrangement_cancel_flag = -1;
>      h->has_afd               = 0;
> +    h->a53_caption_size      = 0;
> +    h->a53_caption           = NULL;
>  
>      h->next_outputed_poc = INT_MIN;
>      for (i = 0; i < MAX_DELAYED_PIC_COUNT; i++)
> @@ -879,6 +881,15 @@ static void decode_postinit(H264Context *h, int setup_finished)
>          }
>      }
>  
> +    if (h->a53_caption) {
> +        AVFrameSideData *sd =
> +            av_frame_new_side_data(cur->f, AV_FRAME_DATA_A53_CC, h->a53_caption_size);
> +        if (sd)
> +            memcpy(sd->data, h->a53_caption, h->a53_caption_size);
> +        av_freep(&h->a53_caption);
> +        h->a53_caption_size = 0;
> +    }
> +
>      cur->mmco_reset = h->mmco_reset;
>      h->mmco_reset = 0;
>  

i think this could in case of seeking return old a53_captions
the stuff should be reset/freed in some place thats called from
avcodec_flush()->flush_dpb()
maybe ff_h264_reset_sei()

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Frequently ignored answer#1 FFmpeg bugs should be sent to our bugtracker. User
questions about the command line tools should be sent to the ffmpeg-user ML.
And questions about how to use libav* should be sent to the libav-user ML.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150703/8ac93b4e/attachment.asc>


More information about the ffmpeg-devel mailing list