[MPlayer-G2-dev] CVS: g2/demux demux_asf.c, 1.1.1.1, 1.2 demux_avi.c, 1.4, 1.5 demux_mpeg.c, 1.1.1.1, 1.2 demux_ogg.c, 1.2, 1.3

Arpi of Ize syncmail at mplayerhq.hu
Sun Feb 22 17:19:09 CET 2004


CVS change done by Arpi of Ize

Update of /cvsroot/mplayer/g2/demux
In directory mail:/var2/tmp/cvs-serv28061/demux

Modified Files:
	demux_asf.c demux_avi.c demux_mpeg.c demux_ogg.c 
Log Message:
- demuxer: changed PTS handling, export native PTS (based on rate_m/rate_d)
instead of scaled up by rate_m
- demux_avi: fixed nobps sync mode, when video chunkc come before audio ones
- demux_mpg: div native pts by 4, to fit 33 bits pts into 31 bits (signed int)


Index: demux_asf.c
===================================================================
RCS file: /cvsroot/mplayer/g2/demux/demux_asf.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- demux_asf.c	31 Jan 2004 20:16:18 -0000	1.1.1.1
+++ demux_asf.c	22 Feb 2004 16:19:07 -0000	1.2
@@ -440,7 +440,7 @@
       switch(ASF_LOAD_GUID_PREFIX(streamh.type)){
       case ASF_GUID_PREFIX_audio_stream: {
         demux_stream_t* ds=new_demuxer_stream(demuxer,streamh.stream_no & 0x7F,DEMUX_STREAM_TYPE_AUDIO);
-	ds->rate_m=1000; // PTS is 1/1000 seconds based
+	ds->rate_d=1;ds->rate_m=1000; // PTS is 1/1000 seconds based
 	ds->priv=calloc(sizeof(struct demux_stream_priv_s),1);
 	ds->ms_header_size=(streamh.type_size<sizeof(WAVEFORMATEX))?sizeof(WAVEFORMATEX):streamh.type_size;
 	ds->ms_header=calloc(ds->ms_header_size,1);
@@ -464,7 +464,7 @@
       case ASF_GUID_PREFIX_video_stream: {
         demux_stream_t* ds=new_demuxer_stream(demuxer,streamh.stream_no & 0x7F,DEMUX_STREAM_TYPE_VIDEO);
         unsigned int len=streamh.type_size-(4+4+1+2);
-	ds->rate_m=1000; // PTS is 1/1000 seconds based
+	ds->rate_d=1;ds->rate_m=1000; // PTS is 1/1000 seconds based
 	ds->priv=calloc(sizeof(struct demux_stream_priv_s),1);
 	ds->ms_header_size=(len<sizeof(BITMAPINFOHEADER))?sizeof(BITMAPINFOHEADER):len;
 	ds->ms_header=calloc(ds->ms_header_size,1);

Index: demux_avi.c
===================================================================
RCS file: /cvsroot/mplayer/g2/demux/demux_avi.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- demux_avi.c	22 Feb 2004 00:03:56 -0000	1.4
+++ demux_avi.c	22 Feb 2004 16:19:07 -0000	1.5
@@ -68,18 +68,18 @@
 	      float delay=0;
 	      if(ds->bitrate)
 	          delay=ds->priv->pts_corr_bytes*8/(float)ds->bitrate;
-	      mp_msg(MSGT_DEMUX,MSGL_V,"XXX initial  v_pts=%5.3f  a_pos=%d (%5.3f) \n",ds->priv->avi_audio_pts,ds->priv->pts_corr_bytes,delay);
 	      //priv->pts_correction=-priv->avi_audio_pts+delay;
-	      ds->priv->pts_correction=delay*(float)ds->rate_m-ds->priv->avi_audio_pts;
-	      ds->priv->avi_audio_pts+=ds->priv->pts_correction;
+	      ds->priv->pts_correction=(delay - demux->priv->avi_video_pts)*(float)ds->rate_m/(float)ds->rate_d;
+	      mp_msg(MSGT_DEMUX,MSGL_V,"XXX initial  v_pts=%5.8f  a_pos=%d (%5.8f) corr=%d  \n",demux->priv->avi_video_pts,ds->priv->pts_corr_bytes,delay,ds->priv->pts_correction);
+//	      ds->priv->avi_audio_pts+=ds->priv->pts_correction;
 	      ds->priv->pts_corrected=1;
 	  } else
 	      ds->priv->pts_corr_bytes+=len;
       }
       if(pts_from_bps){
-	  pts = ds->priv->audio_block_no * (float)ds->rate_d; // / (float)ds->rate_m;
+	  pts = ds->priv->audio_block_no;
       } else {
-	  pts=demux->priv->avi_video_pts*(float)ds->rate_m;
+	  pts=demux->priv->avi_video_pts*(float)ds->rate_m/(float)ds->rate_d;
 	  pts+=ds->priv->pts_correction;
 	  if(pts==ds->priv->avi_audio_pts)
 	      pts=0;
@@ -101,10 +101,9 @@
        ++ds->priv->video_pack_no;
        ds=NULL;
      } else {
-       pts = ds->priv->video_pack_no * ds->rate_d;
-       demux->priv->avi_video_pts = ds->priv->video_pack_no *
-         (float)ds->rate_d/(float)ds->rate_m;
-//          printf("\rYYY-V  A: %5.3f  V: %5.3f  \n",priv->avi_audio_pts,priv->avi_video_pts);
+       pts = ds->priv->video_pack_no;
+       demux->priv->avi_video_pts = pts * (float)ds->rate_d/(float)ds->rate_m;
+//       printf("\rYYY-V  Vpts: %5.8f  \n",demux->priv->avi_video_pts);
        demux->priv->pts_has_video=1;
        ++ds->priv->video_pack_no;
      }
@@ -118,7 +117,7 @@
   
   if(ds && !ds->ignore){
     mp_dbg(MSGT_DEMUX,MSGL_DBG2,"DEMUX_AVI: Read %d data bytes from packet %04X\n",len,id);
-//    printf("READ[%c] %5.3f  (%d)   \n",ds==demux->video?'V':'A',pts,len);
+//    printf("READ[%d] %d  (%d)   \n",ds->type,pts,len);
     ds_read_packet(ds,demux->stream,len,pts,idxpos,flags);
     skip-=len;
   }

Index: demux_mpeg.c
===================================================================
RCS file: /cvsroot/mplayer/g2/demux/demux_mpeg.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- demux_mpeg.c	31 Jan 2004 20:16:18 -0000	1.1.1.1
+++ demux_mpeg.c	22 Feb 2004 16:19:07 -0000	1.2
@@ -140,7 +140,8 @@
     ++mpeg_pts_error;
     return 0; // invalid pts
   }
