From d2bf7f99fd20fbc0b6126e5c8ae6833d3491d030 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Thu, 14 Aug 2014 20:16:14 -0400 Subject: AUDIO: Really fix seeking with audio edits I really have no idea what I was thinking in acb127c2 --- audio/decoders/quicktime.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'audio/decoders') diff --git a/audio/decoders/quicktime.cpp b/audio/decoders/quicktime.cpp index 547abd2aa4..331c850b1a 100644 --- a/audio/decoders/quicktime.cpp +++ b/audio/decoders/quicktime.cpp @@ -414,8 +414,15 @@ void QuickTimeAudioDecoder::QuickTimeAudioTrack::skipSamples(const Timestamp &le } void QuickTimeAudioDecoder::QuickTimeAudioTrack::findEdit(const Timestamp &position) { - for (_curEdit = 0; _curEdit < _parentTrack->editCount - 1 && position > Timestamp(0, _parentTrack->editList[_curEdit].timeOffset, _decoder->_timeScale); _curEdit++) - ; + // Go through the edits look for where we find out we need to be. As long + // as the position is >= to the edit's start time, it is considered to be in that + // edit. seek() already figured out if we reached the last edit, so we don't need + // to handle that case here. + for (_curEdit = 0; _curEdit < _parentTrack->editCount - 1; _curEdit++) { + Timestamp nextEditTime(0, _parentTrack->editList[_curEdit + 1].timeOffset, _decoder->_timeScale); + if (position < nextEditTime) + break; + } enterNewEdit(position); } -- cgit v1.2.3