aboutsummaryrefslogtreecommitdiff
path: root/video/qt_decoder.cpp
diff options
context:
space:
mode:
authorMatthew Hoops2011-10-16 22:27:51 -0400
committerMatthew Hoops2011-12-12 12:28:48 -0500
commit35a0fb089a12991be52a14e02977202263a7dbee (patch)
treec6162a9aedf58cf880a12988a594d562d00b0fbb /video/qt_decoder.cpp
parent18da47dcd63d244a6d1a59e02acb05e4812542af (diff)
downloadscummvm-rg350-35a0fb089a12991be52a14e02977202263a7dbee.tar.gz
scummvm-rg350-35a0fb089a12991be52a14e02977202263a7dbee.tar.bz2
scummvm-rg350-35a0fb089a12991be52a14e02977202263a7dbee.zip
VIDEO: Fix QuickTime audio track ends
Fixes videos where the audio track length is smaller than the video track length.
Diffstat (limited to 'video/qt_decoder.cpp')
-rw-r--r--video/qt_decoder.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/video/qt_decoder.cpp b/video/qt_decoder.cpp
index 74bf533e62..058dd6b489 100644
--- a/video/qt_decoder.cpp
+++ b/video/qt_decoder.cpp
@@ -298,9 +298,17 @@ bool QuickTimeDecoder::endOfVideo() const {
}
uint32 QuickTimeDecoder::getElapsedTime() const {
- if (_audStream)
- return g_system->getMixer()->getSoundElapsedTime(_audHandle) + _audioStartOffset.msecs();
+ if (_audStream) {
+ // Use the audio time if present and the audio track's time is less than the
+ // total length of the audio track. The audio track can end before the video
+ // track, so we need to fall back on the getMillis() time tracking in that
+ // case.
+ uint32 time = g_system->getMixer()->getSoundElapsedTime(_audHandle) + _audioStartOffset.msecs();
+ if (time < _tracks[_audioTrackIndex]->duration * 1000 / _tracks[_audioTrackIndex]->timeScale)
+ return time;
+ }
+ // Just use time elapsed since the beginning
return SeekableVideoDecoder::getElapsedTime();
}