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

mthreepwood at users.sourceforge.net mthreepwood at users.sourceforge.net
Fri Oct 16 20:32:20 CEST 2009


Revision: 45172
          http://scummvm.svn.sourceforge.net/scummvm/?rev=45172&view=rev
Author:   mthreepwood
Date:     2009-10-16 18:32:20 +0000 (Fri, 16 Oct 2009)

Log Message:
-----------
Override getAudioLag() in the AviDecoder (blatantly borrowed from the SmackerDecoder).

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

Modified: scummvm/trunk/graphics/video/avi_decoder.cpp
===================================================================
--- scummvm/trunk/graphics/video/avi_decoder.cpp	2009-10-16 18:16:23 UTC (rev 45171)
+++ scummvm/trunk/graphics/video/avi_decoder.cpp	2009-10-16 18:32:20 UTC (rev 45172)
@@ -361,6 +361,27 @@
 	return _videoInfo.currentFrame < _videoInfo.frameCount;
 }
 
+int32 AviDecoder::getAudioLag() {
+	if (!_fileStream)
+		return 0;
+
+	int32 frameDelay = getFrameDelay();
+	int32 videoTime = _videoInfo.currentFrame * frameDelay;
+	int32 audioTime;
+
+	if (!_audStream) {
+		/* No audio.
+		   Calculate the lag by how much time has gone by since the first frame
+		   and how much time *should* have passed.
+		*/
+
+		audioTime = (g_system->getMillis() - _videoInfo.startTime) * 100;
+	} else
+		audioTime = (((int32)_mixer->getSoundElapsedTime(*_audHandle)) * 100);
+
+	return videoTime - audioTime;
+}
+
 Codec *AviDecoder::createCodec() {
 	switch (_vidsHeader.streamHandler) {
 		case ID_CRAM:

Modified: scummvm/trunk/graphics/video/avi_decoder.h
===================================================================
--- scummvm/trunk/graphics/video/avi_decoder.h	2009-10-16 18:16:23 UTC (rev 45171)
+++ scummvm/trunk/graphics/video/avi_decoder.h	2009-10-16 18:32:20 UTC (rev 45172)
@@ -188,8 +188,9 @@
 	void closeFile();
 
 	bool decodeNextFrame();
+	int32 getAudioLag();
+	int32 getFrameRate() { return _vidsHeader.rate / _vidsHeader.scale; }
 
-	int32 getFrameRate() { return _vidsHeader.rate / _vidsHeader.scale; }
 private:
 	Audio::Mixer *_mixer;
 	BITMAPINFOHEADER _bmInfo;


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