Commit 277e3e53 authored by David Conrad's avatar David Conrad

Visible width/height fields were added in Theora 3.2

Originally committed as revision 15500 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 51ace577
...@@ -2078,8 +2078,8 @@ static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb) ...@@ -2078,8 +2078,8 @@ static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb)
av_log(avctx, AV_LOG_DEBUG, "Old (<alpha3) Theora bitstream, flipped image\n"); av_log(avctx, AV_LOG_DEBUG, "Old (<alpha3) Theora bitstream, flipped image\n");
} }
s->width = get_bits(gb, 16) << 4; visible_width = s->width = get_bits(gb, 16) << 4;
s->height = get_bits(gb, 16) << 4; visible_height = s->height = get_bits(gb, 16) << 4;
if(avcodec_check_dimensions(avctx, s->width, s->height)){ if(avcodec_check_dimensions(avctx, s->width, s->height)){
av_log(avctx, AV_LOG_ERROR, "Invalid dimensions (%dx%d)\n", s->width, s->height); av_log(avctx, AV_LOG_ERROR, "Invalid dimensions (%dx%d)\n", s->width, s->height);
...@@ -2096,10 +2096,10 @@ static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb) ...@@ -2096,10 +2096,10 @@ static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb)
skip_bits(gb, 32); /* total number of macroblocks in a frame */ skip_bits(gb, 32); /* total number of macroblocks in a frame */
} }
if (s->theora >= 0x030200) {
visible_width = get_bits_long(gb, 24); visible_width = get_bits_long(gb, 24);
visible_height = 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 x */
skip_bits(gb, 8); /* offset y */ skip_bits(gb, 8); /* offset y */
} }
......
...@@ -75,14 +75,15 @@ theora_header (AVFormatContext * s, int idx) ...@@ -75,14 +75,15 @@ theora_header (AVFormatContext * s, int idx)
if (version >= 0x030400) if (version >= 0x030400)
skip_bits(&gb, 100); skip_bits(&gb, 100);
if (version >= 0x030200) {
width = get_bits_long(&gb, 24); width = get_bits_long(&gb, 24);
height = get_bits_long(&gb, 24); height = get_bits_long(&gb, 24);
if ( width <= st->codec->width && width > st->codec->width-16 if ( width <= st->codec->width && width > st->codec->width-16
&& height <= st->codec->height && height > st->codec->height-16) && height <= st->codec->height && height > st->codec->height-16)
avcodec_set_dimensions(st->codec, width, height); avcodec_set_dimensions(st->codec, width, height);
if (version >= 0x030200)
skip_bits(&gb, 16); skip_bits(&gb, 16);
}
st->codec->time_base.den = get_bits_long(&gb, 32); st->codec->time_base.den = get_bits_long(&gb, 32);
st->codec->time_base.num = get_bits_long(&gb, 32); st->codec->time_base.num = get_bits_long(&gb, 32);
st->time_base = st->codec->time_base; st->time_base = st->codec->time_base;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment