[Scummvm-cvs-logs] SF.net SVN: scummvm:[46712] scummvm/trunk/graphics/video/coktelvideo

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Tue Dec 29 19:07:06 CET 2009


Revision: 46712
          http://scummvm.svn.sourceforge.net/scummvm/?rev=46712&view=rev
Author:   drmccoy
Date:     2009-12-29 18:07:06 +0000 (Tue, 29 Dec 2009)

Log Message:
-----------
Adding a getFrameWaitTime() method to get the frame waiting time instead of directly waiting

Modified Paths:
--------------
    scummvm/trunk/graphics/video/coktelvideo/coktelvideo.cpp
    scummvm/trunk/graphics/video/coktelvideo/coktelvideo.h

Modified: scummvm/trunk/graphics/video/coktelvideo/coktelvideo.cpp
===================================================================
--- scummvm/trunk/graphics/video/coktelvideo/coktelvideo.cpp	2009-12-29 17:30:38 UTC (rev 46711)
+++ scummvm/trunk/graphics/video/coktelvideo/coktelvideo.cpp	2009-12-29 18:07:06 UTC (rev 46712)
@@ -452,10 +452,10 @@
 	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,14 +465,22 @@
 				_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,
 		uint16 left, uint16 top, uint16 width, uint16 height,
 		uint16 x, uint16 y, uint16 pitch, int16 transp) {

Modified: scummvm/trunk/graphics/video/coktelvideo/coktelvideo.h
===================================================================
--- scummvm/trunk/graphics/video/coktelvideo/coktelvideo.h	2009-12-29 17:30:38 UTC (rev 46711)
+++ scummvm/trunk/graphics/video/coktelvideo/coktelvideo.h	2009-12-29 18:07:06 UTC (rev 46712)
@@ -184,6 +184,8 @@
 
 	/** 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 @@
 	void seekFrame(int32 frame, int16 whence = SEEK_SET, bool restart = false);
 
 	State nextFrame();
+	uint32 getFrameWaitTime();
 	void waitEndFrame();
 
 	void copyCurrentFrame(byte *dest,


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list