[Scummvm-cvs-logs] SF.net SVN: scummvm:[49224] scummvm/trunk

mthreepwood at users.sourceforge.net mthreepwood at users.sourceforge.net
Wed May 26 05:43:22 CEST 2010


Revision: 49224
          http://scummvm.svn.sourceforge.net/scummvm/?rev=49224&view=rev
Author:   mthreepwood
Date:     2010-05-26 03:43:21 +0000 (Wed, 26 May 2010)

Log Message:
-----------
Implement QuickTime playback for SCI1.1 Mac. The 'Halfdome' and 'KQ6Movie' videos now play. However, they require multiple edit list support to look completely correct.

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kgraphics.cpp
    scummvm/trunk/graphics/video/qt_decoder.cpp

Modified: scummvm/trunk/engines/sci/engine/kgraphics.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kgraphics.cpp	2010-05-25 23:16:30 UTC (rev 49223)
+++ scummvm/trunk/engines/sci/engine/kgraphics.cpp	2010-05-26 03:43:21 UTC (rev 49224)
@@ -23,8 +23,10 @@
  *
  */
 
+#include "engines/util.h"
 #include "graphics/cursorman.h"
 #include "graphics/video/avi_decoder.h"
+#include "graphics/video/qt_decoder.h"
 #include "graphics/surface.h"
 
 #include "sci/sci.h"
@@ -1080,11 +1082,12 @@
 reg_t kShowMovie(EngineState *s, int argc, reg_t *argv) {
 	// Hide the cursor if it's showing and then show it again if it was
 	// previously visible.
-	bool reshowCursor;
-	
-	reshowCursor = g_sci->_gfxCursor->isVisible();
+	bool reshowCursor = g_sci->_gfxCursor->isVisible();
 	if (reshowCursor)
 		g_sci->_gfxCursor->kernelHide();
+
+	uint16 screenWidth = g_system->getWidth();
+	uint16 screenHeight = g_system->getHeight();
 		
 	Graphics::VideoDecoder *videoDecoder = 0;
 
@@ -1094,8 +1097,18 @@
 		if (g_sci->getPlatform() == Common::kPlatformMacintosh) {
 			// Mac QuickTime
 			// The only argument is the string for the video
-			warning("TODO: Play QuickTime movie '%s'", filename.c_str());
-			return s->r_acc;
+
+			// HACK: Switch to 16bpp graphics for Cinepak.
+			initGraphics(screenWidth, screenHeight, screenWidth > 320, NULL);
+
+			if (g_system->getScreenFormat().bytesPerPixel == 1) {
+				warning("This video requires >8bpp color to be displayed, but could not switch to RGB color mode.");
+				return NULL_REG;
+			}
+
+			videoDecoder = new Graphics::QuickTimeDecoder();
+			if (!videoDecoder->loadFile(filename))
+				error("Could not open '%s'", filename.c_str());
 		} else {
 			// DOS SEQ
 			// SEQ's are called with no subops, just the string and delay
@@ -1110,7 +1123,7 @@
 			}
 		}
 	} else {
-		// Windows AVI (Macintosh QuickTime? Need to check KQ6 Macintosh)
+		// Windows AVI
 		// TODO: This appears to be some sort of subop. case 0 contains the string
 		// for the video, so we'll just play it from there for now.
 
@@ -1142,10 +1155,10 @@
 	}
 
 	if (videoDecoder) {
-		uint16 x = (g_system->getWidth() - videoDecoder->getWidth()) / 2;
-		uint16 y = (g_system->getHeight() - videoDecoder->getHeight()) / 2;
+		uint16 x = (screenWidth - videoDecoder->getWidth()) / 2;
+		uint16 y = (screenHeight - videoDecoder->getHeight()) / 2;
 
-		while (!g_engine->shouldQuit() && !videoDecoder->endOfVideo()) {			
+		while (!g_engine->shouldQuit() && !videoDecoder->endOfVideo()) {
 			if (videoDecoder->needsUpdate()) {
 				Graphics::Surface *frame = videoDecoder->decodeNextFrame();
 				if (frame) {
@@ -1164,9 +1177,15 @@
 
 			g_system->delayMillis(10);
 		}
+
+		// HACK: Switch back to 8bpp if we played a QuickTime video.
+		// We also won't be copying the screen to the SCI screen...
+		if (g_system->getScreenFormat().bytesPerPixel != 1)
+			initGraphics(screenWidth, screenHeight, screenWidth > 320);
+		else
+			g_sci->_gfxScreen->kernelSyncWithFramebuffer();
 		
 		delete videoDecoder;
-		g_sci->_gfxScreen->kernelSyncWithFramebuffer();
 	}
 
 	if (reshowCursor)

Modified: scummvm/trunk/graphics/video/qt_decoder.cpp
===================================================================
--- scummvm/trunk/graphics/video/qt_decoder.cpp	2010-05-25 23:16:30 UTC (rev 49223)
+++ scummvm/trunk/graphics/video/qt_decoder.cpp	2010-05-26 03:43:21 UTC (rev 49224)
@@ -427,7 +427,7 @@
 
 			// Some QuickTime videos with resource forks have mdat chunks
 			// that are of size 0. Adjust it so it's the correct size.
-			if (a.size == 0)
+			if (a.type == MKID_BE('mdat') && a.size == 0)
 				a.size = _fd->size();
 		}
 


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