From 6c0c94f8581d9e76301b03f9f416972fc0265fb6 Mon Sep 17 00:00:00 2001 From: Kieran Kunhya <kie...@kunhya.com> Date: Sun, 21 Jun 2015 23:59:12 +0100 Subject: [PATCH] avcodec: Add support for per-frame AFD output in h264
--- libavcodec/h264.c | 11 +++++++++++ libavcodec/h264.h | 3 +++ libavcodec/h264_sei.c | 6 ++++++ 3 files changed, 20 insertions(+) diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 9be317c..de17edd 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -608,6 +608,7 @@ static int h264_init_context(AVCodecContext *avctx, H264Context *h) h->frame_recovered = 0; h->prev_frame_num = -1; h->sei_fpa.frame_packing_arrangement_cancel_flag = -1; + h->has_afd = 0; h->next_outputed_poc = INT_MIN; for (i = 0; i < MAX_DELAYED_PIC_COUNT; i++) @@ -869,6 +870,16 @@ static void decode_postinit(H264Context *h, int setup_finished) } } + if (h->has_afd) { + AVFrameSideData *sd = + av_frame_new_side_data(cur->f, AV_FRAME_DATA_AFD, 1); + if (!sd) + return AVERROR(ENOMEM); + + *sd->data = h->afd; + h->has_afd = 0; + } + cur->mmco_reset = h->mmco_reset; h->mmco_reset = 0; diff --git a/libavcodec/h264.h b/libavcodec/h264.h index 548510d..7565e03 100644 --- a/libavcodec/h264.h +++ b/libavcodec/h264.h @@ -781,6 +781,9 @@ typedef struct H264Context { int missing_fields; + uint8_t afd; + int has_afd; + // Timestamp stuff int sei_buffering_period_present; ///< Buffering period SEI flag diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c index 8e1697a..b6ec5c7 100644 --- a/libavcodec/h264_sei.c +++ b/libavcodec/h264_sei.c @@ -132,7 +132,13 @@ static int decode_user_data_itu_t_t35(H264Context *h, int size) return -1; skip_bits(&h->gb, 4); dtg_active_format = get_bits(&h->gb, 4); +#if FF_API_AFD +FF_DISABLE_DEPRECATION_WARNINGS h->avctx->dtg_active_format = dtg_active_format; +FF_ENABLE_DEPRECATION_WARNINGS +#endif /* FF_API_AFD */ + h->has_afd = 1; + h->afd = dtg_active_format; } else { skip_bits(&h->gb, 6); } -- 1.9.1
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel