Mercurial > mplayer.hg
comparison libmpdemux/demux_audio.c @ 8056:324b6e5387be
A-V sync cleanup: sh_audio->timer replaced by sh_audio->delay, it contains
delay relative to sh_video->timer (or to 0 if audioonly).
It fixes ct: drifts of very long (several hours) playback.
author | arpi |
---|---|
date | Sat, 02 Nov 2002 19:52:59 +0000 |
parents | 3dc0b71630ff |
children | 884d233c25d5 |
comparison
equal
deleted
inserted
replaced
8055:79ddb7291765 | 8056:324b6e5387be |
---|---|
293 len = priv->last_pts + len; | 293 len = priv->last_pts + len; |
294 priv->last_pts = 0; | 294 priv->last_pts = 0; |
295 } | 295 } |
296 if(len > 0) | 296 if(len > 0) |
297 high_res_mp3_seek(demuxer,len); | 297 high_res_mp3_seek(demuxer,len); |
298 sh_audio->timer = priv->last_pts - (ds_tell_pts(demuxer->audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; | 298 sh_audio->delay = priv->last_pts - (ds_tell_pts(demuxer->audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; |
299 resync_audio_stream(sh_audio); | 299 resync_audio_stream(sh_audio); |
300 return; | 300 return; |
301 } | 301 } |
302 | 302 |
303 base = flags&1 ? demuxer->movi_start : stream_tell(s); | 303 base = flags&1 ? demuxer->movi_start : stream_tell(s); |
305 pos = base + ((demuxer->movi_end - demuxer->movi_start)*rel_seek_secs); | 305 pos = base + ((demuxer->movi_end - demuxer->movi_start)*rel_seek_secs); |
306 else | 306 else |
307 pos = base + (rel_seek_secs*sh_audio->i_bps); | 307 pos = base + (rel_seek_secs*sh_audio->i_bps); |
308 | 308 |
309 if(demuxer->movi_end && pos >= demuxer->movi_end) { | 309 if(demuxer->movi_end && pos >= demuxer->movi_end) { |
310 sh_audio->timer = (stream_tell(s) - demuxer->movi_start)/(float)sh_audio->i_bps; | 310 sh_audio->delay = (stream_tell(s) - demuxer->movi_start)/(float)sh_audio->i_bps; |
311 return; | 311 return; |
312 } else if(pos < demuxer->movi_start) | 312 } else if(pos < demuxer->movi_start) |
313 pos = demuxer->movi_start; | 313 pos = demuxer->movi_start; |
314 | 314 |
315 priv->last_pts = (pos-demuxer->movi_start)/(float)sh_audio->i_bps; | 315 priv->last_pts = (pos-demuxer->movi_start)/(float)sh_audio->i_bps; |
316 sh_audio->timer = priv->last_pts - (ds_tell_pts(demuxer->audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; | 316 sh_audio->delay = priv->last_pts - (ds_tell_pts(demuxer->audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; |
317 | 317 |
318 switch(priv->frmt) { | 318 switch(priv->frmt) { |
319 case WAV: | 319 case WAV: |
320 pos -= (pos % (sh_audio->channels * sh_audio->samplesize) ); | 320 pos -= (pos % (sh_audio->channels * sh_audio->samplesize) ); |
321 // We need to decrease the pts by one step to make it the "last one" | 321 // We need to decrease the pts by one step to make it the "last one" |