aboutsummaryrefslogtreecommitdiff
path: root/engines/mohawk
diff options
context:
space:
mode:
Diffstat (limited to 'engines/mohawk')
-rw-r--r--engines/mohawk/video/qt_player.cpp29
-rw-r--r--engines/mohawk/video/qt_player.h8
-rw-r--r--engines/mohawk/video/video.cpp12
-rw-r--r--engines/mohawk/video/video.h1
4 files changed, 18 insertions, 32 deletions
diff --git a/engines/mohawk/video/qt_player.cpp b/engines/mohawk/video/qt_player.cpp
index b19343005e..28ddc446e9 100644
--- a/engines/mohawk/video/qt_player.cpp
+++ b/engines/mohawk/video/qt_player.cpp
@@ -187,23 +187,20 @@ Graphics::Codec *QTPlayer::createCodec(uint32 codecTag, byte bitsPerPixel) {
}
void QTPlayer::startAudio() {
- if (!_audStream) // No audio/audio not supported
- return;
-
- g_system->getMixer()->playStream(Audio::Mixer::kPlainSoundType, &_audHandle, _audStream);
+ if (_audStream) // No audio/audio not supported
+ g_system->getMixer()->playStream(Audio::Mixer::kPlainSoundType, &_audHandle, _audStream);
}
-void QTPlayer::pauseAudio() {
- g_system->getMixer()->pauseHandle(_audHandle, true);
-}
-
-void QTPlayer::resumeAudio() {
- g_system->getMixer()->pauseHandle(_audHandle, false);
+void QTPlayer::stopAudio() {
+ if (_audStream) {
+ g_system->getMixer()->stopHandle(_audHandle);
+ _audStream = NULL; // the mixer automatically frees the stream
+ }
}
-void QTPlayer::stopAudio() {
- g_system->getMixer()->stopHandle(_audHandle);
- _audStream = NULL; // the mixer automatically frees the stream
+void QTPlayer::pauseVideoIntern(bool pause) {
+ if (_audStream)
+ g_system->getMixer()->pauseHandle(_audHandle, pause);
}
Graphics::Surface *QTPlayer::decodeNextFrame() {
@@ -244,12 +241,6 @@ bool QTPlayer::endOfVideo() const {
return (!_audStream || _audStream->endOfData()) && (!_videoCodec || _curFrame >= (int32)getFrameCount() - 1);
}
-void QTPlayer::addPauseTime(uint32 p) {
- Graphics::VideoDecoder::addPauseTime(p);
- if (_videoStreamIndex >= 0)
- _nextFrameStartTime += p * _streams[_videoStreamIndex]->time_scale / 1000;
-}
-
bool QTPlayer::needsUpdate() const {
return !endOfVideo() && getTimeToNextFrame() == 0;
}
diff --git a/engines/mohawk/video/qt_player.h b/engines/mohawk/video/qt_player.h
index 205b18f99c..6a6b6b43d0 100644
--- a/engines/mohawk/video/qt_player.h
+++ b/engines/mohawk/video/qt_player.h
@@ -104,7 +104,6 @@ public:
void setChunkBeginOffset(uint32 offset) { _beginOffset = offset; }
bool isVideoLoaded() const { return _fd != 0; }
- void addPauseTime(uint32 p);
Graphics::Surface *decodeNextFrame();
bool needsUpdate() const;
bool endOfVideo() const;
@@ -112,13 +111,14 @@ public:
uint32 getTimeToNextFrame() const;
Graphics::PixelFormat getPixelFormat() const;
+ // RewindableVideoDecoder API
void rewind();
// TODO: These audio functions need to be removed from the public and/or added to
// the VideoDecoder API directly.
void updateAudioBuffer(); // This is going to be problematic.
- void pauseAudio();
- void resumeAudio();
+
+
protected:
// This is the file handle from which data is read from. It can be the actual file handle or a decompressed stream.
@@ -255,6 +255,8 @@ protected:
Graphics::Surface *scaleSurface(Graphics::Surface *frame);
ScaleMode getScaleMode() const;
+ void pauseVideoIntern(bool pause);
+
int readDefault(MOVatom atom);
int readLeaf(MOVatom atom);
int readELST(MOVatom atom);
diff --git a/engines/mohawk/video/video.cpp b/engines/mohawk/video/video.cpp
index c4991ec06c..ce50653c73 100644
--- a/engines/mohawk/video/video.cpp
+++ b/engines/mohawk/video/video.cpp
@@ -32,7 +32,6 @@
namespace Mohawk {
VideoManager::VideoManager(MohawkEngine* vm) : _vm(vm) {
- _pauseStart = 0;
}
VideoManager::~VideoManager() {
@@ -42,17 +41,12 @@ VideoManager::~VideoManager() {
void VideoManager::pauseVideos() {
for (uint16 i = 0; i < _videoStreams.size(); i++)
- _videoStreams[i]->pauseAudio();
- _pauseStart = _vm->_system->getMillis() * 100;
+ _videoStreams[i]->pauseVideo(true);
}
void VideoManager::resumeVideos() {
- for (uint16 i = 0; i < _videoStreams.size(); i++) {
- _videoStreams[i]->addPauseTime(_vm->_system->getMillis() * 100 - _pauseStart);
- _videoStreams[i]->resumeAudio();
- }
-
- _pauseStart = 0;
+ for (uint16 i = 0; i < _videoStreams.size(); i++)
+ _videoStreams[i]->pauseVideo(false);
}
void VideoManager::stopVideos() {
diff --git a/engines/mohawk/video/video.h b/engines/mohawk/video/video.h
index 84fab24e33..a5d2bde65d 100644
--- a/engines/mohawk/video/video.h
+++ b/engines/mohawk/video/video.h
@@ -97,7 +97,6 @@ private:
// Keep tabs on any videos playing
Common::Array<VideoEntry> _videoStreams;
- uint32 _pauseStart;
VideoHandle createVideoHandle(uint16 id, uint16 x, uint16 y, bool loop);
VideoHandle createVideoHandle(Common::String filename, uint16 x, uint16 y, bool loop);