# HG changeset patch # User bellard # Date 1071055116 0 # Node ID 835964e33ba2a614701edfc4d750b9c5bf8c272a # Parent f17ba52fec0859064859f83c46e398dd9551d3b5 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) diff -r f17ba52fec08 -r 835964e33ba2 mpeg12.c --- a/mpeg12.c Wed Dec 10 02:34:09 2003 +0000 +++ b/mpeg12.c Wed Dec 10 11:18:36 2003 +0000 @@ -2300,10 +2300,10 @@ width = get_bits(&s->gb, 12); height = get_bits(&s->gb, 12); s->aspect_ratio_info= get_bits(&s->gb, 4); - if(s->codec_id == CODEC_ID_MPEG1VIDEO){ - aspect= 1.0/mpeg1_aspect[s->aspect_ratio_info]; - if(aspect!=0.0) avctx->sample_aspect_ratio= av_d2q(aspect, 255); - } + if (s->aspect_ratio_info == 0) + return -1; + aspect= 1.0/mpeg1_aspect[s->aspect_ratio_info]; + avctx->sample_aspect_ratio= av_d2q(aspect, 255); s->frame_rate_index = get_bits(&s->gb, 4); if (s->frame_rate_index == 0)