aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/support
diff options
context:
space:
mode:
Diffstat (limited to 'engines/titanic/support')
-rw-r--r--engines/titanic/support/avi_surface.cpp9
-rw-r--r--engines/titanic/support/avi_surface.h10
-rw-r--r--engines/titanic/support/movie.cpp8
-rw-r--r--engines/titanic/support/movie.h16
-rw-r--r--engines/titanic/support/video_surface.cpp1
5 files changed, 44 insertions, 0 deletions
diff --git a/engines/titanic/support/avi_surface.cpp b/engines/titanic/support/avi_surface.cpp
index 9e465c705f..07458812b9 100644
--- a/engines/titanic/support/avi_surface.cpp
+++ b/engines/titanic/support/avi_surface.cpp
@@ -114,6 +114,15 @@ void AVISurface::stop() {
_movieRangeInfo.destroyContents();
}
+void AVISurface::pause() {
+ _decoder->pauseVideo(true);
+}
+
+void AVISurface::resume() {
+ if (_decoder->isPaused())
+ _decoder->pauseVideo(false);
+}
+
bool AVISurface::startAtFrame(int frameNumber) {
if (isPlaying())
// If it's already playing, then don't allow it
diff --git a/engines/titanic/support/avi_surface.h b/engines/titanic/support/avi_surface.h
index b6231a646f..b4e6d420cb 100644
--- a/engines/titanic/support/avi_surface.h
+++ b/engines/titanic/support/avi_surface.h
@@ -120,6 +120,16 @@ public:
virtual void stop();
/**
+ * Pauses video playback
+ */
+ virtual void pause();
+
+ /**
+ * Resumes the video if it's paused
+ */
+ virtual void resume();
+
+ /**
* Return true if a video is currently playing
*/
virtual bool isPlaying() const { return _decoder->isPlaying(); }
diff --git a/engines/titanic/support/movie.cpp b/engines/titanic/support/movie.cpp
index aea51e1a1e..2115906992 100644
--- a/engines/titanic/support/movie.cpp
+++ b/engines/titanic/support/movie.cpp
@@ -143,6 +143,10 @@ void OSMovie::playCutscene(const Rect &drawRect, uint startFrame, uint endFrame)
g_vm->_events->removeTarget();
}
+void OSMovie::pause() {
+ _aviSurface.pause();
+}
+
void OSMovie::stop() {
_aviSurface.stop();
removeFromPlayingMovies();
@@ -161,6 +165,10 @@ void OSMovie::setFrame(uint frameNumber) {
}
bool OSMovie::handleEvents(CMovieEventList &events) {
+ // WORKAROUND: If a movie is paused as part of initial
+ // scene loading, now's the time to un-pause it
+ _aviSurface.resume();
+
if (!_aviSurface.isPlaying())
return false;
if (!_aviSurface.isNextFrame())
diff --git a/engines/titanic/support/movie.h b/engines/titanic/support/movie.h
index acc647065f..caeba65584 100644
--- a/engines/titanic/support/movie.h
+++ b/engines/titanic/support/movie.h
@@ -90,6 +90,14 @@ public:
virtual void playCutscene(const Rect &drawRect, uint startFrame, uint endFrame) = 0;
/**
+ * Pauses a movie
+ * @remarks Acts a workaround for our video decoder, since some movies started
+ * as part of a scene load need to be paused until the scene is interactive,
+ * or else they get played back too quickly
+ */
+ virtual void pause() = 0;
+
+ /**
* Stops the movie
*/
virtual void stop() = 0;
@@ -189,6 +197,14 @@ public:
virtual void playCutscene(const Rect &drawRect, uint startFrame, uint endFrame);
/**
+ * Pauses a movie
+ * @remarks Acts a workaround for our video decoder, since some movies started
+ * as part of a scene load need to be paused until the scene is interactive,
+ * or else they get played back too quickly
+ */
+ virtual void pause();
+
+ /**
* Stops the movie
*/
virtual void stop();
diff --git a/engines/titanic/support/video_surface.cpp b/engines/titanic/support/video_surface.cpp
index 45813bb740..293232860c 100644
--- a/engines/titanic/support/video_surface.cpp
+++ b/engines/titanic/support/video_surface.cpp
@@ -560,6 +560,7 @@ void OSVideoSurface::playMovie(uint flags, CGameObject *obj) {
void OSVideoSurface::playMovie(uint startFrame, uint endFrame, uint flags, CGameObject *obj) {
if (loadIfReady() && _movie) {
_movie->play(startFrame, endFrame, flags, obj);
+ _movie->pause();
}
}