changeset 7085:02aa64b49b70

some files has some shit before teh audio/video headers...
author arpi
date Sun, 25 Aug 2002 00:07:15 +0000
parents ffd4c6024cdb
children f0886fe4be89
files libmpdemux/demux_real.c
diffstat 1 files changed, 22 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_real.c	Sat Aug 24 23:07:34 2002 +0000
+++ b/libmpdemux/demux_real.c	Sun Aug 25 00:07:15 2002 +0000
@@ -8,6 +8,9 @@
     TODO: fix the whole syncing mechanism
     
     $Log$
+    Revision 1.24  2002/08/25 00:07:15  arpi
+    some files has some shit before teh audio/video headers...
+
     Revision 1.23  2002/08/24 23:07:34  arpi
     10l - fixed chunktab size calculation
 
@@ -885,9 +888,23 @@
 		codec_pos = stream_tell(demuxer->stream);
 
 		tmp = stream_read_dword(demuxer->stream);
+		
+		mp_msg(MSGT_DEMUX,MSGL_DBG2,"demux_real: type_spec: len=%d  fpos=0x%X  first_dword=0x%X (%.4s)  \n",
+		    (int)codec_data_size,(int)codec_pos,tmp,&tmp);
+
+#if 1
+		// skip unknown shit - FIXME: find a better/cleaner way!
+		{   int len=codec_data_size;
+		    while(--len>=8){
+			if(tmp==MKTAG(0xfd, 'a', 'r', '.')) break; // audio
+			if(tmp==MKTAG('O', 'D', 'I', 'V')) break;  // video
+			tmp=(tmp<<8)|stream_read_char(demuxer->stream);
+		    }
+		}
+#endif
 
 #define stream_skip(st,siz) { int i; for(i=0;i<siz;i++) mp_msg(MSGT_DEMUX,MSGL_V," %02X",stream_read_char(st)); mp_msg(MSGT_DEMUX,MSGL_V,"\n");}
-
+		
 		if (tmp == MKTAG(0xfd, 'a', 'r', '.'))
 		{
 		    /* audio header */
@@ -1036,18 +1053,11 @@
 		}
 		else
 //		case MKTAG('V', 'I', 'D', 'O'):
+		if(tmp == MKTAG('O', 'D', 'I', 'V'))
 		{
 		    /* video header */
 		    sh_video_t *sh = new_sh_video(demuxer, stream_id);
 
-		    tmp = stream_read_dword_le(demuxer->stream);
-		    mp_msg(MSGT_DEMUX,MSGL_V,"video: %.4s (%x)\n", (char *)&tmp, tmp);
-		    if (tmp != MKTAG('V', 'I', 'D', 'O'))
-		    {
-			mp_msg(MSGT_DEMUX, MSGL_ERR, "Not audio/video stream or unsupported!\n");
-			goto skip_this_chunk;
-		    }
-		    
 		    sh->format = stream_read_dword_le(demuxer->stream); /* fourcc */
 		    mp_msg(MSGT_DEMUX,MSGL_V,"video fourcc: %.4s (%x)\n", (char *)&sh->format, sh->format);
 
@@ -1127,6 +1137,9 @@
 		    }
 //	    	    priv->current_vid = stream_id;
 		}
+		else {
+		    mp_msg(MSGT_DEMUX, MSGL_ERR, "Not audio/video stream or unsupported!\n");
+		}
 //		break;
 //	    default:
 skip_this_chunk: