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 /libavcodec/vp3.c | |
parent | cb631737855f3c0154b677ed2890cc7032df4064 (diff) | |
download | ffmpeg-streaming-c0f716b86f8501539c67711c3efe3dda25e26989.zip ffmpeg-streaming-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 'libavcodec/vp3.c')
-rw-r--r-- | libavcodec/vp3.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c index 0a5d760..a8529fb 100644 --- a/libavcodec/vp3.c +++ b/libavcodec/vp3.c @@ -2371,6 +2371,7 @@ static int read_huffman_tree(AVCodecContext *avctx, GetBitContext *gb) static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb) { Vp3DecodeContext *s = avctx->priv_data; + int visible_width, visible_height; s->theora = get_bits_long(gb, 24); av_log(avctx, AV_LOG_INFO, "Theora bitstream version %X\n", s->theora); @@ -2399,16 +2400,11 @@ static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb) skip_bits(gb, 32); /* total number of blocks in a frame */ skip_bits(gb, 4); /* total number of blocks in a frame */ skip_bits(gb, 32); /* total number of macroblocks in a frame */ - - skip_bits(gb, 24); /* frame width */ - skip_bits(gb, 24); /* frame height */ - } - else - { - skip_bits(gb, 24); /* frame width */ - skip_bits(gb, 24); /* frame height */ } + visible_width = get_bits_long(gb, 24); + visible_height = get_bits_long(gb, 24); + if (s->theora >= 0x030200) { skip_bits(gb, 8); /* offset x */ skip_bits(gb, 8); /* offset y */ @@ -2438,8 +2434,11 @@ static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb) // align_get_bits(gb); - avctx->width = s->width; - avctx->height = s->height; + if ( visible_width <= s->width && visible_width > s->width-16 + && visible_height <= s->height && visible_height > s->height-16) + avcodec_set_dimensions(avctx, visible_width, visible_height); + else + avcodec_set_dimensions(avctx, s->width, s->height); return 0; } |