diff options
author | Aurelien Jacobs <aurel@gnuage.org> | 2007-05-07 15:43:01 +0000 |
---|---|---|
committer | Aurelien Jacobs <aurel@gnuage.org> | 2007-05-07 15:43:01 +0000 |
commit | c0f716b86f8501539c67711c3efe3dda25e26989 (patch) | |
tree | 87ce5fea1005ba1176dca1e3edf7fb9c1efdba3f /libavformat/oggparsetheora.c | |
parent | cb631737855f3c0154b677ed2890cc7032df4064 (diff) | |
download | ffmpeg-c0f716b86f8501539c67711c3efe3dda25e26989.tar.gz |
fix display of theora videos with visible size smaller than encoded size
Originally committed as revision 8928 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/oggparsetheora.c')
-rw-r--r-- | libavformat/oggparsetheora.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/libavformat/oggparsetheora.c b/libavformat/oggparsetheora.c index 9052bbbea0..c2045ce17e 100644 --- a/libavformat/oggparsetheora.c +++ b/libavformat/oggparsetheora.c @@ -53,6 +53,7 @@ theora_header (AVFormatContext * s, int idx) if (os->buf[os->pstart] == 0x80) { GetBitContext gb; + int width, height; int version; init_get_bits(&gb, os->buf + os->pstart, os->psize*8); @@ -70,13 +71,21 @@ theora_header (AVFormatContext * s, int idx) return -1; } - st->codec->width = get_bits(&gb, 16) << 4; - st->codec->height = get_bits(&gb, 16) << 4; + width = get_bits(&gb, 16) << 4; + height = get_bits(&gb, 16) << 4; + avcodec_set_dimensions(st->codec, width, height); if (version >= 0x030400) - skip_bits(&gb, 164); - else if (version >= 0x030200) - skip_bits(&gb, 64); + skip_bits(&gb, 100); + + width = get_bits_long(&gb, 24); + height = get_bits_long(&gb, 24); + if ( width <= st->codec->width && width > st->codec->width-16 + && height <= st->codec->height && height > st->codec->height-16) + avcodec_set_dimensions(st->codec, width, height); + + if (version >= 0x030200) + skip_bits(&gb, 16); st->codec->time_base.den = get_bits(&gb, 32); st->codec->time_base.num = get_bits(&gb, 32); st->time_base = st->codec->time_base; |