comparison mpeg12.c @ 4888:185f5e4feb72 libavcodec

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
author benoit
date Wed, 02 May 2007 08:18:28 +0000
parents 522e52c630bd
children c22e10113015
comparison
equal deleted inserted replaced
4887:d9ea176a6621 4888:185f5e4feb72
2082 int repeat_field; /* true if we must repeat the field */ 2082 int repeat_field; /* true if we must repeat the field */
2083 AVPanScan pan_scan; /** some temporary storage for the panscan */ 2083 AVPanScan pan_scan; /** some temporary storage for the panscan */
2084 int slice_count; 2084 int slice_count;
2085 int swap_uv;//indicate VCR2 2085 int swap_uv;//indicate VCR2
2086 int save_aspect_info; 2086 int save_aspect_info;
2087 int save_width, save_height;
2087 AVRational frame_rate_ext; ///< MPEG-2 specific framerate modificator 2088 AVRational frame_rate_ext; ///< MPEG-2 specific framerate modificator
2088 2089
2089 } Mpeg1Context; 2090 } Mpeg1Context;
2090 2091
2091 static int mpeg_decode_init(AVCodecContext *avctx) 2092 static int mpeg_decode_init(AVCodecContext *avctx)
2136 2137
2137 if ( 2138 if (
2138 (s1->mpeg_enc_ctx_allocated == 0)|| 2139 (s1->mpeg_enc_ctx_allocated == 0)||
2139 avctx->coded_width != s->width || 2140 avctx->coded_width != s->width ||
2140 avctx->coded_height != s->height|| 2141 avctx->coded_height != s->height||
2142 s1->save_width != s->width ||
2143 s1->save_height != s->height ||
2141 s1->save_aspect_info != s->aspect_ratio_info|| 2144 s1->save_aspect_info != s->aspect_ratio_info||
2142 0) 2145 0)
2143 { 2146 {
2144 2147
2145 if (s1->mpeg_enc_ctx_allocated) { 2148 if (s1->mpeg_enc_ctx_allocated) {
2153 return -2; 2156 return -2;
2154 2157
2155 avcodec_set_dimensions(avctx, s->width, s->height); 2158 avcodec_set_dimensions(avctx, s->width, s->height);
2156 avctx->bit_rate = s->bit_rate; 2159 avctx->bit_rate = s->bit_rate;
2157 s1->save_aspect_info = s->aspect_ratio_info; 2160 s1->save_aspect_info = s->aspect_ratio_info;
2161 s1->save_width = s->width;
2162 s1->save_height = s->height;
2158 2163
2159 //low_delay may be forced, in this case we will have B frames 2164 //low_delay may be forced, in this case we will have B frames
2160 //that behave like P frames 2165 //that behave like P frames
2161 avctx->has_b_frames = !(s->low_delay); 2166 avctx->has_b_frames = !(s->low_delay);
2162 2167