[Mplayer-cvslog] CVS: main/libmpdemux demux_avi.c,1.41,1.42 demuxer.c,1.101,1.102 demuxer.h,1.41,1.42

Arpi of Ize arpi at mplayerhq.hu
Fri Aug 2 19:44:19 CEST 2002


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

Modified Files:
	demux_avi.c demuxer.c demuxer.h 
Log Message:
count blocks by rounded-up chunksizes instead of chunks -
we need full emulation of dshow avi demuxer bugs :(
fixes silly nandub-style a-v delaying in avi with vbr mp3...


Index: demux_avi.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_avi.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- demux_avi.c	26 Jul 2002 12:36:13 -0000	1.41
+++ demux_avi.c	2 Aug 2002 17:44:16 -0000	1.42
@@ -33,6 +33,8 @@
       if(!demux->audio->sh){
         demux->audio->sh=demux->a_streams[stream_id];
         mp_msg(MSGT_DEMUX,MSGL_V,"Auto-selected AVI audio ID = %d\n",demux->audio->id);
+	demux->audio->block_size=((sh_audio_t*)(demux->audio->sh))->wf->nBlockAlign;
+	//printf("&&&&& setting blocksize to %d &&&&&\n",demux->audio->block_size);
       }
       return demux->audio;
   }
@@ -602,6 +604,7 @@
 // ------------ STEP 2: seek audio, find the right chunk & pos ------------
 
       d_audio->pack_no=0;
+      d_audio->block_no=0;
       d_audio->dpos=0;
 
       if(sh_audio){
@@ -636,6 +639,7 @@
             if(avi_stream_id(id)==d_audio->id){
                 len=((AVIINDEXENTRY *)priv->idx)[i].dwChunkLength;
                 ++d_audio->pack_no;
+		d_audio->block_no+=(len+d_audio->block_size-1)/d_audio->block_size;
                 if(d_audio->dpos<=curr_audio_pos && curr_audio_pos<(d_audio->dpos+len)){
                   break;
                 }
@@ -662,10 +666,12 @@
 		  skip_audio_bytes+=len;
 		} else {
 		  ++d_audio->pack_no;
+		  d_audio->block_no+=(len+d_audio->block_size-1)/d_audio->block_size;
                   d_audio->dpos+=len;
 		  audio_chunk_pos=i;
 		}
-		--chunks;
+//		--chunks;
+		chunks-=(len+d_audio->block_size-1)/d_audio->block_size;
             }
           }
 	  //if(audio_chunk_pos>chunk_max) audio_chunk_pos=chunk_max;

Index: demuxer.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demuxer.c,v
retrieving revision 1.101
retrieving revision 1.102
diff -u -r1.101 -r1.102
--- demuxer.c	26 Jul 2002 12:36:13 -0000	1.101
+++ demuxer.c	2 Aug 2002 17:44:16 -0000	1.102
@@ -35,6 +35,7 @@
   ds->pos=0;
   ds->dpos=0;
   ds->pack_no=0;
+  ds->block_no=0;
 //---------------
   ds->packs=0;
   ds->bytes=0;
@@ -46,6 +47,7 @@
   ds->asf_packet=NULL;
 //----------------
   ds->ss_mul=ds->ss_div=1;
+  ds->block_size=1;
 //----------------
   ds->sh=NULL;
   return ds;
@@ -320,6 +322,7 @@
       ds->pos=p->pos;
       ds->dpos+=p->len; // !!!
       ++ds->pack_no;
+      ds->block_no+=(p->len+ds->block_size-1)/ds->block_size;
       if(p->pts){
         ds->pts=p->pts;
         ds->pts_bytes=0;

Index: demuxer.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demuxer.h,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- demuxer.h	11 Jun 2002 14:29:51 -0000	1.41
+++ demuxer.h	2 Aug 2002 17:44:16 -0000	1.42
@@ -67,6 +67,7 @@
   off_t pos;                 // position in the input stream (file)
   off_t dpos;                // position in the demuxed stream
   int pack_no;		   // serial number of packet
+  int block_no;            // number of <=block_size length blocks (for VBR mp3)
   int flags;               // flags of current packet (keyframe etc)
 //---------------
   int packs;              // number of packets in buffer
@@ -81,6 +82,8 @@
   int asf_seq;
 // ---- mov -----
   unsigned int ss_mul,ss_div;
+// ---- avi -----
+  unsigned int block_size;
 // ---- stream header ----
   void* sh;
 } demux_stream_t;




More information about the MPlayer-cvslog mailing list