[MPlayer-cvslog] r30932 - trunk/libmpcodecs/vd_theora.c
aurel
subversion at mplayerhq.hu
Thu Mar 18 22:53:02 CET 2010
Author: aurel
Date: Thu Mar 18 22:53:02 2010
New Revision: 30932
Log:
add support for lavf style extradata in vd_theora
Modified:
trunk/libmpcodecs/vd_theora.c
Modified: trunk/libmpcodecs/vd_theora.c
==============================================================================
--- trunk/libmpcodecs/vd_theora.c Thu Mar 18 21:57:49 2010 (r30931)
+++ trunk/libmpcodecs/vd_theora.c Thu Mar 18 22:53:02 2010 (r30932)
@@ -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 cm
*/
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);
More information about the MPlayer-cvslog
mailing list