Commit 29644cb5 authored by Heikki Lindholm's avatar Heikki Lindholm Committed by Benoit Fouet

make mpeg decoder handle mid-stream changes in resolution

patch by Heikki Lindholm holindho at cs helsinki fi
original thread: [Ffmpeg-devel] [PATCH] fix mid-stream resolution changes
date: Sat Mar 31 13:52:50 CEST 2007

Originally committed as revision 8865 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent f52a02be
...@@ -2084,6 +2084,7 @@ typedef struct Mpeg1Context { ...@@ -2084,6 +2084,7 @@ typedef struct Mpeg1Context {
int slice_count; int slice_count;
int swap_uv;//indicate VCR2 int swap_uv;//indicate VCR2
int save_aspect_info; int save_aspect_info;
int save_width, save_height;
AVRational frame_rate_ext; ///< MPEG-2 specific framerate modificator AVRational frame_rate_ext; ///< MPEG-2 specific framerate modificator
} Mpeg1Context; } Mpeg1Context;
...@@ -2138,6 +2139,8 @@ static int mpeg_decode_postinit(AVCodecContext *avctx){ ...@@ -2138,6 +2139,8 @@ static int mpeg_decode_postinit(AVCodecContext *avctx){
(s1->mpeg_enc_ctx_allocated == 0)|| (s1->mpeg_enc_ctx_allocated == 0)||
avctx->coded_width != s->width || avctx->coded_width != s->width ||
avctx->coded_height != s->height|| avctx->coded_height != s->height||
s1->save_width != s->width ||
s1->save_height != s->height ||
s1->save_aspect_info != s->aspect_ratio_info|| s1->save_aspect_info != s->aspect_ratio_info||
0) 0)
{ {
...@@ -2155,6 +2158,8 @@ static int mpeg_decode_postinit(AVCodecContext *avctx){ ...@@ -2155,6 +2158,8 @@ static int mpeg_decode_postinit(AVCodecContext *avctx){
avcodec_set_dimensions(avctx, s->width, s->height); avcodec_set_dimensions(avctx, s->width, s->height);
avctx->bit_rate = s->bit_rate; avctx->bit_rate = s->bit_rate;
s1->save_aspect_info = s->aspect_ratio_info; s1->save_aspect_info = s->aspect_ratio_info;
s1->save_width = s->width;
s1->save_height = s->height;
//low_delay may be forced, in this case we will have B frames //low_delay may be forced, in this case we will have B frames
//that behave like P frames //that behave like P frames
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment