aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Aimar <fenrir@videolan.org>2010-08-20 18:28:42 +0000
committerLaurent Aimar <fenrir@videolan.org>2010-08-20 18:28:42 +0000
commit8bdf11815cc53bee2ea3c16934a4a224d35121a0 (patch)
tree589e7ccb34f4bea09fe072293d0faeade3829fca
parent26553088cc9f7421dde54279ee0c5fefde489ec1 (diff)
downloadffmpeg-8bdf11815cc53bee2ea3c16934a4a224d35121a0.tar.gz
Fixed mpeg12 top field first flag value with field picture encoding.
The relevent extract of the iso 13818-2 about the value of the syntaxical element top_field_first of the Picture Coding Extension is: "top_field_first -- The meaning of this element depends upon picture_structure, progressive_sequence and repeat_first_field. [...] In a field picture top_field_first shall have the value '0', and the only field output by the decoding process is the decoded field picture." Originally committed as revision 24853 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/mpegvideo.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 2fab73dba7..42496ec97f 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -963,7 +963,14 @@ int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
return -1;
s->current_picture_ptr= pic;
- s->current_picture_ptr->top_field_first= s->top_field_first; //FIXME use only the vars from current_pic
+ //FIXME use only the vars from current_pic
+ if(s->codec_id == CODEC_ID_MPEG1VIDEO || s->codec_id == CODEC_ID_MPEG2VIDEO) {
+ if(s->picture_structure == PICT_FRAME)
+ s->current_picture_ptr->top_field_first= s->top_field_first;
+ else
+ s->current_picture_ptr->top_field_first= (s->picture_structure == PICT_TOP_FIELD) == s->first_field;
+ } else
+ s->current_picture_ptr->top_field_first= s->top_field_first;
s->current_picture_ptr->interlaced_frame= !s->progressive_frame && !s->progressive_sequence;
}