[Mplayer-cvslog] CVS: main/libmpdemux aviheader.c,1.30,1.31

Arpi of Ize arpi at mplayer.dev.hu
Wed Oct 31 21:43:29 CET 2001


Update of /cvsroot/mplayer/main/libmpdemux
In directory mplayer:/var/tmp.root/cvs-serv23084

Modified Files:
	aviheader.c 
Log Message:
-idx fixes: support for divx4 and ignoring bad movi_end

Index: aviheader.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/aviheader.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- aviheader.c	21 Oct 2001 15:47:31 -0000	1.30
+++ aviheader.c	31 Oct 2001 20:43:13 -0000	1.31
@@ -122,6 +122,13 @@
 	case mmioFOURCC('D', 'I', 'V', '2'):
         case mmioFOURCC('A', 'P', '4', '1'):
           idxfix_divx=1; // we can fix keyframes only for divx coded files!
+	  mp_msg(MSGT_HEADER,MSGL_V,"Regenerating keyframe table for DIVX 3 video\n");
+	  break;
+        case mmioFOURCC('D', 'I', 'V', 'X'):
+        case mmioFOURCC('d', 'i', 'v', 'x'):
+          idxfix_divx=2; // we can fix keyframes only for divx coded files!
+	  mp_msg(MSGT_HEADER,MSGL_V,"Regenerating keyframe table for DIVX 4 video\n");
+	  break;
         }
       } else
       if(last_fccType==streamtypeAUDIO){
@@ -181,9 +188,9 @@
   while(1){
     int id,len,skip;
     AVIINDEXENTRY* idx;
-    unsigned char c;
+    unsigned int c;
     demuxer->filepos=stream_tell(demuxer->stream);
-    if(demuxer->filepos>=demuxer->movi_end) break;
+    if(demuxer->filepos>=demuxer->movi_end && demuxer->movi_start<demuxer->movi_end) break;
     id=stream_read_dword_le(demuxer->stream);
     len=stream_read_dword_le(demuxer->stream);
     if(id==mmioFOURCC('L','I','S','T')){
@@ -205,15 +212,17 @@
     idx->dwChunkOffset=demuxer->filepos;
     idx->dwChunkLength=len;
     
-    c=stream_read_char(demuxer->stream);
+    c=stream_read_dword(demuxer->stream);
 
     // Fix keyframes for DivX files:
     if(idxfix_divx)
       if(avi_stream_id(id)==idxfix_videostream){
-        if(c&0x40) idx->dwFlags=0;
+        switch(idxfix_divx){
+    	    case 1: if(c&0x40000000) idx->dwFlags=0;break; // divx 3
+	    case 2: if(c==0x1B6) idx->dwFlags=0;break; // divx 4
+	}
       }
-    
-    mp_dbg(MSGT_HEADER,MSGL_DBG2,"%08X %08X %.4s %02X %X\n",demuxer->filepos,id,(char *) &id,c,(unsigned int) idx->dwFlags);
+    mp_dbg(MSGT_HEADER,MSGL_DBG2,"%08X %08X %.4s %08X %X\n",(int)demuxer->filepos,id,(char *) &id,(int)c,(unsigned int) idx->dwFlags);
 #if 0
     { unsigned char tmp[64];
       int i;




More information about the MPlayer-cvslog mailing list