diff options
author | David Conrad <lessen42@gmail.com> | 2010-04-17 02:04:39 +0000 |
---|---|---|
committer | David Conrad <lessen42@gmail.com> | 2010-04-17 02:04:39 +0000 |
commit | 8099d6c985ef561f8389daca621aeb367fee2f6d (patch) | |
tree | d922b6165fbd0f7a2536d1c0789c670a6baec184 /libavcodec/vp3.c | |
parent | ddc7e438e009a7fbd44769ffce51a2764887b9ce (diff) | |
download | ffmpeg-8099d6c985ef561f8389daca621aeb367fee2f6d.tar.gz |
vp3: Read fps and aspect ratio in the decoder
Originally committed as revision 22898 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/vp3.c')
-rw-r--r-- | libavcodec/vp3.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c index 46307c1d1b..2384524ebd 100644 --- a/libavcodec/vp3.c +++ b/libavcodec/vp3.c @@ -1953,6 +1953,7 @@ static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb) Vp3DecodeContext *s = avctx->priv_data; int visible_width, visible_height, colorspace; int offset_x = 0, offset_y = 0; + AVRational fps; s->theora = get_bits_long(gb, 24); av_log(avctx, AV_LOG_DEBUG, "Theora bitstream version %X\n", s->theora); @@ -1982,10 +1983,15 @@ static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb) offset_y = get_bits(gb, 8); /* offset y, from bottom */ } - skip_bits(gb, 32); /* fps numerator */ - skip_bits(gb, 32); /* fps denumerator */ - skip_bits(gb, 24); /* aspect numerator */ - skip_bits(gb, 24); /* aspect denumerator */ + fps.num = get_bits_long(gb, 32); + fps.den = get_bits_long(gb, 32); + if (fps.num && fps.den) { + av_reduce(&s->avctx->time_base.num, &s->avctx->time_base.den, + fps.den, fps.num, INT_MAX); + } + + avctx->sample_aspect_ratio.num = get_bits_long(gb, 24); + avctx->sample_aspect_ratio.den = get_bits_long(gb, 24); if (s->theora < 0x030200) skip_bits(gb, 5); /* keyframe frequency force */ |