diff options
Diffstat (limited to 'graphics/video/avi_decoder.cpp')
-rw-r--r-- | graphics/video/avi_decoder.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/graphics/video/avi_decoder.cpp b/graphics/video/avi_decoder.cpp index fa5494d9b9..a3180edeee 100644 --- a/graphics/video/avi_decoder.cpp +++ b/graphics/video/avi_decoder.cpp @@ -361,6 +361,27 @@ bool AviDecoder::decodeNextFrame() { return _videoInfo.currentFrame < _videoInfo.frameCount; } +int32 AviDecoder::getAudioLag() { + if (!_fileStream) + return 0; + + int32 frameDelay = getFrameDelay(); + int32 videoTime = _videoInfo.currentFrame * frameDelay; + int32 audioTime; + + if (!_audStream) { + /* No audio. + Calculate the lag by how much time has gone by since the first frame + and how much time *should* have passed. + */ + + audioTime = (g_system->getMillis() - _videoInfo.startTime) * 100; + } else + audioTime = (((int32)_mixer->getSoundElapsedTime(*_audHandle)) * 100); + + return videoTime - audioTime; +} + Codec *AviDecoder::createCodec() { switch (_vidsHeader.streamHandler) { case ID_CRAM: |