[FFmpeg-devel] [PATCH] h264: Move AFD to side data to match MPEG-2

Kieran Kunhya kierank at obe.tv
Sat Aug 9 02:45:22 CEST 2014


---
 libavcodec/h264.c     |   11 +++++++++++
 libavcodec/h264.h     |    6 ++++++
 libavcodec/h264_sei.c |    6 ++++++
 3 files changed, 23 insertions(+)

diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 8fa35c7..e77b633 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -883,6 +883,17 @@ static void decode_postinit(H264Context *h, int setup_finished)
                                h->sei_vflip, h->sei_hflip);
     }
 
+    if (h->afd_present) {
+        AVFrameSideData *sd =
+            av_frame_new_side_data(&cur->f,
+                                   AV_FRAME_DATA_AFD, 1);
+        if (!sd)
+            return;
+
+        *sd->data   = h->afd;
+        h->afd_present = 0;
+    }
+
     cur->mmco_reset = h->mmco_reset;
     h->mmco_reset = 0;
 
diff --git a/libavcodec/h264.h b/libavcodec/h264.h
index 5ec4f0c..b7e7b04 100644
--- a/libavcodec/h264.h
+++ b/libavcodec/h264.h
@@ -682,6 +682,12 @@ typedef struct H264Context {
     int sei_hflip, sei_vflip;
 
     /**
+     * AFD
+     */
+    int afd_present;
+    uint8_t afd;
+
+    /**
      * Bit set of clock types for fields/frames in picture timing SEI message.
      * For each found ct_type, appropriate bit is set (e.g., bit 1 for
      * interlaced).
diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c
index aa889b8..2d0212d 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->afd_present = 1;
+                h->afd = dtg_active_format;
             } else {
                 skip_bits(&h->gb, 6);
             }
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list