Adding a getFrameWaitTime() method to get the frame waiting time instead of directly waiting

svn-id: r46712
This commit is contained in:
Sven Hesse 2009-12-29 18:07:06 +00:00
parent 881b831074
commit 10e62ea992
2 changed files with 15 additions and 4 deletions

View File

@ -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,

View File

@ -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,