aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/gob/videoplayer.cpp22
-rw-r--r--engines/gob/videoplayer.h2
-rw-r--r--graphics/video/coktel_decoder.cpp16
-rw-r--r--graphics/video/coktel_decoder.h1
4 files changed, 22 insertions, 19 deletions
diff --git a/engines/gob/videoplayer.cpp b/engines/gob/videoplayer.cpp
index c22a67ac16..8ac4c47202 100644
--- a/engines/gob/videoplayer.cpp
+++ b/engines/gob/videoplayer.cpp
@@ -246,6 +246,7 @@ bool VideoPlayer::play(int slot, Properties &properties) {
video->live = true;
properties.waitEndFrame = false;
_liveProperties = properties;
+ updateLive(true);
return true;
}
@@ -279,24 +280,33 @@ void VideoPlayer::waitEndFrame(int slot, bool onlySound) {
if (!video)
return;
- if (!onlySound || video->decoder->hasSound())
- _vm->_util->delay(video->decoder->getTimeToNextFrame());
+ if (!onlySound || video->decoder->hasSound()) {
+ uint32 waitTime = video->decoder->getTimeToNextFrame();
+ if (!video->decoder->hasSound())
+ waitTime = video->decoder->getStaticTimeToNextFrame();;
+
+ _vm->_util->delay(waitTime);
+ }
}
-void VideoPlayer::updateLive() {
+void VideoPlayer::updateLive(bool force) {
Video *video = getVideoBySlot(0);
if (!video || !video->live)
return;
- if ((_liveProperties.startFrame == _liveProperties.lastFrame) ||
- (_liveProperties.startFrame >= (int32)(video->decoder->getFrameCount() - 1))) {
+ if (_liveProperties.startFrame >= (int32)(video->decoder->getFrameCount() - 1)) {
+ // Video ended
WRITE_VAR_OFFSET(212, (uint32)-1);
_vm->_vidPlayer->closeVideo();
return;
}
- if (video->decoder->getTimeToNextFrame() > 0)
+ if (_liveProperties.startFrame == _liveProperties.lastFrame)
+ // Current video sequence ended
+ return;
+
+ if (!force && (video->decoder->getTimeToNextFrame() > 0))
return;
WRITE_VAR_OFFSET(212, _liveProperties.startFrame + 1);
diff --git a/engines/gob/videoplayer.h b/engines/gob/videoplayer.h
index 9b68d4a5af..2708ee1c56 100644
--- a/engines/gob/videoplayer.h
+++ b/engines/gob/videoplayer.h
@@ -110,7 +110,7 @@ public:
bool play(int slot, Properties &properties);
void waitEndFrame(int slot, bool onlySound = false);
- void updateLive();
+ void updateLive(bool force = false);
bool slotIsOpen(int slot = 0) const;
diff --git a/graphics/video/coktel_decoder.cpp b/graphics/video/coktel_decoder.cpp
index 6ec0929d82..c133ebc1ee 100644
--- a/graphics/video/coktel_decoder.cpp
+++ b/graphics/video/coktel_decoder.cpp
@@ -606,21 +606,13 @@ Common::Rational CoktelDecoder::getFrameRate() const {
}
uint32 CoktelDecoder::getTimeToNextFrame() const {
- // If there is no audio, just return the static time between
- // frames without any elaborate sync calculation. This is
- // needed for the gob engine, since it has a lot of control
- // between the videos and often plays just few frames out of
- // the middle of a long video.
-
- if (!hasSound())
- return (1000 / _frameRate).toInt();
-
- // If there /is/ audio, we do need to keep video and audio
- // in sync, though.
-
return FixedRateVideoDecoder::getTimeToNextFrame();
}
+uint32 CoktelDecoder::getStaticTimeToNextFrame() const {
+ return (1000 / _frameRate).toInt();
+}
+
inline void CoktelDecoder::unsignedToSigned(byte *buffer, int length) {
while (length-- > 0) *buffer++ ^= 0x80;
}
diff --git a/graphics/video/coktel_decoder.h b/graphics/video/coktel_decoder.h
index 97be4ac72b..828b274b2f 100644
--- a/graphics/video/coktel_decoder.h
+++ b/graphics/video/coktel_decoder.h
@@ -131,6 +131,7 @@ public:
const byte *getPalette();
bool hasDirtyPalette() const;
+ uint32 getStaticTimeToNextFrame() const;
// FixedRateVideoDecoder interface