04-vp3 fix(by matthieu castet).patch

Originally committed as revision 3998 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Michael Niedermayer 2005-03-03 02:24:20 +00:00
parent f86f4481d8
commit ee89b2b9e7
1 changed files with 9 additions and 1 deletions

View File

@ -2919,13 +2919,20 @@ static int theora_decode_init(AVCodecContext *avctx)
Vp3DecodeContext *s = avctx->priv_data; Vp3DecodeContext *s = avctx->priv_data;
GetBitContext gb; GetBitContext gb;
int ptype; int ptype;
uint8_t *p= avctx->extradata;
int op_bytes, i;
s->theora = 1; s->theora = 1;
if (!avctx->extradata_size) if (!avctx->extradata_size)
return -1; return -1;
init_get_bits(&gb, avctx->extradata, avctx->extradata_size); for(i=0;i<3;i++) {
op_bytes = *(p++)<<8;
op_bytes += *(p++);
init_get_bits(&gb, p, op_bytes);
p += op_bytes;
ptype = get_bits(&gb, 8); ptype = get_bits(&gb, 8);
debug_vp3("Theora headerpacket type: %x\n", ptype); debug_vp3("Theora headerpacket type: %x\n", ptype);
@ -2948,6 +2955,7 @@ static int theora_decode_init(AVCodecContext *avctx)
theora_decode_tables(avctx, gb); theora_decode_tables(avctx, gb);
break; break;
} }
}
return 0; return 0;
} }