diff options
| author | Sven Hesse | 2009-12-29 18:07:06 +0000 | 
|---|---|---|
| committer | Sven Hesse | 2009-12-29 18:07:06 +0000 | 
| commit | 10e62ea99217eb5d4173c13571bb45c37c6e3137 (patch) | |
| tree | caff09f374beaf01560a7230b54cd275cefb57cd | |
| parent | 881b8310740fdc9d9d0d2d7f885251959af01fd9 (diff) | |
| download | scummvm-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
| -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, | 
