aboutsummaryrefslogtreecommitdiff
path: root/engines/wintermute
diff options
context:
space:
mode:
authorEinar Johan Trøan Sømåen2012-06-12 15:58:00 +0200
committerEinar Johan Trøan Sømåen2012-06-12 15:58:00 +0200
commiteb6895ed6be52a772b4f2bd3e0c4b408202170ea (patch)
tree115e974144449f2bdd7372ccd602bee64bb8bd58 /engines/wintermute
parentc6c2cfab4e444211654df2906f6e6eecccb9a22c (diff)
downloadscummvm-rg350-eb6895ed6be52a772b4f2bd3e0c4b408202170ea.tar.gz
scummvm-rg350-eb6895ed6be52a772b4f2bd3e0c4b408202170ea.tar.bz2
scummvm-rg350-eb6895ed6be52a772b4f2bd3e0c4b408202170ea.zip
WINTERMUTE: Add rewindability to Theora-Decoder
This currently just abuses the fact that reset() does a rewind instead of a proper reset().
Diffstat (limited to 'engines/wintermute')
-rw-r--r--engines/wintermute/video/VidTheoraPlayer.cpp8
-rw-r--r--engines/wintermute/video/VidTheoraPlayer.h2
-rw-r--r--engines/wintermute/video/decoders/theora_decoder.cpp4
-rw-r--r--engines/wintermute/video/decoders/theora_decoder.h4
4 files changed, 14 insertions, 4 deletions
diff --git a/engines/wintermute/video/VidTheoraPlayer.cpp b/engines/wintermute/video/VidTheoraPlayer.cpp
index 3171e6881f..fd1b7cea2b 100644
--- a/engines/wintermute/video/VidTheoraPlayer.cpp
+++ b/engines/wintermute/video/VidTheoraPlayer.cpp
@@ -448,6 +448,7 @@ HRESULT CVidTheoraPlayer::update() {
if (_theoraDecoder) {
if (_theoraDecoder->endOfVideo() && _looping) {
warning("Should loop movie");
+ _theoraDecoder->rewind();
} else if (_theoraDecoder->endOfVideo() && !_looping) {
warning("Finished movie");
_state = THEORA_STATE_FINISHED;
@@ -576,7 +577,11 @@ int CVidTheoraPlayer::getMovieFrame() {
return Time / ((double)m_TheoraInfo.fps_denominator / m_TheoraInfo.fps_numerator);
#endif
- return 0;
+ if (_theoraDecoder) {
+ return _theoraDecoder->getTime();
+ } else {
+ return 0;
+ }
}
//////////////////////////////////////////////////////////////////////////
@@ -593,7 +598,6 @@ HRESULT CVidTheoraPlayer::WriteVideo() {
//////////////////////////////////////////////////////////////////////////
HRESULT CVidTheoraPlayer::display(uint32 Alpha) {
-
RECT rc;
HRESULT Res;
diff --git a/engines/wintermute/video/VidTheoraPlayer.h b/engines/wintermute/video/VidTheoraPlayer.h
index 0ce6e42b5a..50a94667fd 100644
--- a/engines/wintermute/video/VidTheoraPlayer.h
+++ b/engines/wintermute/video/VidTheoraPlayer.h
@@ -38,7 +38,7 @@ private:
THEORA_STATE_PAUSED = 2,
THEORA_STATE_FINISHED = 3
};
- Video::VideoDecoder *_theoraDecoder;
+ Video::RewindableVideoDecoder *_theoraDecoder;
Graphics::Surface _surface;
public:
//DECLARE_PERSISTENT(CVidTheoraPlayer, CBBase);
diff --git a/engines/wintermute/video/decoders/theora_decoder.cpp b/engines/wintermute/video/decoders/theora_decoder.cpp
index 7c766fe3c6..647d9aff08 100644
--- a/engines/wintermute/video/decoders/theora_decoder.cpp
+++ b/engines/wintermute/video/decoders/theora_decoder.cpp
@@ -561,6 +561,10 @@ void TheoraDecoder::updateBalance() {
g_system->getMixer()->setChannelBalance(*_audHandle, getBalance());
}
+void TheoraDecoder::rewind() {
+ reset();
+}
+
} // End of namespace Sword25
#endif
diff --git a/engines/wintermute/video/decoders/theora_decoder.h b/engines/wintermute/video/decoders/theora_decoder.h
index 79e669c068..3844434036 100644
--- a/engines/wintermute/video/decoders/theora_decoder.h
+++ b/engines/wintermute/video/decoders/theora_decoder.h
@@ -50,7 +50,7 @@ namespace WinterMute {
* - sword25
* - wintermute
*/
-class TheoraDecoder : public Video::VideoDecoder {
+class TheoraDecoder : public Video::RewindableVideoDecoder {
public:
TheoraDecoder(Audio::Mixer::SoundType soundType = Audio::Mixer::kMusicSoundType);
virtual ~TheoraDecoder();
@@ -87,6 +87,8 @@ public:
bool endOfVideo() const;
+ void rewind();
+
protected:
// VideoDecoder API
void updateVolume();