[Mplayer-cvslog] CVS: main/libmpdemux demux_real.c,1.20,1.21

Arpi of Ize arpi at mplayerhq.hu
Wed Aug 14 11:15:47 CEST 2002


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

Modified Files:
	demux_real.c 
Log Message:
RV20 A-V desync fixed - use timestamp hack only for RV30


Index: demux_real.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_real.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- demux_real.c	12 Aug 2002 00:04:37 -0000	1.20
+++ demux_real.c	14 Aug 2002 09:15:31 -0000	1.21
@@ -8,6 +8,9 @@
     TODO: fix the whole syncing mechanism
     
     $Log$
+    Revision 1.21  2002/08/14 09:15:31  arpi
+    RV20 A-V desync fixed - use timestamp hack only for RV30
+
     Revision 1.20  2002/08/12 00:04:37  arpi
     RV40 support
 
@@ -371,9 +374,13 @@
 
 void hexdump(char *, unsigned long);
 
-static float real_fix_timestamp(real_priv_t* priv, unsigned char* s, int timestamp, float frametime){
-    int kf=2*(((s[1]&15)<<8)+s[2]); // 12-bit timestamp from frame header
-    float v_pts;
+static float real_fix_timestamp(real_priv_t* priv, unsigned char* s, int timestamp, float frametime, unsigned int format){
+  float v_pts;
+  int kf=timestamp;
+  if(format==0x30335652){ // RV30 timestamps:
+    kf=2*(((s[1]&15)<<8)+s[2]); // 12-bit timestamp from frame header
+    //kf=((s[1]<<8)+s[2])>>3; // 12-bit timestamp from frame header
+    printf("\nTS: %08X (%04X) %02X %02X %02X %02X\n",timestamp,kf,s[0],s[1],s[2],s[3]);
     kf|=timestamp&(~0x1fff);	// combine with packet timestamp
     if(kf<timestamp-4096) kf+=8192; else // workaround wrap-around problems
     if(kf>timestamp+4096) kf-=8192;
@@ -383,6 +390,7 @@
 	priv->kf_pts=tmp;
 //	if(kf<=tmp) kf=0;
     }
+  }
     v_pts=kf*0.001f;
     if(v_pts<priv->v_pts || !kf) v_pts=priv->v_pts+frametime;
     priv->v_pts=v_pts;
@@ -603,7 +611,7 @@
 			// this fragment is for new packet, close the old one
 			mp_msg(MSGT_DEMUX,MSGL_DBG2, "closing probably incomplete packet, len: %d  \n",dp->len);
 			dp->pts=(dp->len<3)?0:
-			    real_fix_timestamp(priv,dp->buffer,timestamp,sh_video->frametime);
+			    real_fix_timestamp(priv,dp->buffer,timestamp,sh_video->frametime,sh_video->format);
 			ds_add_packet(ds,dp);
 			ds->asf_packet=NULL;
 		    } else {
@@ -627,7 +635,7 @@
  			    mp_dbg(MSGT_DEMUX,MSGL_DBG2, "fragment (%d bytes) appended, %d bytes left\n",vpkg_offset,len);
 			    // we know that this is the last fragment -> we can close the packet!
 			    dp->pts=(dp->len<3)?0:
-				real_fix_timestamp(priv,dp->buffer,extra[1],sh_video->frametime);
+				real_fix_timestamp(priv,dp->buffer,extra[1],sh_video->frametime,sh_video->format);
 			    ds_add_packet(ds,dp);
 			    ds->asf_packet=NULL;
 			    // continue parsing
@@ -666,7 +674,7 @@
 		dp->len=vpkg_length; len-=vpkg_length;
 		stream_read(demuxer->stream, dp->buffer, dp->len);
 		dp->pts=(dp->len<3)?0:
-		    real_fix_timestamp(priv,dp->buffer,extra[1],sh_video->frametime);
+		    real_fix_timestamp(priv,dp->buffer,extra[1],sh_video->frametime,sh_video->format);
 		ds_add_packet(ds,dp);
 
 	    } // while(len>0)




More information about the MPlayer-cvslog mailing list