[Scummvm-cvs-logs] SF.net SVN: scummvm:[40730] scummvm/trunk
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Tue May 19 21:56:54 CEST 2009
Revision: 40730
http://scummvm.svn.sourceforge.net/scummvm/?rev=40730&view=rev
Author: thebluegr
Date: 2009-05-19 19:56:53 +0000 (Tue, 19 May 2009)
Log Message:
-----------
Changed calculations based on frame delay to be based on the scale of 1ms, not 1/100. This fixes the FLIC player and also makes the overall code a bit clearer and easier to understand
Modified Paths:
--------------
scummvm/trunk/engines/sword1/animation.cpp
scummvm/trunk/engines/sword2/animation.cpp
scummvm/trunk/graphics/video/dxa_player.cpp
scummvm/trunk/graphics/video/flic_player.cpp
scummvm/trunk/graphics/video/smk_player.cpp
scummvm/trunk/graphics/video/video_player.cpp
scummvm/trunk/graphics/video/video_player.h
Modified: scummvm/trunk/engines/sword1/animation.cpp
===================================================================
--- scummvm/trunk/engines/sword1/animation.cpp 2009-05-19 17:39:03 UTC (rev 40729)
+++ scummvm/trunk/engines/sword1/animation.cpp 2009-05-19 19:56:53 UTC (rev 40730)
@@ -244,7 +244,7 @@
int32 videoTime = _videoInfo.currentFrame * frameDelay;
int32 audioTime;
- audioTime = (((int32) _mixer->getSoundElapsedTime(*_bgSoundHandle)) * 100);
+ audioTime = (int32) _mixer->getSoundElapsedTime(*_bgSoundHandle);
return videoTime - audioTime;
}
Modified: scummvm/trunk/engines/sword2/animation.cpp
===================================================================
--- scummvm/trunk/engines/sword2/animation.cpp 2009-05-19 17:39:03 UTC (rev 40729)
+++ scummvm/trunk/engines/sword2/animation.cpp 2009-05-19 19:56:53 UTC (rev 40730)
@@ -316,7 +316,7 @@
int32 videoTime = _videoInfo.currentFrame * frameDelay;
int32 audioTime;
- audioTime = (((int32) _mixer->getSoundElapsedTime(*_bgSoundHandle)) * 100);
+ audioTime = (int32) _mixer->getSoundElapsedTime(*_bgSoundHandle);
return videoTime - audioTime;
}
Modified: scummvm/trunk/graphics/video/dxa_player.cpp
===================================================================
--- scummvm/trunk/graphics/video/dxa_player.cpp 2009-05-19 17:39:03 UTC (rev 40729)
+++ scummvm/trunk/graphics/video/dxa_player.cpp 2009-05-19 19:56:53 UTC (rev 40730)
@@ -86,13 +86,13 @@
if (frameRate > 0) {
_videoInfo.frameRate = 1000 / frameRate;
- _videoInfo.frameDelay = frameRate * 100;
+ _videoInfo.frameDelay = frameRate;
} else if (frameRate < 0) {
_videoInfo.frameRate = 100000 / (-frameRate);
- _videoInfo.frameDelay = -frameRate;
+ _videoInfo.frameDelay = -frameRate / 100;
} else {
_videoInfo.frameRate = 10;
- _videoInfo.frameDelay = 10000;
+ _videoInfo.frameDelay = 100;
}
_videoInfo.width = _fileStream->readUint16BE();
Modified: scummvm/trunk/graphics/video/flic_player.cpp
===================================================================
--- scummvm/trunk/graphics/video/flic_player.cpp 2009-05-19 17:39:03 UTC (rev 40729)
+++ scummvm/trunk/graphics/video/flic_player.cpp 2009-05-19 19:56:53 UTC (rev 40730)
@@ -72,9 +72,8 @@
}
_fileStream->readUint16LE(); // flags
// Note: The normal delay is a 32-bit integer (dword), whereas the overriden delay is a 16-bit integer (word)
- // frameDelay is the FLIC "speed", in milliseconds. Our frameDelay is calculated in 1/100 ms, so we convert it here
- _videoInfo.frameDelay = _fileStream->readUint32LE() / 100;
- _videoInfo.frameRate = 100 * 1000 / _videoInfo.frameDelay;
+ _videoInfo.frameDelay = _fileStream->readUint32LE(); // frameDelay is the FLIC "speed", in milliseconds
+ _videoInfo.frameRate = 1000 / _videoInfo.frameDelay;
_fileStream->seek(80);
_offsetFrame1 = _fileStream->readUint32LE();
@@ -207,10 +206,10 @@
case FRAME_TYPE: {
chunkCount = _fileStream->readUint16LE();
// Note: The overriden delay is a 16-bit integer (word), whereas the normal delay is a 32-bit integer (dword)
- uint16 newFrameDelay = _fileStream->readUint16LE() / 100; // "speed", in milliseconds
+ uint16 newFrameDelay = _fileStream->readUint16LE(); // "speed", in milliseconds
if (newFrameDelay > 0) {
_videoInfo.frameDelay = newFrameDelay;
- _videoInfo.frameRate = 100 * 1000 / _videoInfo.frameDelay;
+ _videoInfo.frameRate = 1000 / _videoInfo.frameDelay;
}
_fileStream->readUint16LE(); // reserved, always 0
uint16 newWidth = _fileStream->readUint16LE();
Modified: scummvm/trunk/graphics/video/smk_player.cpp
===================================================================
--- scummvm/trunk/graphics/video/smk_player.cpp 2009-05-19 17:39:03 UTC (rev 40729)
+++ scummvm/trunk/graphics/video/smk_player.cpp 2009-05-19 19:56:53 UTC (rev 40730)
@@ -344,9 +344,9 @@
and how much time *should* have passed.
*/
- audioTime = (g_system->getMillis() - _videoInfo.startTime) * 100;
+ audioTime = g_system->getMillis() - _videoInfo.startTime;
} else
- audioTime = (((int32) _mixer->getSoundElapsedTime(_audioHandle)) * 100);
+ audioTime = (int32) _mixer->getSoundElapsedTime(_audioHandle);
return videoTime - audioTime;
}
@@ -380,13 +380,13 @@
if (frameRate > 0) {
_videoInfo.frameRate = 1000 / frameRate;
- _videoInfo.frameDelay = frameRate * 100;
+ _videoInfo.frameDelay = frameRate;
} else if (frameRate < 0) {
_videoInfo.frameRate = 100000 / (-frameRate);
- _videoInfo.frameDelay = -frameRate;
+ _videoInfo.frameDelay = -frameRate / 100;
} else {
_videoInfo.frameRate = 10;
- _videoInfo.frameDelay = 10000;
+ _videoInfo.frameDelay = 100;
}
// Flags are determined by which bit is set, which can be one of the following:
Modified: scummvm/trunk/graphics/video/video_player.cpp
===================================================================
--- scummvm/trunk/graphics/video/video_player.cpp 2009-05-19 17:39:03 UTC (rev 40729)
+++ scummvm/trunk/graphics/video/video_player.cpp 2009-05-19 19:56:53 UTC (rev 40730)
@@ -88,14 +88,14 @@
Calculate the lag by how much time has gone by since the first frame
and how much time *should* have passed.
*/
- int32 audioTime = (g_system->getMillis() - _videoInfo.startTime) * 100;
+ int32 audioTime = g_system->getMillis() - _videoInfo.startTime;
int32 videoTime = _videoInfo.currentFrame * getFrameDelay();
return videoTime - audioTime;
}
uint32 VideoDecoder::getFrameWaitTime() {
- int32 waitTime = (getFrameDelay() + getAudioLag()) / 100;
+ int32 waitTime = getFrameDelay() + getAudioLag();
if (waitTime < 0)
return 0;
Modified: scummvm/trunk/graphics/video/video_player.h
===================================================================
--- scummvm/trunk/graphics/video/video_player.h 2009-05-19 17:39:03 UTC (rev 40729)
+++ scummvm/trunk/graphics/video/video_player.h 2009-05-19 19:56:53 UTC (rev 40730)
@@ -75,16 +75,16 @@
virtual int32 getFrameRate();
/**
- * Returns the time to wait for each frame in 1/100 ms
- * @return the time to wait for each frame in 1/100 ms
+ * Returns the time to wait for each frame in ms
+ * @return the time to wait for each frame in ms
*/
virtual int32 getFrameDelay();
/**
- * Returns the current A/V lag in 1/100 ms
+ * Returns the current A/V lag in ms
* If > 0, audio lags behind
* If < 0, video lags behind
- * @return the current A/V lag in 1/100 ms
+ * @return the current A/V lag in ms
*/
virtual int32 getAudioLag();
@@ -170,7 +170,7 @@
uint32 height;
uint32 frameCount;
int32 frameRate;
- int32 frameDelay; // 1/100 ms
+ int32 frameDelay; // ms
uint32 frameOffs;
uint32 currentFrame;
uint32 startTime;
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