mirror of https://github.com/odrling/Aegisub
FIXME comments in (almost) all audio players, neither handle time reporting fully correct: they report number of samples they have played plus start sample, instead of current sample being heard, ie. they don't take into account that the current position might get changed in mid-stream by the video player to resync audio to video.
Originally committed to SVN as r1175.
This commit is contained in:
parent
e46b57ca86
commit
b9298b61e4
|
@ -397,6 +397,8 @@ __int64 AlsaPlayer::GetEndPosition()
|
|||
// Get current position
|
||||
__int64 AlsaPlayer::GetCurrentPosition()
|
||||
{
|
||||
// FIXME: this should be based on not duration played but actual sample being heard
|
||||
// (during vidoeo playback, cur_frame might get changed to resync)
|
||||
snd_pcm_sframes_t delay = 0;
|
||||
snd_pcm_delay(pcm_handle, &delay); // don't bother catching errors here
|
||||
return cur_frame - delay;
|
||||
|
|
|
@ -395,6 +395,8 @@ __int64 DirectSoundPlayer::GetCurrentPosition() {
|
|||
// Check if buffer is loaded
|
||||
if (!buffer || !playing) return 0;
|
||||
|
||||
// FIXME: this should be based on not duration played but actual sample being heard
|
||||
// (during vidoeo playback, cur_frame might get changed to resync)
|
||||
DWORD curtime = GetTickCount();
|
||||
__int64 tdiff = curtime - startTime;
|
||||
return startPos + tdiff * provider->GetSampleRate() / 1000;
|
||||
|
|
|
@ -384,6 +384,8 @@ __int64 OpenALPlayer::GetEndPosition()
|
|||
// Get current position
|
||||
__int64 OpenALPlayer::GetCurrentPosition()
|
||||
{
|
||||
// FIXME: this should be based on not duration played but actual sample being heard
|
||||
// (during vidoeo playback, cur_frame might get changed to resync)
|
||||
long extra = playback_segment_timer.Time();
|
||||
return buffers_played * buffer_length + start_frame + extra * samplerate / 1000;
|
||||
}
|
||||
|
|
|
@ -395,6 +395,9 @@ __int64 PulseAudioPlayer::GetCurrentPosition()
|
|||
{
|
||||
if (!is_playing) return 0;
|
||||
|
||||
// FIXME: this should be based on not duration played but actual sample being heard
|
||||
// (during vidoeo playback, cur_frame might get changed to resync)
|
||||
|
||||
// Calculation duration we have played, in microseconds
|
||||
pa_usec_t play_cur_time;
|
||||
pa_stream_get_time(stream, &play_cur_time);
|
||||
|
|
Loading…
Reference in New Issue