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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Wed Dec 30 11:09:51 CET 2009


Revision: 46737
          http://scummvm.svn.sourceforge.net/scummvm/?rev=46737&view=rev
Author:   thebluegr
Date:     2009-12-30 10:09:48 +0000 (Wed, 30 Dec 2009)

Log Message:
-----------
The wrapper for the VMD decoder is only used in the SCI engine for SCI32 games, so moved it inside the engine, instead of common code. Added support for VMD video playing from the "play_video" console command

Modified Paths:
--------------
    scummvm/trunk/engines/sci/console.cpp
    scummvm/trunk/engines/sci/engine/kgraphics.cpp
    scummvm/trunk/engines/sci/module.mk
    scummvm/trunk/graphics/module.mk

Added Paths:
-----------
    scummvm/trunk/engines/sci/video/
    scummvm/trunk/engines/sci/video/seq_decoder.cpp
    scummvm/trunk/engines/sci/video/seq_decoder.h
    scummvm/trunk/engines/sci/video/vmd_decoder.cpp
    scummvm/trunk/engines/sci/video/vmd_decoder.h

Removed Paths:
-------------
    scummvm/trunk/engines/sci/seq_decoder.cpp
    scummvm/trunk/engines/sci/seq_decoder.h
    scummvm/trunk/graphics/video/vmd_decoder.cpp
    scummvm/trunk/graphics/video/vmd_decoder.h

Modified: scummvm/trunk/engines/sci/console.cpp
===================================================================
--- scummvm/trunk/engines/sci/console.cpp	2009-12-30 09:12:07 UTC (rev 46736)
+++ scummvm/trunk/engines/sci/console.cpp	2009-12-30 10:09:48 UTC (rev 46737)
@@ -52,7 +52,10 @@
 #include "sci/gui/gui_cursor.h"
 
 #include "graphics/video/avi_decoder.h"
-#include "sci/seq_decoder.h"
+#include "sci/video/seq_decoder.h"
+#ifdef ENABLE_SCI32
+#include "sci/video/vmd_decoder.h"
+#endif
 
 #include "common/savefile.h"
 
@@ -245,6 +248,18 @@
 			aviDecoder->closeFile();
 			delete player;
 			delete aviDecoder;
+		} else if (_videoFile.hasSuffix(".vmd")) {
+#ifdef ENABLE_SCI32
+			VMDDecoder *vmdDecoder = new VMDDecoder(g_system->getMixer());
+			Graphics::VideoPlayer *player = new Graphics::VideoPlayer(vmdDecoder);
+			if (vmdDecoder->loadFile(_videoFile.c_str()))
+				player->playVideo();
+			else
+				DebugPrintf("Failed to open movie file %s\n", _videoFile.c_str());
+			vmdDecoder->closeFile();
+			delete player;
+			delete vmdDecoder;
+#endif
 		}
 
 		_vm->_gamestate->_gui->showCursor();
