# HG changeset patch # User arpi # Date 1004560993 0 # Node ID a937f00245147c0b9a6e0d35259bcb28bdf9ba83 # Parent dfb13228e18bb36f5c522875026171487d5a60e3 -idx fixes: support for divx4 and ignoring bad movi_end diff -r dfb13228e18b -r a937f0024514 libmpdemux/aviheader.c --- a/libmpdemux/aviheader.c Wed Oct 31 20:15:19 2001 +0000 +++ b/libmpdemux/aviheader.c Wed Oct 31 20:43:13 2001 +0000 @@ -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_startmovi_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;