-  pts=(((c>>1)&7)<<30)|((d>>1)<<15)|(e>>1); // 33 bits, MSB lost
+//  pts=(((c>>1)&7)<<30)|((d>>1)<<15)|(e>>1); // 33 bits, 1 MSB lost
+  pts=(((c>>1)&7)<<28)|((d>>1)<<13)|((e>>1)>>2); // 31 bits, 2 LSB lost
   mp_dbg(MSGT_DEMUX,MSGL_DBG3,"{%d}",pts);
   return pts;
 }
@@ -354,7 +355,8 @@
     if(!ds){
 	// register new stream!
 	ds=new_demuxer_stream(demuxer, (pid<0) ? id : pid, type);
-	ds->rate_m=90000; // PTS base
+	ds->rate_d=1;
+	ds->rate_m=90000/4; // PTS base
 	ds->format=format;
 	ds->flags|=ds_flags;
 	ds->priv=calloc(sizeof(struct demux_stream_priv_s),1);

Index: demux_ogg.c
===================================================================
RCS file: /cvsroot/mplayer/g2/demux/demux_ogg.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- demux_ogg.c	31 Jan 2004 22:27:11 -0000	1.2
+++ demux_ogg.c	22 Feb 2004 16:19:07 -0000	1.3
@@ -251,7 +251,7 @@
 	    if(granule_pos){
 		// we have a pts!
 		if(ds->rate_m)
-		    dp->pts=(granule_pos+1)*(double)ds->rate_d;
+		    dp->pts=(granule_pos+1); //*(double)ds->rate_d;
 		//    dp->pts=(granule_pos+1)*(double)ds->rate_d/(double)ds->rate_m;
 		//printf("OGG: #%d %8d  %5.3f\n",ds->id,(int)granule_pos,(float)dp->pts);
 		granule_pos=0; // !!!!!!!




More information about the MPlayer-G2-dev mailing list