changeset 14910:07be3bc42d47

100l to reimar.. sh_audio->samplerate and sh_audio->i_bps are not the same
author rfelker
date Fri, 04 Mar 2005 01:53:55 +0000
parents aa6715eaa28c
children 6a8b15582f64
files libmpdemux/demux_audio.c
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_audio.c	Thu Mar 03 23:02:45 2005 +0000
+++ b/libmpdemux/demux_audio.c	Fri Mar 04 01:53:55 2005 +0000
@@ -397,6 +397,7 @@
 	dp = new_demux_packet(l);
 	memcpy(dp->buffer,hdr,4);
 	stream_read(s,dp->buffer + 4,l-4);
+	priv->last_pts = priv->last_pts < 0 ? 0 : priv->last_pts + 1152/(float)sh_audio->samplerate; // FIXME: 1152->576 if MPEG-2
 	break;
       }
     } break;
@@ -404,12 +405,14 @@
     l = sh_audio->wf->nAvgBytesPerSec;
     dp = new_demux_packet(l);
     l = stream_read(s,dp->buffer,l);
+    priv->last_pts = priv->last_pts < 0 ? 0 : priv->last_pts + l/(float)sh_audio->i_bps;
     break;
   }
   case fLaC: {
     l = 65535;
     dp = new_demux_packet(l);
     l = stream_read(s,dp->buffer,l);
+    priv->last_pts = priv->last_pts < 0 ? 0 : priv->last_pts + l/(float)sh_audio->i_bps;
     break;
   }
   default:
@@ -418,10 +421,6 @@
   }
 
   resize_demux_packet(dp, l);
-  if (priv->last_pts < 0)
-    priv->last_pts = 0;
-  else
-    priv->last_pts += l/(float)sh_audio->i_bps;
   ds->pts = priv->last_pts - (ds_tell_pts(demux->audio) -
               sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps;
   ds_add_packet(ds, dp);