SWORD25: Properly use endOfVideo()

This commit is contained in:
Matthew Hoops 2011-05-18 09:56:59 -04:00
parent affb6a38a1
commit 14e1cc728f

View File

@ -119,21 +119,23 @@ bool MoviePlayer::pause() {
void MoviePlayer::update() {
if (_decoder.isVideoLoaded()) {
const Graphics::Surface *s = _decoder.decodeNextFrame();
if (s) {
// Transfer the next frame
assert(s->format.bytesPerPixel == 4);
#ifdef THEORA_INDIRECT_RENDERING
byte *frameData = (byte *)s->getBasePtr(0, 0);
_outputBitmap->setContent(frameData, s->pitch * s->h, 0, s->pitch);
#else
g_system->copyRectToScreen((byte *)s->getBasePtr(0, 0), s->pitch, _outX, _outY, MIN(s->w, _backSurface->w), MIN(s->h, _backSurface->h));
g_system->updateScreen();
#endif
} else {
if (_decoder.endOfVideo()) {
// Movie complete, so unload the movie
unloadMovie();
} else {
const Graphics::Surface *s = _decoder.decodeNextFrame();
if (s) {
// Transfer the next frame
assert(s->format.bytesPerPixel == 4);
#ifdef THEORA_INDIRECT_RENDERING
byte *frameData = (byte *)s->getBasePtr(0, 0);
_outputBitmap->setContent(frameData, s->pitch * s->h, 0, s->pitch);
#else
g_system->copyRectToScreen((byte *)s->getBasePtr(0, 0), s->pitch, _outX, _outY, MIN(s->w, _backSurface->w), MIN(s->h, _backSurface->h));
g_system->updateScreen();
#endif
}
}
}
}