From aaf4d38a56219c63ee41638e93ef83f66f309b23 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Fri, 16 Jan 2015 01:53:53 -0500 Subject: VIDEO: Round the edit time offset instead of truncating it Allows for the KQ6 Mac intro to play without the edit "-1" hack --- video/qt_decoder.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'video/qt_decoder.cpp') diff --git a/video/qt_decoder.cpp b/video/qt_decoder.cpp index 2012e369e7..14102794c4 100644 --- a/video/qt_decoder.cpp +++ b/video/qt_decoder.cpp @@ -721,7 +721,12 @@ const Graphics::Surface *QuickTimeDecoder::VideoTrackHandler::bufferNextFrame() uint32 QuickTimeDecoder::VideoTrackHandler::getRateAdjustedFrameTime() const { // Figure out what time the next frame is at taking the edit list rate into account - uint32 convertedTime = (Common::Rational(_nextFrameStartTime - getCurEditTimeOffset()) / _parent->editList[_curEdit].mediaRate).toInt(); + Common::Rational offsetFromEdit = Common::Rational(_nextFrameStartTime - getCurEditTimeOffset()) / _parent->editList[_curEdit].mediaRate; + uint32 convertedTime = offsetFromEdit.toInt(); + + if ((offsetFromEdit.getNumerator() % offsetFromEdit.getDenominator()) > (offsetFromEdit.getDenominator() / 2)) + convertedTime++; + return convertedTime + getCurEditTimeOffset(); } -- cgit v1.2.3