diff options
author | Matthew Hoops | 2011-10-16 22:27:51 -0400 |
---|---|---|
committer | Matthew Hoops | 2011-12-12 12:28:48 -0500 |
commit | 35a0fb089a12991be52a14e02977202263a7dbee (patch) | |
tree | c6162a9aedf58cf880a12988a594d562d00b0fbb /video | |
parent | 18da47dcd63d244a6d1a59e02acb05e4812542af (diff) | |
download | scummvm-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')
-rw-r--r-- | video/qt_decoder.cpp | 12 |
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(); } |