[MPlayer-cvslog] CVS: main mplayer.c,1.940,1.941

Roberto Togni CVS syncmail at mplayerhq.hu
Mon Apr 24 12:58:42 CEST 2006


CVS change done by Roberto Togni CVS

Update of /cvsroot/mplayer/main
In directory mail:/var2/tmp/cvs-serv7324

Modified Files:
	mplayer.c 
Log Message:
4 - Implement a better way to calculate current audio pts and use it for
audio decoded with ad_libvorbis, ad_ffmpeg and ad_faad.

Patch by Uoti Urpala


Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.940
retrieving revision 1.941
diff -u -r1.940 -r1.941
--- mplayer.c	24 Apr 2006 10:26:19 -0000	1.940
+++ mplayer.c	24 Apr 2006 10:58:39 -0000	1.941
@@ -3874,6 +3874,7 @@
       delay=sh_audio->delay;
       delay+=(float)sh_audio->a_buffer_len/(float)sh_audio->o_bps;
     }
+    delay += sh_audio->a_out_buffer_len*playback_speed/(float)ao_data.bps;
 
 #if 0
     if(pts_from_bps){
@@ -3890,16 +3891,15 @@
 #endif
     {
       // PTS = (last timestamp) + (bytes after last timestamp)/(bytes per sec)
-      a_pts=d_audio->pts;
-      if(!delay_corrected) if(a_pts) delay_corrected=1;
-#if 0
-      mp_msg(MSGT_FIXME, MSGL_FIXME, "\n#X# pts=%5.3f ds_pts=%5.3f buff=%5.3f total=%5.3f\n",
-          a_pts,
-	  ds_tell_pts(d_audio)/(float)sh_audio->i_bps,
-	  -sh_audio->a_in_buffer_len/(float)sh_audio->i_bps,
-	  a_pts+(ds_tell_pts(d_audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps);
-#endif	  
-      a_pts+=(ds_tell_pts(d_audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps - sh_audio->a_out_buffer_len*playback_speed/(float)ao_data.bps;
+      a_pts = sh_audio->pts;
+      if (a_pts == MP_NOPTS_VALUE) {
+	  // Decoder doesn't support tracking timestamps or demuxer doesn't
+	  // set them properly in individual packets, use old inaccurate method
+	  a_pts=d_audio->pts;
+	  a_pts+=(ds_tell_pts(d_audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps;
+      }
+      else
+	  a_pts += sh_audio->pts_bytes / (float)sh_audio->o_bps;
     }
     v_pts=sh_video ? sh_video->pts : d_video->pts;
 




More information about the MPlayer-cvslog mailing list