diff options
-rw-r--r-- | engines/sword25/fmv/movieplayer.cpp | 9 | ||||
-rw-r--r-- | engines/sword25/fmv/movieplayer.h | 2 | ||||
-rw-r--r-- | engines/sword25/fmv/theora_decoder.cpp | 10 |
3 files changed, 15 insertions, 6 deletions
diff --git a/engines/sword25/fmv/movieplayer.cpp b/engines/sword25/fmv/movieplayer.cpp index e4b417adc5..f3504fcb8f 100644 --- a/engines/sword25/fmv/movieplayer.cpp +++ b/engines/sword25/fmv/movieplayer.cpp @@ -32,9 +32,12 @@ * */ +#include "graphics/surface.h" + #include "sword25/fmv/movieplayer.h" #include "sword25/fmv/theora_decoder.h" #include "sword25/kernel/kernel.h" +#include "sword25/gfx/graphicengine.h" #include "sword25/package/packagemanager.h" namespace Sword25 { @@ -52,6 +55,7 @@ MoviePlayer::MoviePlayer(Kernel *pKernel) : Service(pKernel) { BS_LOGLN("Script bindings registered."); _decoder = new TheoraDecoder(); + _backSurface = (static_cast<GraphicEngine *>(Kernel::GetInstance()->GetService("gfx")))->getSurface(); } bool MoviePlayer::LoadMovie(const Common::String &filename, unsigned int z) { @@ -97,6 +101,11 @@ void MoviePlayer::Update() { return; Graphics::Surface *surface = _decoder->decodeNextFrame(); + + // Probably it's better to copy to _backSurface + if (surface->w > 0 && surface->h > 0) + g_system->copyRectToScreen((byte *)surface->getBasePtr(0, 0), surface->pitch, 0, 0, + MIN(surface->w, _backSurface->w), MIN(surface->h, _backSurface->h)); } bool MoviePlayer::IsMovieLoaded() { diff --git a/engines/sword25/fmv/movieplayer.h b/engines/sword25/fmv/movieplayer.h index 233c500fd5..afca1eb808 100644 --- a/engines/sword25/fmv/movieplayer.h +++ b/engines/sword25/fmv/movieplayer.h @@ -41,6 +41,7 @@ #include "sword25/kernel/common.h" #include "sword25/kernel/service.h" +#include "graphics/surface.h" namespace Sword25 { @@ -140,6 +141,7 @@ private: bool _RegisterScriptBindings(); TheoraDecoder *_decoder; + Graphics::Surface *_backSurface; }; } // End of namespace Sword25 diff --git a/engines/sword25/fmv/theora_decoder.cpp b/engines/sword25/fmv/theora_decoder.cpp index bcd77ca880..bc95e10678 100644 --- a/engines/sword25/fmv/theora_decoder.cpp +++ b/engines/sword25/fmv/theora_decoder.cpp @@ -53,10 +53,6 @@ TheoraDecoder::TheoraDecoder(Audio::Mixer *mixer, Audio::Mixer::SoundType soundT _fileStream = 0; _surface = 0; - _theoraPacket = 0; - _vorbisPacket = 0; - _stateFlag = false; - _soundType = soundType; _audStream = 0; _audHandle = new Audio::SoundHandle(); @@ -299,7 +295,6 @@ void TheoraDecoder::close() { if (_mixer) _mixer->stopHandle(*_audHandle); _audStream = 0; - _vorbisPacket = 0; } if (_theoraPacket) { ogg_stream_clear(&_theoraOut); @@ -307,7 +302,6 @@ void TheoraDecoder::close() { th_comment_clear(&_theoraComment); th_info_clear(&_theoraInfo); _theoraDecode = 0; - _theoraPacket = 0; } if (!_fileStream) @@ -463,6 +457,10 @@ void TheoraDecoder::reset() { _audiobufGranulePos = 0; _curFrame = 0; + + _theoraPacket = 0; + _vorbisPacket = 0; + _stateFlag = false; } bool TheoraDecoder::endOfVideo() const { |