aboutsummaryrefslogtreecommitdiff
path: root/graphics
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
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')
-rw-r--r--graphics/video/avi_decoder.cpp21
-rw-r--r--graphics/video/avi_decoder.h3
2 files changed, 23 insertions, 1 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:
diff --git a/graphics/video/avi_decoder.h b/graphics/video/avi_decoder.h
index 85500302d0..bfeab02346 100644
--- a/graphics/video/avi_decoder.h
+++ b/graphics/video/avi_decoder.h
@@ -188,8 +188,9 @@ public:
void closeFile();
bool decodeNextFrame();
-
+ int32 getAudioLag();
int32 getFrameRate() { return _vidsHeader.rate / _vidsHeader.scale; }
+
private:
Audio::Mixer *_mixer;
BITMAPINFOHEADER _bmInfo;