VIDEO: Support quicktime reverse playback with multiple edits

This commit is contained in:
Harishankar Kumar 2023-04-10 09:23:56 +05:30 committed by Eugene Sandulenko
parent dc997b22ce
commit 1e877bab26
2 changed files with 26 additions and 0 deletions

View file

@ -499,6 +499,20 @@ const Graphics::Surface *QuickTimeDecoder::VideoTrackHandler::decodeNextFrame()
return 0;
if (_reversed) {
if (beforeCurEdit()) {
_curEdit--;
if (atFirstEdit()) {
return 0;
}
enterNewEditListEntry(false);
if (isEmptyEdit()) {
return 0;
}
}
// Subtract one to place us on the frame before the current displayed frame.
_curFrame--;
@ -885,10 +899,20 @@ uint32 QuickTimeDecoder::VideoTrackHandler::getCurEditTrackDuration() const {
return _parent->editList[_curEdit].trackDuration * _parent->timeScale / _decoder->_timeScale;
}
bool QuickTimeDecoder::VideoTrackHandler::atFirstEdit() const {
return _curEdit == 0;
}
bool QuickTimeDecoder::VideoTrackHandler::atLastEdit() const {
return _curEdit == _parent->editList.size();
}
bool QuickTimeDecoder::VideoTrackHandler::beforeCurEdit() const {
// We're at the end of the edit once the next frame's time would
// bring us past the end of the edit.
return getRateAdjustedFrameTime() <= getCurEditTimeOffset();
}
bool QuickTimeDecoder::VideoTrackHandler::endOfCurEdit() const {
// We're at the end of the edit once the next frame's time would
// bring us past the end of the edit.

View file

@ -179,7 +179,9 @@ private:
uint32 getRateAdjustedFrameTime() const; // media time
uint32 getCurEditTimeOffset() const; // media time
uint32 getCurEditTrackDuration() const; // media time
bool atFirstEdit() const;
bool atLastEdit() const;
bool beforeCurEdit() const;
bool endOfCurEdit() const;
void checkEditListBounds();
};