aboutsummaryrefslogtreecommitdiff
path: root/graphics/video/avi_decoder.cpp
diff options
context:
space:
mode:
authorMatthew Hoops2009-10-16 18:32:20 +0000
committerMatthew Hoops2009-10-16 18:32:20 +0000
commit620fa7c6414e98949537b9b759c65ea336fb64d0 (patch)
treecfd75ccffd5484fb63e6d3689a7303d20dc2bf06 /graphics/video/avi_decoder.cpp
parent1d679723c3182994e7d4868b14a7f394a662f0c8 (diff)
downloadscummvm-rg350-620fa7c6414e98949537b9b759c65ea336fb64d0.tar.gz
scummvm-rg350-620fa7c6414e98949537b9b759c65ea336fb64d0.tar.bz2
scummvm-rg350-620fa7c6414e98949537b9b759c65ea336fb64d0.zip
Override getAudioLag() in the AviDecoder (blatantly borrowed from the SmackerDecoder).
svn-id: r45172
Diffstat (limited to 'graphics/video/avi_decoder.cpp')
-rw-r--r--graphics/video/avi_decoder.cpp21
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: