[Mplayer-cvslog] CVS: main/libmpcodecs vd_theora.c,1.2,1.3
Alex Beregszaszi
alex at mplayerhq.hu
Mon Aug 18 15:13:55 CEST 2003
Update of /cvsroot/mplayer/main/libmpcodecs
In directory mail:/var/tmp.root/cvs-serv30297/libmpcodecs
Modified Files:
vd_theora.c
Log Message:
Theora-CVS update patch by Martin Drab <drab at kepler.fjfi.cvut.cz>
Index: vd_theora.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vd_theora.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- vd_theora.c 6 Jun 2003 19:19:23 -0000 1.2
+++ vd_theora.c 18 Aug 2003 13:13:41 -0000 1.3
@@ -23,6 +23,8 @@
#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 @@
typedef struct theora_struct_st {
theora_state st;
+ theora_comment cc;
theora_info inf;
} theora_struct_t;
@@ -41,7 +44,7 @@
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 @@
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);
More information about the MPlayer-cvslog
mailing list