comparison mpeg12.c @ 1674:835964e33ba2 libavcodec

fixed potential problem if aspect_ratio_info == 0 for MPEG stream - fixed aspect ratio problem if CODEC_ID_MPEG2VIDEO is used to decode an MPEG1 stream (which is the recommended codec id for mpeg video)
author bellard
date Wed, 10 Dec 2003 11:18:36 +0000
parents f17ba52fec08
children c8b1b515d3b9
comparison
equal deleted inserted replaced
1673:f17ba52fec08 1674:835964e33ba2
2298 init_get_bits(&s->gb, buf, buf_size*8); 2298 init_get_bits(&s->gb, buf, buf_size*8);
2299 2299
2300 width = get_bits(&s->gb, 12); 2300 width = get_bits(&s->gb, 12);
2301 height = get_bits(&s->gb, 12); 2301 height = get_bits(&s->gb, 12);
2302 s->aspect_ratio_info= get_bits(&s->gb, 4); 2302 s->aspect_ratio_info= get_bits(&s->gb, 4);
2303 if(s->codec_id == CODEC_ID_MPEG1VIDEO){ 2303 if (s->aspect_ratio_info == 0)
2304 aspect= 1.0/mpeg1_aspect[s->aspect_ratio_info]; 2304 return -1;
2305 if(aspect!=0.0) avctx->sample_aspect_ratio= av_d2q(aspect, 255); 2305 aspect= 1.0/mpeg1_aspect[s->aspect_ratio_info];
2306 } 2306 avctx->sample_aspect_ratio= av_d2q(aspect, 255);
2307 2307
2308 s->frame_rate_index = get_bits(&s->gb, 4); 2308 s->frame_rate_index = get_bits(&s->gb, 4);
2309 if (s->frame_rate_index == 0) 2309 if (s->frame_rate_index == 0)
2310 return -1; 2310 return -1;
2311 s->bit_rate = get_bits(&s->gb, 18) * 400; 2311 s->bit_rate = get_bits(&s->gb, 18) * 400;