summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-08-18 13:13:41 +0000
committeralex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-08-18 13:13:41 +0000
commitb2b796f466cbba3d5c588c99719bbb1d4df25f56 (patch)
treefeb691144970370be3bc784a298efacabb560fe5
parent2f140634550d0a68b762d9d0f50e715b4ac00d59 (diff)
downloadmpv-b2b796f466cbba3d5c588c99719bbb1d4df25f56.tar.bz2
mpv-b2b796f466cbba3d5c588c99719bbb1d4df25f56.tar.xz
Theora-CVS update patch by Martin Drab <drab@kepler.fjfi.cvut.cz>
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@10659 b3059339-0415-0410-9bf9-f77b7e298cf2
-rwxr-xr-xconfigure40
-rw-r--r--libmpcodecs/vd_theora.c47
-rw-r--r--libmpdemux/demux_ogg.c8
3 files changed, 63 insertions, 32 deletions
diff --git a/configure b/configure
index 825fc6366e..95d2de4622 100755
--- a/configure
+++ b/configure
@@ -4162,14 +4162,48 @@ else
_def_tremor='#undef TREMOR'
_nocodecmodules="libvorbis $_nocodecmodules"
fi
-echores "$_vorbis"
+if test "$_vorbis" = yes -a "$_tremor" = yes ; then
+ echores "$_vorbis (Tremor)"
+else
+ echores "$_vorbis"
+fi
-echocheck "OggTheora support"
+echocheck "OggTheora support (only the CVS version!)"
if test "$_theora" = auto ; then
_theora=no
cat > $TMPC << EOF
#include <theora/theora.h>
-int main(void) { theora_version_number (); return 0; }
+#include <string.h>
+int main(void)
+{
+ /* theora is in flux, make sure that all interface routines and
+ * datatypes exist and work the way we expect it, so we don't break
+ * mplayer */
+ ogg_packet op;
+ theora_comment tc;
+ theora_info inf;
+ theora_state st;
+ yuv_buffer yuv;
+ int r;
+ double t;
+
+ theora_info_init (&inf);
+ theora_comment_init (&tc);
+
+ return 0;
+
+ /* we don't want to execute this kind of nonsense; just for making sure
+ * that compilation works... */
+ memset(&op, 0, sizeof(op));
+ r = theora_decode_header (&inf, &tc, &op);
+ r = theora_decode_init (&st, &inf);
+ t = theora_granule_time (&st, op.granulepos);
+ r = theora_decode_packetin (&st, &op);
+ r = theora_decode_YUVout (&st, &yuv);
+ theora_clear (&st);
+
+ return 0;
+}
EOF
cc_check -ltheora -logg -lm && _theora=yes
fi
diff --git a/libmpcodecs/vd_theora.c b/libmpcodecs/vd_theora.c
index bca8091b14..1f12ca0fc0 100644
--- a/libmpcodecs/vd_theora.c
+++ b/libmpcodecs/vd_theora.c
@@ -23,6 +23,8 @@ LIBVD_EXTERN(theora)
#include <theora/theora.h>
+#define THEORA_NUM_HEADER_PACKETS 3
+
// to set/get/query special features/parameters
static int control(sh_video_t *sh,int cmd,void* arg,...){
return CONTROL_UNKNOWN;
@@ -30,6 +32,7 @@ static int control(sh_video_t *sh,int cmd,void* arg,...){
typedef struct theora_struct_st {
theora_state st;
+ theora_comment cc;
theora_info inf;
} theora_struct_t;
@@ -41,7 +44,7 @@ static int init(sh_video_t *sh){
int failed = 1;
int errorCode = 0;
ogg_packet op;
-// theora_comment tc;
+ int i;
/* check whether video output format is supported */
switch(sh->codec->outfmt[sh->outfmtidx])
@@ -60,35 +63,23 @@ static int init(sh_video_t *sh){
sh->context = context;
if (!context)
break;
-
- /* read initial header */
- op.bytes = ds_get_packet (sh->ds,&op.packet);
- op.b_o_s = 1;
- if((errorCode = theora_decode_header (&context->inf, &op))) {
- mp_msg(MSGT_DECAUDIO,MSGL_ERR,
- "Broken Theora header; erroroCode=%i!\n", errorCode);
- break;
- }
-
- /* decode comment packet */
- op.bytes = ds_get_packet (sh->ds,&op.packet);
- op.b_o_s = 1;
-#if 0
- if((errorCode = theora_decode_comment (&tc, &op))) {
- mp_msg(MSGT_DECVIDEO,MSGL_ERR,
- "Broken Theora comment; erroroCode=%i!\n", errorCode);
- break;
- }
-#endif
- /* decode tables packet */
- op.bytes = ds_get_packet (sh->ds,&op.packet);
- op.b_o_s = 1;
- if((errorCode = theora_decode_tables (&context->inf, &op))) {
- mp_msg(MSGT_DECVIDEO,MSGL_ERR,
- "Broken Theora comment; erroroCode=%i!\n", errorCode);
- break;
+ theora_info_init(&context->inf);
+ theora_comment_init(&context->cc);
+
+ /* 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 ( (errorCode = theora_decode_header (&context->inf, &context->cc, &op)) )
+ {
+ mp_msg(MSGT_DECAUDIO, MSGL_ERR, "Broken Theora header; errorCode=%i!\n", errorCode);
+ break;
+ }
}
+ if (errorCode)
+ break;
/* now init codec */
errorCode = theora_decode_init (&context->st, &context->inf);
diff --git a/libmpdemux/demux_ogg.c b/libmpdemux/demux_ogg.c
index a98a01baf0..902b2419a7 100644
--- a/libmpdemux/demux_ogg.c
+++ b/libmpdemux/demux_ogg.c
@@ -50,6 +50,7 @@ typedef struct ov_struct_st {
#ifdef HAVE_OGGTHEORA
typedef struct theora_struct_st {
theora_state st;
+ theora_comment cc;
theora_info inf;
} theora_struct_t;
#endif
@@ -633,7 +634,12 @@ int demux_ogg_open(demuxer_t* demuxer) {
} else if (pack.bytes >= 7 && !strncmp (&pack.packet[1], "theora", 6)) {
int errorCode = 0;
theora_info inf;
- errorCode = theora_decode_header (&inf, &pack);
+ theora_comment cc;
+
+ theora_info_init (&inf);
+ theora_comment_init (&cc);
+
+ errorCode = theora_decode_header (&inf, &cc, &pack);
if (errorCode)
mp_msg(MSGT_DEMUX,MSGL_ERR,"Theora header parsing failed: %i \n",
errorCode);