diff options
author | Matthew Hoops | 2012-10-12 13:37:32 -0400 |
---|---|---|
committer | Matthew Hoops | 2012-10-12 13:37:32 -0400 |
commit | 64389c0643ee03f4ddda16d7bfe1a841bf0b2735 (patch) | |
tree | 197e45c970a93181fb78b2c790607e126da3b315 | |
parent | 075d0b4812f36781c690d8fe645ad2d802ea30d3 (diff) | |
download | scummvm-rg350-64389c0643ee03f4ddda16d7bfe1a841bf0b2735.tar.gz scummvm-rg350-64389c0643ee03f4ddda16d7bfe1a841bf0b2735.tar.bz2 scummvm-rg350-64389c0643ee03f4ddda16d7bfe1a841bf0b2735.zip |
VIDEO: Fix edits with scales not divisible by the media scale
QuickTime docs aren't completely clear on this, but from samples it's clear that the value needs to be rounded
-rw-r--r-- | video/qt_decoder.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/video/qt_decoder.cpp b/video/qt_decoder.cpp index ca4d87f68f..c5fcab4b49 100644 --- a/video/qt_decoder.cpp +++ b/video/qt_decoder.cpp @@ -655,7 +655,19 @@ uint32 QuickTimeDecoder::VideoTrackHandler::getRateAdjustedFrameTime() const { uint32 QuickTimeDecoder::VideoTrackHandler::getCurEditTimeOffset() const { // Need to convert to the track scale - return _parent->editList[_curEdit].timeOffset * _parent->timeScale / _decoder->_timeScale; + + // We have to round the time off to the nearest in the scale, otherwise + // bad things happen. QuickTime docs are pretty silent on all this stuff, + // so this was found from samples. It doesn't help that this is really + // the only open source implementation of QuickTime edits. + + uint32 mult = _parent->editList[_curEdit].timeOffset * _parent->timeScale; + uint32 result = mult / _decoder->_timeScale; + + if ((mult % _decoder->_timeScale) > (_decoder->_timeScale / 2)) + result++; + + return result; } uint32 QuickTimeDecoder::VideoTrackHandler::getCurEditTrackDuration() const { |