Skip to content

Commit

Permalink
VIDEO: Fix reverse playback right to the very start of the video
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Sep 4, 2017
1 parent 0b19ebe commit be20826
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions video/avi_decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ bool AVIDecoder::isSeekable() const {
const Graphics::Surface *AVIDecoder::decodeNextFrame() {
AVIVideoTrack *track = nullptr;
bool isReversed = false;
int frameNum;
int frameNum = 0;

// Check whether the video is playing in revese
for (int idx = _videoTracks.size() - 1; idx >= 0; --idx) {
Expand All @@ -155,6 +155,7 @@ const Graphics::Surface *AVIDecoder::decodeNextFrame() {
for (int idx = _videoTracks.size() - 1; idx >= 0; --idx) {
track = static_cast<AVIVideoTrack *>(_videoTracks[idx].track);
track->setCurFrame(frameNum - 1);
findNextVideoTrack();
}
}

Expand Down Expand Up @@ -1020,7 +1021,7 @@ bool AVIDecoder::AVIVideoTrack::setReverse(bool reverse) {

bool AVIDecoder::AVIVideoTrack::endOfTrack() const {
if (_reversed)
return _curFrame < 0;
return _curFrame < -1;

return _curFrame >= (getFrameCount() - 1);
}
Expand Down

0 comments on commit be20826

Please sign in to comment.