diff options
author | Anton Khirnov <anton@khirnov.net> | 2014-07-05 10:44:00 +0400 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2014-07-09 17:40:39 +0400 |
commit | 650d384048ed42579cc6d67bf32a94b468c0b6cb (patch) | |
tree | 68e0a7354d65f13f69ed764013065eeebdfed77a /libavformat/yuv4mpegenc.c | |
parent | 27c1f82f561932c83191bcd3e70e0cb1712485ba (diff) |
yuv4mpegenc: do not access AVCodecContext.coded_frame
Its contents are meaningful only if the stream codec context is the one
actually used for encoding, which is often not the case (and is
discouraged).
Use AVCodecContext.field_order instead.
Diffstat (limited to 'libavformat/yuv4mpegenc.c')
-rw-r--r-- | libavformat/yuv4mpegenc.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/libavformat/yuv4mpegenc.c b/libavformat/yuv4mpegenc.c index abe967f177..2caa364908 100644 --- a/libavformat/yuv4mpegenc.c +++ b/libavformat/yuv4mpegenc.c @@ -48,9 +48,11 @@ static int yuv4_generate_header(AVFormatContext *s, char* buf) if (aspectn == 0 && aspectd == 1) aspectd = 0; // 0:0 means unknown - inter = 'p'; /* progressive is the default */ - if (st->codec->coded_frame && st->codec->coded_frame->interlaced_frame) - inter = st->codec->coded_frame->top_field_first ? 't' : 'b'; + switch (st->codec->field_order) { + case AV_FIELD_TT: inter = 't'; break; + case AV_FIELD_BB: inter = 'b'; break; + default: inter = 'p'; break; + } switch (st->codec->pix_fmt) { case AV_PIX_FMT_GRAY8: |