diff options
author | Aurelien Jacobs <aurel@gnuage.org> | 2007-03-25 01:09:26 +0000 |
---|---|---|
committer | Aurelien Jacobs <aurel@gnuage.org> | 2007-03-25 01:09:26 +0000 |
commit | da91ed594e29bd552b82f51b51211222474cf6fb (patch) | |
tree | 7742994c9a5db0adcb3095a347072d84de1d4b1f /libavcodec/vp3.c | |
parent | 5bb127a98f3d7c8e4f3da4dfa5e8d697d5a2dbdc (diff) | |
download | ffmpeg-da91ed594e29bd552b82f51b51211222474cf6fb.tar.gz |
use generic xiph header spliting func to split theora headers
Original thread:
Date: Thu, 22 Mar 2007 20:23:08 -0400
Subject: [Ffmpeg-devel] [PATCH] Theora in MKV (GSoC '07 Qualification)
Originally committed as revision 8506 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/vp3.c')
-rw-r--r-- | libavcodec/vp3.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c index 23d97bf9cc..0d882da326 100644 --- a/libavcodec/vp3.c +++ b/libavcodec/vp3.c @@ -41,6 +41,7 @@ #include "mpegvideo.h" #include "vp3data.h" +#include "xiph.h" #define FRAGMENT_PIXELS 8 @@ -2574,8 +2575,9 @@ static int theora_decode_init(AVCodecContext *avctx) Vp3DecodeContext *s = avctx->priv_data; GetBitContext gb; int ptype; - uint8_t *p= avctx->extradata; - int op_bytes, i; + uint8_t *header_start[3]; + int header_len[3]; + int i; s->theora = 1; @@ -2585,12 +2587,14 @@ static int theora_decode_init(AVCodecContext *avctx) return -1; } - for(i=0;i<3;i++) { - op_bytes = *(p++)<<8; - op_bytes += *(p++); + if (ff_split_xiph_headers(avctx->extradata, avctx->extradata_size, + 42, header_start, header_len) < 0) { + av_log(avctx, AV_LOG_ERROR, "Corrupt extradata\n"); + return -1; + } - init_get_bits(&gb, p, op_bytes); - p += op_bytes; + for(i=0;i<3;i++) { + init_get_bits(&gb, header_start[i], header_len[i]); ptype = get_bits(&gb, 8); debug_vp3("Theora headerpacket type: %x\n", ptype); @@ -2620,8 +2624,8 @@ static int theora_decode_init(AVCodecContext *avctx) av_log(avctx, AV_LOG_ERROR, "Unknown Theora config packet: %d\n", ptype&~0x80); break; } - if(8*op_bytes != get_bits_count(&gb)) - av_log(avctx, AV_LOG_ERROR, "%d bits left in packet %X\n", 8*op_bytes - get_bits_count(&gb), ptype); + if(8*header_len[i] != get_bits_count(&gb)) + av_log(avctx, AV_LOG_ERROR, "%d bits left in packet %X\n", 8*header_len[i] - get_bits_count(&gb), ptype); if (s->theora < 0x030200) break; } |