[Mplayer-cvslog] CVS: main aviheader.c,1.6,1.7

GEREOFFY arpi_esp at users.sourceforge.net
Sun Apr 22 03:04:20 CEST 2001


Update of /cvsroot/mplayer/main
In directory usw-pr-cvs1:/tmp/cvs-serv11507

Modified Files:
	aviheader.c 
Log Message:
restore keyframes of DivX files (hack)

Index: aviheader.c
===================================================================
RCS file: /cvsroot/mplayer/main/aviheader.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** aviheader.c	2001/04/21 20:44:41	1.6
--- aviheader.c	2001/04/22 01:04:18	1.7
***************
*** 6,9 ****
--- 6,11 ----
  sh_video_t *sh_video=NULL;
  int stream_id=-1;
+ int idxfix_videostream=0;
+ int idxfix_divx=0;
  
  //---- AVI header:
***************
*** 65,68 ****
--- 67,86 ----
  //        sh_video->frametime=(float)sh_video->video.dwScale/(float)sh_video->video.dwRate;
  //        if(demuxer->video->id==-1) demuxer->video->id=stream_id;
+         // IdxFix:
+         idxfix_videostream=stream_id;
+         switch(sh_video->bih->biCompression){
+ 	case mmioFOURCC('D', 'I', 'V', '3'):
+ 	case mmioFOURCC('d', 'i', 'v', '3'):
+ 	case mmioFOURCC('D', 'I', 'V', '4'):
+         case mmioFOURCC('d', 'i', 'v', '4'):
+ 	case mmioFOURCC('D', 'I', 'V', '5'):
+ 	case mmioFOURCC('d', 'i', 'v', '5'):
+ 	case mmioFOURCC('D', 'I', 'V', '6'):
+         case mmioFOURCC('d', 'i', 'v', '6'):
+ 	case mmioFOURCC('M', 'P', '4', '3'):
+ 	case mmioFOURCC('m', 'p', '4', '3'):
+         case mmioFOURCC('A', 'P', '4', '1'):
+           idxfix_divx=1; // we can fix keyframes only for divx coded files!
+         }
        } else
        if(last_fccType==streamtypeAUDIO){
***************
*** 93,97 ****
  }
  
! if(avi_header.idx_size==0 && index_mode==1){
    // build index for file:
    stream_reset(demuxer->stream);
--- 111,115 ----
  }
  
! if(index_mode>=2 || (avi_header.idx_size==0 && index_mode==1)){
    // build index for file:
    stream_reset(demuxer->stream);
***************
*** 123,129 ****
      idx->dwChunkOffset=demuxer->filepos;
      idx->dwChunkLength=len;
!     if(verbose>=2) printf("0x%08X  0x%08X %.4s\n",demuxer->filepos,id,&id);
      skip=(len+1)&(~1); // total bytes in this chunk
!     stream_skip(demuxer->stream,skip);
    }
    avi_header.idx_size=avi_header.idx_pos;
--- 141,165 ----
      idx->dwChunkOffset=demuxer->filepos;
      idx->dwChunkLength=len;
! 
!     // Fix keyframes for DivX files:
!     if(idxfix_divx)
!       if(avi_stream_id(id)==idxfix_videostream){
!         unsigned char c=stream_read_char(demuxer->stream);
! //        --skip;
!         if(!(c&0x40)) idx->dwFlags=0;
!       }
!     
!     if(verbose>=2) printf("0x%08X  0x%08X %.4s  %X\n",demuxer->filepos,id,&id,idx->dwFlags);
! #if 0
!     { unsigned char tmp[64];
!       int i;
!       stream_read(demuxer->stream,tmp,64);
!       printf("%.4s",&id);
!       for(i=0;i<64;i++) printf(" %02X",tmp[i]);
!       printf("\n");
!     }
! #endif
      skip=(len+1)&(~1); // total bytes in this chunk
!     stream_seek(demuxer->stream,8+demuxer->filepos+skip);
    }
    avi_header.idx_size=avi_header.idx_pos;


_______________________________________________
Mplayer-cvslog mailing list
Mplayer-cvslog at lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/mplayer-cvslog



More information about the MPlayer-cvslog mailing list