[FFmpeg-devel] [PATCH] avcodec/h264dec: get field_order for typical frames
Paul B Mahol
onemda at gmail.com
Wed Dec 5 13:42:39 EET 2018
This is normally set by parser but parsing is not always enabled.
Signed-off-by: Paul B Mahol <onemda at gmail.com>
---
libavcodec/h264dec.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
index 00d922fbe9..39142da7af 100644
--- a/libavcodec/h264dec.c
+++ b/libavcodec/h264dec.c
@@ -1018,6 +1018,24 @@ static int h264_decode_frame(AVCodecContext *avctx, void *data,
}
}
+ if (h->picture_structure == PICT_FRAME) {
+ if (h->ps.sps->pic_struct_present_flag && h->sei.picture_timing.present) {
+ switch (h->sei.picture_timing.pic_struct) {
+ case H264_SEI_PIC_STRUCT_TOP_BOTTOM:
+ case H264_SEI_PIC_STRUCT_TOP_BOTTOM_TOP:
+ avctx->field_order = AV_FIELD_TT;
+ break;
+ case H264_SEI_PIC_STRUCT_BOTTOM_TOP:
+ case H264_SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM:
+ avctx->field_order = AV_FIELD_BB;
+ break;
+ default:
+ avctx->field_order = AV_FIELD_PROGRESSIVE;
+ break;
+ }
+ }
+ }
+
av_assert0(pict->buf[0] || !*got_frame);
ff_h264_unref_picture(h, &h->last_pic_for_ec);
--
2.17.1
More information about the ffmpeg-devel
mailing list