diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2004-10-14 12:24:16 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2004-10-14 12:24:16 +0000 |
commit | 9efc77c86f0360d8447fe1c655ad0fd35b23f305 (patch) | |
tree | 4cbfda6f5d35015c5851c40925f6bccf5e02fd05 /libavcodec/mpegvideo.c | |
parent | 528c2c737ee58f6bec22ff515adbefca87d13a0b (diff) | |
download | ffmpeg-9efc77c86f0360d8447fe1c655ad0fd35b23f305.tar.gz |
fix forcing of individual frame types
Originally committed as revision 3593 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mpegvideo.c')
-rw-r--r-- | libavcodec/mpegvideo.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index e4ca06576f..f5e835975c 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -2023,17 +2023,7 @@ static void select_input_picture(MpegEncContext *s){ } } - if(s->input_picture[0]->pict_type){ - /* user selected pict_type */ - for(b_frames=0; b_frames<s->max_b_frames+1; b_frames++){ - if(s->input_picture[b_frames]->pict_type!=B_TYPE) break; - } - - if(b_frames > s->max_b_frames){ - av_log(s->avctx, AV_LOG_ERROR, "warning, too many bframes in a row\n"); - b_frames = s->max_b_frames; - } - }else if(s->avctx->b_frame_strategy==0){ + if(s->avctx->b_frame_strategy==0){ b_frames= s->max_b_frames; while(b_frames && !s->input_picture[b_frames]) b_frames--; }else if(s->avctx->b_frame_strategy==1){ @@ -2063,6 +2053,16 @@ static void select_input_picture(MpegEncContext *s){ //static int b_count=0; //b_count+= b_frames; //av_log(s->avctx, AV_LOG_DEBUG, "b_frames: %d\n", b_count); + + for(i= b_frames - 1; i>=0; i--){ + int type= s->input_picture[i]->pict_type; + if(type && type != B_TYPE) + b_frames= i; + } + if(s->input_picture[b_frames]->pict_type == B_TYPE && b_frames == s->max_b_frames){ + av_log(s->avctx, AV_LOG_ERROR, "warning, too many bframes in a row\n"); + } + if(s->picture_in_gop_number + b_frames >= s->gop_size){ if(s->flags & CODEC_FLAG_CLOSED_GOP) b_frames=0; |