aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2010-08-31 21:07:36 +0000
committerEugene Sandulenko2010-10-12 23:22:46 +0000
commit579d872e96862882d4cf92e82a0e8deb82496020 (patch)
tree790b3fd7ebbff4e757790a899636f6f47ecc8ce0
parentf06db87a0ee0323ceb5a1e946fa9ed1f8576abca (diff)
downloadscummvm-rg350-579d872e96862882d4cf92e82a0e8deb82496020.tar.gz
scummvm-rg350-579d872e96862882d4cf92e82a0e8deb82496020.tar.bz2
scummvm-rg350-579d872e96862882d4cf92e82a0e8deb82496020.zip
SWORD25: Bugfixes for video playback.
svn-id: r53299
-rw-r--r--engines/sword25/fmv/movieplayer.cpp9
-rw-r--r--engines/sword25/fmv/movieplayer.h2
-rw-r--r--engines/sword25/fmv/theora_decoder.cpp10
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 {