diff options
-rw-r--r-- | graphics/video/coktelvideo/coktelvideo.cpp | 16 | ||||
-rw-r--r-- | graphics/video/coktelvideo/coktelvideo.h | 3 |
2 files changed, 15 insertions, 4 deletions
diff --git a/graphics/video/coktelvideo/coktelvideo.cpp b/graphics/video/coktelvideo/coktelvideo.cpp index 95b12528c0..c2fcea8933 100644 --- a/graphics/video/coktelvideo/coktelvideo.cpp +++ b/graphics/video/coktelvideo/coktelvideo.cpp @@ -452,10 +452,10 @@ CoktelVideo::State Imd::nextFrame() { return processFrame(_curFrame); } -void Imd::waitEndFrame() { +uint32 Imd::getFrameWaitTime() { if (_soundEnabled && _hasSound) {; if (_soundStage != 2) - return; + return 0; if (_skipFrames == 0) { int32 waitTime = (int16) (((_curFrame * _soundSliceLength) - @@ -465,12 +465,20 @@ void Imd::waitEndFrame() { _skipFrames = -waitTime / (_soundSliceLength >> 16); warning("Video A/V sync broken, skipping %d frame(s)", _skipFrames + 1); } else if (waitTime > 0) - g_system->delayMillis(waitTime); + return waitTime; } else _skipFrames--; } else - g_system->delayMillis(_frameLength); + return _frameLength; + + return 0; +} + +void Imd::waitEndFrame() { + uint32 waitTime = getFrameWaitTime(); + if (waitTime > 0) + g_system->delayMillis(waitTime); } void Imd::copyCurrentFrame(byte *dest, diff --git a/graphics/video/coktelvideo/coktelvideo.h b/graphics/video/coktelvideo/coktelvideo.h index cf325d7c7b..b0f38186a2 100644 --- a/graphics/video/coktelvideo/coktelvideo.h +++ b/graphics/video/coktelvideo/coktelvideo.h @@ -184,6 +184,8 @@ public: /** Render the next frame. */ virtual State nextFrame() = 0; + /** Get the time in ms until the next frame can be displayed. Already includes A/V sync measures. */ + virtual uint32 getFrameWaitTime() = 0; /** Wait for the frame to end. */ virtual void waitEndFrame() = 0; @@ -252,6 +254,7 @@ public: void seekFrame(int32 frame, int16 whence = SEEK_SET, bool restart = false); State nextFrame(); + uint32 getFrameWaitTime(); void waitEndFrame(); void copyCurrentFrame(byte *dest, |