GRIM/SMUSH: Fix drawing the last frame for the correct duration.

This commit is contained in:
Einar Johan Trøan Sømåen 2012-12-31 17:10:04 +01:00
parent 39b0a7cf85
commit 65052f9da4
3 changed files with 12 additions and 4 deletions

View File

@ -221,6 +221,11 @@ bool SmushDecoder::loadStream(Common::SeekableReadStream *stream) {
const Graphics::Surface *SmushDecoder::decodeNextFrame() {
handleFrame();
// We might be interested in getting the last frame even after the video ends:
if (endOfVideo()) {
return _videoTrack->decodeNextFrame();
}
return VideoDecoder::decodeNextFrame();
}

View File

@ -86,8 +86,9 @@ bool MoviePlayer::prepareFrame() {
_videoFinished = true;
}
if (_videoPause)
if (_videoPause) {
return false;
}
if (_videoFinished) {
if (g_grim->getMode() == GrimEngine::SmushMode) {
@ -101,9 +102,10 @@ bool MoviePlayer::prepareFrame() {
return false;
handleFrame();
_internalSurface = _videoDecoder->decodeNextFrame();
_updateNeeded = true;
if (_frame != _videoDecoder->getCurFrame()) {
_updateNeeded = true;
}
_movieTime = _videoDecoder->getTime();
_frame = _videoDecoder->getCurFrame();

View File

@ -56,7 +56,8 @@ void SmushPlayer::init() {
}
void SmushPlayer::handleFrame() {
if (_videoDecoder->endOfVideo()) {
// Force the last frame to stay in place for it's duration:
if (_videoDecoder->endOfVideo() && _videoDecoder->getTime() >= _videoDecoder->getDuration().msecs()) {
// If we're not supposed to loop (or looping fails) then end the video
if (!_videoLooping ) {
_videoFinished = true;