In particular cases, it is possible to initialize top_field_first
but not interlaced_frame. Make sure to correctly tag a frame
as interlaced when this happens.

Signed-off-by: Vittorio Giovara <vittorio.giov...@gmail.com>
---
 libavcodec/h264_slice.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index f1f5fc0..331e0c3 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1047,15 +1047,17 @@ static int h264_export_frame_props(H264Context *h)
 
     if (cur->field_poc[0] != cur->field_poc[1]) {
         /* Derive top_field_first from field pocs. */
-        cur->f->top_field_first = cur->field_poc[0] < cur->field_poc[1];
+        cur->f->interlaced_frame =
+        cur->f->top_field_first  = cur->field_poc[0] < cur->field_poc[1];
     } else {
         if (cur->f->interlaced_frame || sps->pic_struct_present_flag) {
             /* Use picture timing SEI information. Even if it is a
              * information of a past frame, better than nothing. */
             if (h->sei.picture_timing.pic_struct == SEI_PIC_STRUCT_TOP_BOTTOM 
||
-                h->sei.picture_timing.pic_struct == 
SEI_PIC_STRUCT_TOP_BOTTOM_TOP)
-                cur->f->top_field_first = 1;
-            else
+                h->sei.picture_timing.pic_struct == 
SEI_PIC_STRUCT_TOP_BOTTOM_TOP) {
+                cur->f->interlaced_frame =
+                cur->f->top_field_first  = 1;
+            } else
                 cur->f->top_field_first = 0;
         } else {
             /* Most likely progressive */
-- 
2.10.0

_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to