@@ -1139,7 +1154,7 @@
 
 bool Console::cmdPlayVideo(int argc, const char **argv) {
 	if (argc < 2) {
-		DebugPrintf("Plays a SEQ or AVI video.\n");
+		DebugPrintf("Plays a SEQ, AVI or VMD video.\n");
 		DebugPrintf("Usage: %s <video file name> <delay>\n", argv[0]);
 		DebugPrintf("The video file name should include the extension\n");
 		DebugPrintf("Delay is only used in SEQ videos and is measured in ticks (default: 10)\n");
@@ -1149,7 +1164,7 @@
 	Common::String filename = argv[1];
 	filename.toLowercase();
 
-	if (filename.hasSuffix(".seq") || filename.hasSuffix(".avi")) {
+	if (filename.hasSuffix(".seq") || filename.hasSuffix(".avi") || filename.hasSuffix(".vmd")) {
 		_videoFile = filename;
 		_videoFrameDelay = (argc == 2) ? 10 : atoi(argv[2]);
 		return false;

Modified: scummvm/trunk/engines/sci/engine/kgraphics.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kgraphics.cpp	2009-12-30 09:12:07 UTC (rev 46736)
+++ scummvm/trunk/engines/sci/engine/kgraphics.cpp	2009-12-30 10:09:48 UTC (rev 46737)
@@ -30,7 +30,7 @@
 #include "sci/sci.h"
 #include "sci/debug.h"	// for g_debug_sleeptime_factor
 #include "sci/resource.h"
-#include "sci/seq_decoder.h"
+#include "sci/video/seq_decoder.h"
 #include "sci/engine/state.h"
 #include "sci/engine/kernel.h"
 #include "sci/gfx/operations.h"

Modified: scummvm/trunk/engines/sci/module.mk
===================================================================
--- scummvm/trunk/engines/sci/module.mk	2009-12-30 09:12:07 UTC (rev 46736)
+++ scummvm/trunk/engines/sci/module.mk	2009-12-30 10:09:48 UTC (rev 46737)
@@ -7,7 +7,6 @@
 	event.o \
 	resource.o \
 	sci.o \
-	seq_decoder.o \
 	vocabulary.o \
 	engine/game.o \
 	engine/gc.o \
@@ -80,7 +79,9 @@
 	sfx/seq/map-mt32-to-gm.o \
 	sfx/softseq/adlib.o \
 	sfx/softseq/amiga.o \
-	sfx/softseq/pcjr.o
+	sfx/softseq/pcjr.o \
+	video/seq_decoder.o \
+	video/vmd_decoder.o
 	
 ifdef ENABLE_SCI32
 MODULE_OBJS += \

Deleted: scummvm/trunk/engines/sci/seq_decoder.cpp
===================================================================
--- scummvm/trunk/engines/sci/seq_decoder.cpp	2009-12-30 09:12:07 UTC (rev 46736)
+++ scummvm/trunk/engines/sci/seq_decoder.cpp	2009-12-30 10:09:48 UTC (rev 46737)
@@ -1,241 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#include "common/debug.h"
-#include "common/endian.h"
-#include "common/archive.h"
-#include "common/system.h"
-#include "common/util.h"
-
-#include "graphics/surface.h"
-
-#include "sci/seq_decoder.h"
-
-namespace Sci {
-
-enum seqPalTypes {
-	kSeqPalVariable = 0,
-	kSeqPalConstant = 1
-};
-
-enum seqFrameTypes {
-	kSeqFrameFull = 0,
-	kSeqFrameDiff = 1
-};
-
-SeqDecoder::~SeqDecoder() {
-	closeFile();
-}
-
-bool SeqDecoder::loadFile(const char *fileName, int frameDelay) {
-	closeFile();
-
-	_fileStream = SearchMan.createReadStreamForMember(fileName);
-	if (!_fileStream)
-		return false;
-
-	// Seek to the first frame
-	_videoInfo.currentFrame = 0;
-
-	_videoInfo.width = 320;
-	_videoInfo.height = 200;
-	_videoInfo.frameCount = _fileStream->readUint16LE();
-	// Our frameDelay is calculated in 1/100 ms, so we convert it here
-	_videoInfo.frameDelay = 100 * frameDelay * 1000 / 60;
-	_videoFrameBuffer = new byte[_videoInfo.width * _videoInfo.height];
-
-	// Set palette
-	int paletteSize = _fileStream->readUint32LE();
-
-	byte *paletteData = new byte[paletteSize];
-	_fileStream->read(paletteData, paletteSize);
-
-	// SCI1.1 palette
-	byte palFormat = paletteData[32];
-	uint16 palColorStart = READ_LE_UINT16(paletteData + 25);
-	uint16 palColorCount = READ_LE_UINT16(paletteData + 29);
-
-	byte palette[256 * 4];
-	int palOffset = 37;
-
-	for (uint16 colorNo = palColorStart; colorNo < palColorStart + palColorCount; colorNo++) {
-		if (palFormat == kSeqPalVariable)
-			palOffset++;
-		palette[colorNo * 4 + 0] = paletteData[palOffset++];
-		palette[colorNo * 4 + 1] = paletteData[palOffset++];
-		palette[colorNo * 4 + 2] = paletteData[palOffset++];
-		palette[colorNo * 4 + 3] = 0;
-	}
-
-	g_system->setPalette(palette, 0, 256);
-
-	delete[] paletteData;
-
-	_videoInfo.firstframeOffset = _fileStream->pos();
-
-	return true;
-}
-
-void SeqDecoder::closeFile() {
-	if (!_fileStream)
-		return;
-
-	delete _fileStream;
-	_fileStream = 0;
-
-	delete[] _videoFrameBuffer;
-	_videoFrameBuffer = 0;
-}
-
-bool SeqDecoder::decodeNextFrame() {
-	int16 frameWidth = _fileStream->readUint16LE();
-	int16 frameHeight = _fileStream->readUint16LE();
-	int16 frameLeft = _fileStream->readUint16LE();
-	int16 frameTop = _fileStream->readUint16LE();
-	byte colorKey = _fileStream->readByte();
-	byte frameType = _fileStream->readByte();
-	_fileStream->skip(2);
-	uint16 frameSize = _fileStream->readUint16LE();
-	_fileStream->skip(2);
-	uint16 rleSize = _fileStream->readUint16LE();
-	_fileStream->skip(6);
-	uint32 offset = _fileStream->readUint32LE();
-
-	_fileStream->seek(offset);
-
-	if (_videoInfo.currentFrame == 0)
-		_videoInfo.startTime = g_system->getMillis();
-
-	if (frameType == kSeqFrameFull) {
-		byte *dst = _videoFrameBuffer + frameTop * 320 + frameLeft;
-		
-		byte *linebuf = new byte[frameWidth];
-
-		do {
-			_fileStream->read(linebuf, frameWidth);
-			memcpy(dst, linebuf, frameWidth);
-			dst += 320;
-		} while (--frameHeight);
-
-		delete[] linebuf;
-	} else {
-		byte *buf = new byte[frameSize];
-		_fileStream->read(buf, frameSize);
-		decodeFrame(buf, rleSize, buf + rleSize, frameSize - rleSize, _videoFrameBuffer + 320 * frameTop, frameLeft, frameWidth, frameHeight, colorKey);
-		delete[] buf;
-	}
-
-	return ++_videoInfo.currentFrame < _videoInfo.frameCount;
-}
-
-#define WRITE_TO_BUFFER(n) \
-	if (writeRow * 320 + writeCol + (n) > 320 * height) { \
-		warning("SEQ player: writing out of bounds, aborting"); \
-		return false; \
-	} \
-	if (litPos + (n) > litSize) { \
-		warning("SEQ player: reading out of bounds, aborting"); \
-	} \
-	memcpy(dest + writeRow * 320 + writeCol, litData + litPos, n);
-
-bool SeqDecoder::decodeFrame(byte *rleData, int rleSize, byte *litData, int litSize, byte *dest, int left, int width, int height, int colorKey) {
-	int writeRow = 0;
-	int writeCol = left;
-	int litPos = 0;
-	int rlePos = 0;
-
-	while (rlePos < rleSize) {
-		int op = rleData[rlePos++];
-
-		if ((op & 0xc0) == 0xc0) {
-			op &= 0x3f;
-			if (op == 0) {
-				// Go to next line in target buffer
-				writeRow++;
-				writeCol = left;
-			} else {
-				// Skip bytes on current line
-				writeCol += op;
-			}
-		} else if (op & 0x80) {
-			op &= 0x3f;
-			if (op == 0) {
-				// Copy remainder of current line
-				int rem = width - (writeCol - left);
-
-				WRITE_TO_BUFFER(rem);
-				writeRow++;
-				writeCol = left;
-				litPos += rem;
-			} else {
-				// Copy bytes
-				WRITE_TO_BUFFER(op);
-				writeCol += op;
-				litPos += op;
-			}
-		} else {
-			uint16 count = ((op & 7) << 8) | rleData[rlePos++];
-
-			switch (op >> 3) {
-			case 2:
-				// Skip bytes
-				writeCol += count;
-				break;
-			case 3:
-				// Copy bytes
-				WRITE_TO_BUFFER(count);
-				writeCol += count;
-				litPos += count;
-				break;
-			case 6: {
-				// Copy rows
-				if (count == 0)
-					count = height - writeRow;
-
-				for (int i = 0; i < count; i++) {
-					WRITE_TO_BUFFER(width);
-					litPos += width;
-					writeRow++;
-				}
-				break;
-			}
-			case 7:
-				// Skip rows
-				if (count == 0)
-					count = height - writeRow;
-
-				writeRow += count;
-				break;
-			default:
-				warning("Unsupported operation %i encountered", op >> 3);
-				return false;
-			}
-		}
-	}
-
-	return true;
-}
-
-} // End of namespace Sci

Deleted: scummvm/trunk/engines/sci/seq_decoder.h
===================================================================
--- scummvm/trunk/engines/sci/seq_decoder.h	2009-12-30 09:12:07 UTC (rev 46736)
+++ scummvm/trunk/engines/sci/seq_decoder.h	2009-12-30 10:09:48 UTC (rev 46737)
@@ -1,67 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#ifndef SEQ_DECODER_H
-#define SEQ_DECODER_H
-
-#include "graphics/video/video_player.h"
-
-namespace Sci {
-
-/**
- * Implementation of the Sierra SEQ decoder, used in KQ6 DOS floppy/CD and GK1 DOS
- */
-class SeqDecoder : public Graphics::VideoDecoder {
-public:
-	SeqDecoder() {}
-	virtual ~SeqDecoder();
-
-	/**
-	 * Load a SEQ encoded video file
-	 * @param filename	the filename to load
-	 */
-	bool loadFile(const char *fileName) { return loadFile(fileName, 10); }
-
-	/**
-	 * Load a SEQ encoded video file
-	 * @param filename	the filename to load
-	 * @param frameDelay the delay between frames, in ticks
-	 */
-	bool loadFile(const char *fileName, int frameDelay);
-
-	/**
-	 * Close a SEQ encoded video file
-	 */
-	void closeFile();
-
-	bool decodeNextFrame();
-
-private:
-	bool decodeFrame(byte *rleData, int rleSize, byte *litData, int litSize, byte *dest, int left, int width, int height, int colorKey);
-};
-
-} // End of namespace Sci
-
-#endif


Property changes on: scummvm/trunk/engines/sci/video
___________________________________________________________________
Added: svn:ignore
   + .deps
*.o
lib*.a


Copied: scummvm/trunk/engines/sci/video/seq_decoder.cpp (from rev 46730, scummvm/trunk/engines/sci/seq_decoder.cpp)
===================================================================
--- scummvm/trunk/engines/sci/video/seq_decoder.cpp	                        (rev 0)
+++ scummvm/trunk/engines/sci/video/seq_decoder.cpp	2009-12-30 10:09:48 UTC (rev 46737)
@@ -0,0 +1,241 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#include "common/debug.h"
+#include "common/endian.h"
+#include "common/archive.h"
+#include "common/system.h"
+#include "common/util.h"
+
+#include "graphics/surface.h"
+
+#include "sci/video/seq_decoder.h"
+
+namespace Sci {
+
+enum seqPalTypes {
+	kSeqPalVariable = 0,
+	kSeqPalConstant = 1
+};
+
+enum seqFrameTypes {
+	kSeqFrameFull = 0,
+	kSeqFrameDiff = 1
+};
+
+SeqDecoder::~SeqDecoder() {
+	closeFile();
+}
+
+bool SeqDecoder::loadFile(const char *fileName, int frameDelay) {
+	closeFile();
+
+	_fileStream = SearchMan.createReadStreamForMember(fileName);
+	if (!_fileStream)
+		return false;
+
+	// Seek to the first frame
+	_videoInfo.currentFrame = 0;
+
+	_videoInfo.width = 320;
+	_videoInfo.height = 200;
+	_videoInfo.frameCount = _fileStream->readUint16LE();
+	// Our frameDelay is calculated in 1/100 ms, so we convert it here
+	_videoInfo.frameDelay = 100 * frameDelay * 1000 / 60;
+	_videoFrameBuffer = new byte[_videoInfo.width * _videoInfo.height];
+
+	// Set palette
+	int paletteSize = _fileStream->readUint32LE();
+
+	byte *paletteData = new byte[paletteSize];
+	_fileStream->read(paletteData, paletteSize);
+
+	// SCI1.1 palette
+	byte palFormat = paletteData[32];
+	uint16 palColorStart = READ_LE_UINT16(paletteData + 25);
+	uint16 palColorCount = READ_LE_UINT16(paletteData + 29);
+
+	byte palette[256 * 4];
+	int palOffset = 37;
+
+	for (uint16 colorNo = palColorStart; colorNo < palColorStart + palColorCount; colorNo++) {
+		if (palFormat == kSeqPalVariable)
+			palOffset++;
+		palette[colorNo * 4 + 0] = paletteData[palOffset++];
+		palette[colorNo * 4 + 1] = paletteData[palOffset++];
+		palette[colorNo * 4 + 2] = paletteData[palOffset++];
+		palette[colorNo * 4 + 3] = 0;
+	}
+
+	g_system->setPalette(palette, 0, 256);
+
+	delete[] paletteData;
+
+	_videoInfo.firstframeOffset = _fileStream->pos();
+
+	return true;
+}
+
+void SeqDecoder::closeFile() {
+	if (!_fileStream)
+		return;
+
+	delete _fileStream;
+	_fileStream = 0;
+
+	delete[] _videoFrameBuffer;
+	_videoFrameBuffer = 0;
+}
+
+bool SeqDecoder::decodeNextFrame() {
+	int16 frameWidth = _fileStream->readUint16LE();
+	int16 frameHeight = _fileStream->readUint16LE();
+	int16 frameLeft = _fileStream->readUint16LE();
+	int16 frameTop = _fileStream->readUint16LE();
+	byte colorKey = _fileStream->readByte();
+	byte frameType = _fileStream->readByte();
+	_fileStream->skip(2);
+	uint16 frameSize = _fileStream->readUint16LE();
+	_fileStream->skip(2);
+	uint16 rleSize = _fileStream->readUint16LE();
+	_fileStream->skip(6);
+	uint32 offset = _fileStream->readUint32LE();
+
+	_fileStream->seek(offset);
+
+	if (_videoInfo.currentFrame == 0)
+		_videoInfo.startTime = g_system->getMillis();
+
+	if (frameType == kSeqFrameFull) {
+		byte *dst = _videoFrameBuffer + frameTop * 320 + frameLeft;
+		
+		byte *linebuf = new byte[frameWidth];
+
+		do {
+			_fileStream->read(linebuf, frameWidth);
+			memcpy(dst, linebuf, frameWidth);
+			dst += 320;
+		} while (--frameHeight);
+
+		delete[] linebuf;
+	} else {
+		byte *buf = new byte[frameSize];
+		_fileStream->read(buf, frameSize);
+		decodeFrame(buf, rleSize, buf + rleSize, frameSize - rleSize, _videoFrameBuffer + 320 * frameTop, frameLeft, frameWidth, frameHeight, colorKey);
+		delete[] buf;
+	}
+
+	return ++_videoInfo.currentFrame < _videoInfo.frameCount;
+}
+
+#define WRITE_TO_BUFFER(n) \
+	if (writeRow * 320 + writeCol + (n) > 320 * height) { \
+		warning("SEQ player: writing out of bounds, aborting"); \
+		return false; \
+	} \
+	if (litPos + (n) > litSize) { \
+		warning("SEQ player: reading out of bounds, aborting"); \
+	} \
+	memcpy(dest + writeRow * 320 + writeCol, litData + litPos, n);
+
+bool SeqDecoder::decodeFrame(byte *rleData, int rleSize, byte *litData, int litSize, byte *dest, int left, int width, int height, int colorKey) {
+	int writeRow = 0;
+	int writeCol = left;
+	int litPos = 0;
+	int rlePos = 0;
+
+	while (rlePos < rleSize) {
+		int op = rleData[rlePos++];
+
+		if ((op & 0xc0) == 0xc0) {
+			op &= 0x3f;
+			if (op == 0) {
+				// Go to next line in target buffer
+				writeRow++;
+				writeCol = left;
+			} else {
+				// Skip bytes on current line
+				writeCol += op;
+			}
+		} else if (op & 0x80) {
+			op &= 0x3f;
+			if (op == 0) {
+				// Copy remainder of current line
+				int rem = width - (writeCol - left);
+
+				WRITE_TO_BUFFER(rem);
+				writeRow++;
+				writeCol = left;
+				litPos += rem;
+			} else {
+				// Copy bytes
+				WRITE_TO_BUFFER(op);
+				writeCol += op;
+				litPos += op;
+			}
+		} else {
+			uint16 count = ((op & 7) << 8) | rleData[rlePos++];
+
+			switch (op >> 3) {
+			case 2:
+				// Skip bytes
+				writeCol += count;
+				break;
+			case 3:
+				// Copy bytes
+				WRITE_TO_BUFFER(count);
+				writeCol += count;
+				litPos += count;
+				break;
+			case 6: {
+				// Copy rows
+				if (count == 0)
+					count = height - writeRow;
+
+				for (int i = 0; i < count; i++) {
+					WRITE_TO_BUFFER(width);
+					litPos += width;
+					writeRow++;
+				}
+				break;
+			}
+			case 7:
+				// Skip rows
+				if (count == 0)
+					count = height - writeRow;
+
+				writeRow += count;
+				break;
+			default:
+				warning("Unsupported operation %i encountered", op >> 3);
+				return false;
+			}
+		}
+	}
+
+	return true;
+}
+
+} // End of namespace Sci

Copied: scummvm/trunk/engines/sci/video/seq_decoder.h (from rev 46730, scummvm/trunk/engines/sci/seq_decoder.h)
===================================================================
--- scummvm/trunk/engines/sci/video/seq_decoder.h	                        (rev 0)
+++ scummvm/trunk/engines/sci/video/seq_decoder.h	2009-12-30 10:09:48 UTC (rev 46737)
@@ -0,0 +1,67 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#ifndef SEQ_DECODER_H
+#define SEQ_DECODER_H
+
+#include "graphics/video/video_player.h"
+
+namespace Sci {
+
+/**
+ * Implementation of the Sierra SEQ decoder, used in KQ6 DOS floppy/CD and GK1 DOS
+ */
+class SeqDecoder : public Graphics::VideoDecoder {
+public:
+	SeqDecoder() {}
+	virtual ~SeqDecoder();
+
+	/**
+	 * Load a SEQ encoded video file
+	 * @param filename	the filename to load
+	 */
+	bool loadFile(const char *fileName) { return loadFile(fileName, 10); }
+
+	/**
+	 * Load a SEQ encoded video file
+	 * @param filename	the filename to load
+	 * @param frameDelay the delay between frames, in ticks
+	 */
+	bool loadFile(const char *fileName, int frameDelay);
+
+	/**
+	 * Close a SEQ encoded video file
+	 */
+	void closeFile();
+
+	bool decodeNextFrame();
+
+private:
+	bool decodeFrame(byte *rleData, int rleSize, byte *litData, int litSize, byte *dest, int left, int width, int height, int colorKey);
+};
+
+} // End of namespace Sci
+
+#endif

Copied: scummvm/trunk/engines/sci/video/vmd_decoder.cpp (from rev 46730, scummvm/trunk/graphics/video/vmd_decoder.cpp)
===================================================================
--- scummvm/trunk/engines/sci/video/vmd_decoder.cpp	                        (rev 0)
+++ scummvm/trunk/engines/sci/video/vmd_decoder.cpp	2009-12-30 10:09:48 UTC (rev 46737)
@@ -0,0 +1,131 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#ifdef ENABLE_SCI32
+
+#include "sci/video/vmd_decoder.h"
+
+#include "common/archive.h"
+#include "common/endian.h"
+#include "common/util.h"
+#include "common/stream.h"
+#include "common/system.h"
+
+#include "graphics/dither.h"
+
+#include "sound/mixer.h"
+#include "sound/audiostream.h"
+
+namespace Sci {
+
+VMDDecoder::VMDDecoder(Audio::Mixer *mixer) : _mixer(mixer) {
+	_vmdDecoder = new Graphics::Vmd(new Graphics::PaletteLUT(5, Graphics::PaletteLUT::kPaletteYUV));
+}
+
+VMDDecoder::~VMDDecoder() {
+	closeFile();
+}
+
+uint32 VMDDecoder::getFrameWaitTime() {
+	return _vmdDecoder->getFrameWaitTime();
+}
+
+bool VMDDecoder::loadFile(const char *fileName) {
+	closeFile();
+
+	_fileStream = SearchMan.createReadStreamForMember(fileName);
+	if (!_fileStream)
+		return false;
+
+	if (!_vmdDecoder->load(*_fileStream))
+		return false;
+
+	if (_vmdDecoder->getFeatures() & Graphics::CoktelVideo::kFeaturesPalette) {
+		getPalette();
+		setPalette(_palette);
+	}
+
+	if (_vmdDecoder->getFeatures() & Graphics::CoktelVideo::kFeaturesSound)
+		_vmdDecoder->enableSound(*_mixer);
+
+	_videoInfo.width = _vmdDecoder->getWidth();
+	_videoInfo.height = _vmdDecoder->getHeight();
+	_videoInfo.frameCount = _vmdDecoder->getFramesCount();
+	_videoInfo.frameRate = _vmdDecoder->getFrameRate();
+	_videoInfo.frameDelay = _videoInfo.frameRate * 100;
+	_videoInfo.currentFrame = 0;
+	_videoInfo.firstframeOffset = 0;	// not really necessary for VMDs
+
+	if (_vmdDecoder->hasExtraData())
+		warning("This VMD video has extra embedded data, which is currently not handled");
+
+	_videoFrameBuffer = new byte[_videoInfo.width * _videoInfo.height];
+	memset(_videoFrameBuffer, 0, _videoInfo.width * _videoInfo.height);
+
+	_vmdDecoder->setVideoMemory(_videoFrameBuffer, _videoInfo.width, _videoInfo.height);
+
+	return true;
+}
+
+void VMDDecoder::closeFile() {
+	if (!_fileStream)
+		return;
+
+	_vmdDecoder->unload();
+
+	delete _fileStream;
+	_fileStream = 0;
+
+	delete[] _videoFrameBuffer;
+	_videoFrameBuffer = 0;
+}
+
+bool VMDDecoder::decodeNextFrame() {
+	if (_videoInfo.currentFrame == 0)
+		_videoInfo.startTime = g_system->getMillis();
+
+	Graphics::CoktelVideo::State state = _vmdDecoder->nextFrame();
+
+	if (state.flags & Graphics::CoktelVideo::kStatePalette) {
+		getPalette();
+		setPalette(_palette);
+	}
+
+	return ++_videoInfo.currentFrame < _videoInfo.frameCount;
+}
+
+void VMDDecoder::getPalette() {
+	const byte *pal = _vmdDecoder->getPalette();
+
+	for (int i = 0; i < 256; i++) {
+		_palette[i * 3 + 0] = pal[i * 3 + 0] << 2;
+		_palette[i * 3 + 1] = pal[i * 3 + 1] << 2;
+		_palette[i * 3 + 2] = pal[i * 3 + 2] << 2;
+	}
+}
+
+} // End of namespace Graphics
+
+#endif

Copied: scummvm/trunk/engines/sci/video/vmd_decoder.h (from rev 46730, scummvm/trunk/graphics/video/vmd_decoder.h)
===================================================================
--- scummvm/trunk/engines/sci/video/vmd_decoder.h	                        (rev 0)
+++ scummvm/trunk/engines/sci/video/vmd_decoder.h	2009-12-30 10:09:48 UTC (rev 46737)
@@ -0,0 +1,77 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#ifdef ENABLE_SCI32
+
+#ifndef GRAPHICS_VIDEO_VMD_DECODER_H
+#define GRAPHICS_VIDEO_VMD_DECODER_H
+
+#include "graphics/video/coktelvideo/coktelvideo.h"
+#include "graphics/video/video_player.h"
+#include "sound/mixer.h"
+
+namespace Sci {
+
+/**
+ * Wrapper for the Coktel Vision VMD video decoder
+ * for videos by Coktel Vision/Sierra.
+ *
+ * Video decoder used in engines:
+ *  - gob (without this wrapper)
+ *  - sci
+ */
+	class VMDDecoder : public Graphics::VideoDecoder {
+public:
+	VMDDecoder(Audio::Mixer *mixer);
+	virtual ~VMDDecoder();
+
+	uint32 getFrameWaitTime();
+
+	/**
+	 * Load a VMD encoded video file
+	 * @param filename	the filename to load
+	 */
+	bool loadFile(const char *filename);
+
+	/**
+	 * Close a VMD encoded video file
+	 */
+	void closeFile();
+
+	bool decodeNextFrame();
+
+private:
+	Graphics::Vmd *_vmdDecoder;
+	Audio::Mixer *_mixer;
+	byte _palette[256 * 3];
+
+	void getPalette();
+};
+
+} // End of namespace Graphics
+
+#endif
+
+#endif

Modified: scummvm/trunk/graphics/module.mk
===================================================================
--- scummvm/trunk/graphics/module.mk	2009-12-30 09:12:07 UTC (rev 46736)
+++ scummvm/trunk/graphics/module.mk	2009-12-30 10:09:48 UTC (rev 46737)
@@ -26,7 +26,6 @@
 	video/flic_decoder.o \
 	video/mpeg_player.o \
 	video/smk_decoder.o \
-	video/vmd_decoder.o \
 	video/video_player.o \
 	video/codecs/msvideo1.o \
 	video/coktelvideo/indeo3.o \

Deleted: scummvm/trunk/graphics/video/vmd_decoder.cpp
===================================================================
--- scummvm/trunk/graphics/video/vmd_decoder.cpp	2009-12-30 09:12:07 UTC (rev 46736)
+++ scummvm/trunk/graphics/video/vmd_decoder.cpp	2009-12-30 10:09:48 UTC (rev 46737)
@@ -1,131 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#include "graphics/video/vmd_decoder.h"
-
-#ifdef GRAPHICS_VIDEO_COKTELVIDEO_H
-
-#include "common/archive.h"
-#include "common/endian.h"
-#include "common/util.h"
-#include "common/stream.h"
-#include "common/system.h"
-
-#include "graphics/dither.h"
-
-#include "sound/mixer.h"
-#include "sound/audiostream.h"
-
-namespace Graphics {
-
-VMDDecoder::VMDDecoder(Audio::Mixer *mixer) : _mixer(mixer) {
-	_vmdDecoder = new Vmd(new Graphics::PaletteLUT(5, PaletteLUT::kPaletteYUV));
-}
-
-VMDDecoder::~VMDDecoder() {
-	closeFile();
-}
-
-uint32 VMDDecoder::getFrameWaitTime() {
-	return _vmdDecoder->getFrameWaitTime();
-}
-
-bool VMDDecoder::loadFile(const char *fileName) {
-	closeFile();
-
-	_fileStream = SearchMan.createReadStreamForMember(fileName);
-	if (!_fileStream)
-		return false;
-
-	if (!_vmdDecoder->load(*_fileStream))
-		return false;
-
-	if (_vmdDecoder->getFeatures() & CoktelVideo::kFeaturesPalette) {
-		getPalette();
-		setPalette(_palette);
-	}
-
-	if (_vmdDecoder->getFeatures() & CoktelVideo::kFeaturesSound)
-		_vmdDecoder->enableSound(*_mixer);
-
-	_videoInfo.width = _vmdDecoder->getWidth();
-	_videoInfo.height = _vmdDecoder->getHeight();
-	_videoInfo.frameCount = _vmdDecoder->getFramesCount();
-	_videoInfo.frameRate = _vmdDecoder->getFrameRate();
-	_videoInfo.frameDelay = _videoInfo.frameRate * 100;
-	_videoInfo.currentFrame = 0;
-	_videoInfo.firstframeOffset = 0;	// not really necessary for VMDs
-
-	if (_vmdDecoder->hasExtraData())
-		warning("This VMD video has extra embedded data, which is currently not handled");
-
-	_videoFrameBuffer = new byte[_videoInfo.width * _videoInfo.height];
-	memset(_videoFrameBuffer, 0, _videoInfo.width * _videoInfo.height);
-
-	_vmdDecoder->setVideoMemory(_videoFrameBuffer, _videoInfo.width, _videoInfo.height);
-
-	return true;
-}
-
-void VMDDecoder::closeFile() {
-	if (!_fileStream)
-		return;
-
-	_vmdDecoder->unload();
-
-	delete _fileStream;
-	_fileStream = 0;
-
-	delete[] _videoFrameBuffer;
-	_videoFrameBuffer = 0;
-}
-
-bool VMDDecoder::decodeNextFrame() {
-	if (_videoInfo.currentFrame == 0)
-		_videoInfo.startTime = g_system->getMillis();
-
-	CoktelVideo::State state = _vmdDecoder->nextFrame();
-
-	if (state.flags & CoktelVideo::kStatePalette) {
-		getPalette();
-		setPalette(_palette);
-	}
-
-	return ++_videoInfo.currentFrame < _videoInfo.frameCount;
-}
-
-void VMDDecoder::getPalette() {
-	const byte *pal = _vmdDecoder->getPalette();
-
-	for (int i = 0; i < 256; i++) {
-		_palette[i * 3 + 0] = pal[i * 3 + 0] << 2;
-		_palette[i * 3 + 1] = pal[i * 3 + 1] << 2;
-		_palette[i * 3 + 2] = pal[i * 3 + 2] << 2;
-	}
-}
-
-} // End of namespace Graphics
-
-#endif

Deleted: scummvm/trunk/graphics/video/vmd_decoder.h
===================================================================
--- scummvm/trunk/graphics/video/vmd_decoder.h	2009-12-30 09:12:07 UTC (rev 46736)
+++ scummvm/trunk/graphics/video/vmd_decoder.h	2009-12-30 10:09:48 UTC (rev 46737)
@@ -1,78 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#include "graphics/video/coktelvideo/coktelvideo.h"
-
-#ifdef GRAPHICS_VIDEO_COKTELVIDEO_H
-
-#ifndef GRAPHICS_VIDEO_VMD_DECODER_H
-#define GRAPHICS_VIDEO_VMD_DECODER_H
-
-#include "graphics/video/video_player.h"
-#include "sound/mixer.h"
-
-namespace Graphics {
-
-/**
- * Wrapper for the Coktel Vision VMD video decoder
- * for videos by Coktel Vision/Sierra.
- *
- * Video decoder used in engines:
- *  - gob (without this wrapper)
- *  - sci
- */
-class VMDDecoder : public VideoDecoder {
-public:
-	VMDDecoder(Audio::Mixer *mixer);
-	virtual ~VMDDecoder();
-
-	uint32 getFrameWaitTime();
-
-	/**
-	 * Load a VMD encoded video file
-	 * @param filename	the filename to load
-	 */
-	bool loadFile(const char *filename);
-
-	/**
-	 * Close a VMD encoded video file
-	 */
-	void closeFile();
-
-	bool decodeNextFrame();
-
-private:
-	Vmd *_vmdDecoder;
-	Audio::Mixer *_mixer;
-	byte _palette[256 * 3];
-
-	void getPalette();
-};
-
-} // End of namespace Graphics
-
-#endif
-
-#endif


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