summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorFabrice Bellard <fabrice@bellard.org>2003-12-10 11:18:36 +0000
committerFabrice Bellard <fabrice@bellard.org>2003-12-10 11:18:36 +0000
commit32e7b91af1526f8706461311e2043b8c7e1d7a87 (patch)
treeead12e55650bc53dc97f1a2f83fa72d81720a10e /libavcodec
parent26f548a7a6d644474657adc5aa3c8ac649073b1b (diff)
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)
Originally committed as revision 2587 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/mpeg12.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index ca3327cf5a..5627bfebd1 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -2300,10 +2300,10 @@ static int mpeg1_decode_sequence(AVCodecContext *avctx,
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)