aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Hoops2011-10-16 22:27:51 -0400
committerMatthew Hoops2011-10-16 22:27:51 -0400
commit802873d3231a665d13d1f690bd9c780f7f7b7fb4 (patch)
treeaceca6178b2946d95706ed0a522633ffb525d69d
parent77033ecc6cb37549ed0fedc8461c2cd0d0affb95 (diff)
downloadscummvm-rg350-802873d3231a665d13d1f690bd9c780f7f7b7fb4.tar.gz
scummvm-rg350-802873d3231a665d13d1f690bd9c780f7f7b7fb4.tar.bz2
scummvm-rg350-802873d3231a665d13d1f690bd9c780f7f7b7fb4.zip
VIDEO: Fix QuickTime audio track ends
Fixes videos where the audio track length is smaller than the video track length.
-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();
}