aboutsummaryrefslogtreecommitdiff
path: root/graphics/video
diff options
context:
space:
mode:
authorSven Hesse2009-12-29 18:07:06 +0000
committerSven Hesse2009-12-29 18:07:06 +0000
commit10e62ea99217eb5d4173c13571bb45c37c6e3137 (patch)
treecaff09f374beaf01560a7230b54cd275cefb57cd /graphics/video
parent881b8310740fdc9d9d0d2d7f885251959af01fd9 (diff)
downloadscummvm-rg350-10e62ea99217eb5d4173c13571bb45c37c6e3137.tar.gz
scummvm-rg350-10e62ea99217eb5d4173c13571bb45c37c6e3137.tar.bz2
scummvm-rg350-10e62ea99217eb5d4173c13571bb45c37c6e3137.zip
Adding a getFrameWaitTime() method to get the frame waiting time instead of directly waiting
svn-id: r46712
Diffstat (limited to 'graphics/video')
-rw-r--r--graphics/video/coktelvideo/coktelvideo.cpp16
-rw-r--r--graphics/video/coktelvideo/coktelvideo.h3
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,