diff options
author | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2010-04-26 17:42:20 +0300 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2010-04-26 17:42:20 +0300 |
commit | 4785c2617ee9ac186464a55c1bfb13a5781ef041 (patch) | |
tree | 2424f18b68b2037bd4e290471821e9adae28b876 /libmpcodecs/vd_theora.c | |
parent | 2732d5efbae3e0ee28bc6b70ceab1eb77e593216 (diff) | |
parent | 38abe6ff7a3810f8e01b6296570e92df1b12b09c (diff) | |
download | mpv-4785c2617ee9ac186464a55c1bfb13a5781ef041.tar.bz2 mpv-4785c2617ee9ac186464a55c1bfb13a5781ef041.tar.xz |
Merge svn changes up to r30967
Diffstat (limited to 'libmpcodecs/vd_theora.c')
-rw-r--r-- | libmpcodecs/vd_theora.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/libmpcodecs/vd_theora.c b/libmpcodecs/vd_theora.c index 1c69de6df8..ddf81fa5c7 100644 --- a/libmpcodecs/vd_theora.c +++ b/libmpcodecs/vd_theora.c @@ -26,6 +26,8 @@ #include "vd_internal.h" +#include "ffmpeg_files/intreadwrite.h" + static const vd_info_t info = { "Theora/VP3", "theora", @@ -74,6 +76,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; @@ -89,8 +93,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++) { - op.bytes = ds_get_packet (sh->ds, &op.packet); - op.b_o_s = 1; + 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); |