[Mplayer-cvslog] CVS: main aviheader.c,1.5,1.6 mplayer.c,1.88,1.89
GEREOFFY
arpi_esp at users.sourceforge.net
Sat Apr 21 22:44:44 CEST 2001
Update of /cvsroot/mplayer/main
In directory usw-pr-cvs1:/tmp/cvs-serv8302
Modified Files:
aviheader.c mplayer.c
Log Message:
seeking in raw/broken avi files (rebuilding index chunk)
Index: aviheader.c
===================================================================
RCS file: /cvsroot/mplayer/main/aviheader.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** aviheader.c 2001/04/15 14:45:15 1.5
--- aviheader.c 2001/04/21 20:44:41 1.6
***************
*** 2,6 ****
#define MIN(a,b) (((a)<(b))?(a):(b))
! void read_avi_header(int no_index){
sh_audio_t *sh_audio=NULL;
sh_video_t *sh_video=NULL;
--- 2,6 ----
#define MIN(a,b) (((a)<(b))?(a):(b))
! void read_avi_header(int index_mode){
sh_audio_t *sh_audio=NULL;
sh_video_t *sh_video=NULL;
***************
*** 77,81 ****
break;
}
! case ckidAVINEWINDEX: if(!no_index){
avi_header.idx_size=size2>>4;
if(verbose>=1) printf("Reading INDEX block, %d chunks for %d frames\n",
--- 77,81 ----
break;
}
! case ckidAVINEWINDEX: if(index_mode){
avi_header.idx_size=size2>>4;
if(verbose>=1) printf("Reading INDEX block, %d chunks for %d frames\n",
***************
*** 91,94 ****
--- 91,132 ----
if(chunksize<0) printf("WARNING!!! chunksize=%d (id=%.4s)\n",chunksize,&id);
+ }
+
+ if(avi_header.idx_size==0 && index_mode==1){
+ // build index for file:
+ stream_reset(demuxer->stream);
+ stream_seek(demuxer->stream,avi_header.movi_start);
+
+ avi_header.idx_pos=0;
+ avi_header.idx=NULL;
+
+ while(1){
+ int id,len,skip;
+ AVIINDEXENTRY* idx;
+ demuxer->filepos=stream_tell(demuxer->stream);
+ if(demuxer->filepos>=avi_header.movi_end) break;
+ id=stream_read_dword_le(demuxer->stream);
+ len=stream_read_dword_le(demuxer->stream);
+ if(id==mmioFOURCC('L','I','S','T')){
+ id=stream_read_dword_le(demuxer->stream); // list type
+ continue;
+ }
+ if(stream_eof(demuxer->stream)) break;
+ if(avi_header.idx_pos<=avi_header.idx_size){
+ avi_header.idx_size+=32;
+ avi_header.idx=realloc(avi_header.idx,avi_header.idx_size*sizeof(AVIINDEXENTRY));
+ if(!avi_header.idx){avi_header.idx_pos=0; break;} // error!
+ }
+ idx=&avi_header.idx[avi_header.idx_pos++];
+ idx->ckid=id;
+ idx->dwFlags=AVIIF_KEYFRAME; // FIXME
+ 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;
+ printf("AVI: Generated index table for %d chunks!\n",avi_header.idx_size);
}
Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.88
retrieving revision 1.89
diff -C2 -r1.88 -r1.89
*** mplayer.c 2001/04/21 17:31:32 1.88
--- mplayer.c 2001/04/21 20:44:41 1.89
***************
*** 476,480 ****
int vcd_cache_size=128;
#endif
! int no_index=0;
#ifdef AVI_SYNC_BPS
int pts_from_bps=1;
--- 476,480 ----
int vcd_cache_size=128;
#endif
! int index_mode=-1; // -1=untouched 0=don't use index 1=use (geneate) index
#ifdef AVI_SYNC_BPS
int pts_from_bps=1;
***************
*** 721,725 ****
case DEMUXER_TYPE_AVI: {
//---- AVI header:
! read_avi_header(no_index);
stream_reset(demuxer->stream);
stream_seek(demuxer->stream,avi_header.movi_start);
--- 721,725 ----
case DEMUXER_TYPE_AVI: {
//---- AVI header:
! read_avi_header(index_mode);
stream_reset(demuxer->stream);
stream_seek(demuxer->stream,avi_header.movi_start);
_______________________________________________
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