# HG changeset patch # User rfelker # Date 1109901235 0 # Node ID 07be3bc42d475cc0c4d2416810345ef86462e2c8 # Parent aa6715eaa28cef861ca8dd280c4c550752be5c48 100l to reimar.. sh_audio->samplerate and sh_audio->i_bps are not the same diff -r aa6715eaa28c -r 07be3bc42d47 libmpdemux/demux_audio.c --- 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);