diff options
author | aurel <aurel@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2010-03-18 21:53:02 +0000 |
---|---|---|
committer | aurel <aurel@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2010-03-18 21:53:02 +0000 |
commit | 4709cde305fa0b6bb321247cce7f7e280df34d63 (patch) | |
tree | ffd06825cb3fb70adb4d6799a5af6713c777c83a | |
parent | 77b8678bec42c297983a99ffe084e47418a70208 (diff) | |
download | mpv-4709cde305fa0b6bb321247cce7f7e280df34d63.tar.bz2 mpv-4709cde305fa0b6bb321247cce7f7e280df34d63.tar.xz |
add support for lavf style extradata in vd_theora
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30932 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r-- | libmpcodecs/vd_theora.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/libmpcodecs/vd_theora.c b/libmpcodecs/vd_theora.c index b8be6d747b..6364a4f4e4 100644 --- a/libmpcodecs/vd_theora.c +++ b/libmpcodecs/vd_theora.c @@ -27,6 +27,8 @@ #include "vd_internal.h" +#include "libavutil/intreadwrite.h" + static const vd_info_t info = { "Theora/VP3", "theora", @@ -75,6 +77,8 @@ static int control(sh_video_t *sh,int cmd,void* arg,...){ */ static int init(sh_video_t *sh){ theora_struct_t *context = NULL; + uint8_t *extradata = (uint8_t *)(sh->bih + 1); + int extradata_size = sh->bih->biSize - sizeof(*sh->bih); int errorCode = 0; ogg_packet op; int i; @@ -90,8 +94,21 @@ static int init(sh_video_t *sh){ /* Read all header packets, pass them to theora_decode_header. */ for (i = 0; i < THEORA_NUM_HEADER_PACKETS; i++) { + if (extradata_size > 2) { + op.bytes = AV_RB16(extradata); + op.packet = extradata + 2; + op.b_o_s = 1; + if (extradata_size < op.bytes + 2) { + mp_msg(MSGT_DECAUDIO, MSGL_ERR, "Theora header too small\n"); + goto err_out; + } + extradata += op.bytes + 2; + extradata_size -= op.bytes + 2; + } else { op.bytes = ds_get_packet (sh->ds, &op.packet); op.b_o_s = 1; + } + if ( (errorCode = theora_decode_header (&context->inf, &context->cc, &op)) ) { mp_msg(MSGT_DECAUDIO, MSGL_ERR, "Broken Theora header; errorCode=%i!\n", errorCode); |