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

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Thu Sep 30 15:05:40 CEST 2010


Revision: 52954
          http://scummvm.svn.sourceforge.net/scummvm/?rev=52954&view=rev
Author:   drmccoy
Date:     2010-09-30 13:05:40 +0000 (Thu, 30 Sep 2010)

Log Message:
-----------
VIDEO: Allow for Indeo3'd VMDs

Modified Paths:
--------------
    scummvm/trunk/graphics/video/coktel_decoder.cpp

Modified: scummvm/trunk/graphics/video/coktel_decoder.cpp
===================================================================
--- scummvm/trunk/graphics/video/coktel_decoder.cpp	2010-09-30 13:05:12 UTC (rev 52953)
+++ scummvm/trunk/graphics/video/coktel_decoder.cpp	2010-09-30 13:05:40 UTC (rev 52954)
@@ -399,11 +399,11 @@
 
 	rect.clip(_surface.w, _surface.h);
 
-	byte *dst = (byte *)_surface.pixels + (rect.top * _surface.pitch) + rect.left;
+	byte *dst = (byte *)_surface.pixels + (rect.top * _surface.pitch) + rect.left * _surface.bytesPerPixel;
 	for (int i = 0; i < rect.height(); i++) {
-		memcpy(dst, src, rect.width());
+		memcpy(dst, src, rect.width() * _surface.bytesPerPixel);
 
-		src += srcRect.width();
+		src += srcRect.width() * _surface.bytesPerPixel;
 		dst += _surface.pitch;
 	}
 }
@@ -1589,12 +1589,6 @@
 	if (_version & 4)
 		_bytesPerPixel = handle + 1;
 
-	if (_bytesPerPixel != 1) {
-		warning("TODO: _bytesPerPixel = %d", _bytesPerPixel);
-		close();
-		return false;
-	}
-
 	if (_bytesPerPixel > 3) {
 		warning("VMDDecoder::load(): Requested %d bytes per pixel (%d, %d, %d)",
 				_bytesPerPixel, headerLength, handle, _version);
@@ -1696,6 +1690,11 @@
 		_bytesPerPixel = n;
 	}
 
+	if ((_bytesPerPixel > 1) && !_externalCodec) {
+		warning("VMDDecoder::assessVideoProperties(): TODO: Internal _bytesPerPixel == %d", _bytesPerPixel);
+		return false;
+	}
+
 	if (_hasVideo) {
 		if ((_frameDataSize == 0) || (_frameDataSize > 1048576))
 			_frameDataSize = _width * _height + 1000;
@@ -2087,9 +2086,19 @@
 		return false;
 
 	if (_externalCodec) {
-		// TODO
-		warning("_external codec");
-		return false;
+		if (!_codec)
+			return false;
+
+		Common::MemoryReadStream frameStream(_frameData, _frameDataLen);
+		Surface *codecSurf = _codec->decodeImage(&frameStream);
+		if (!codecSurf)
+			return false;
+
+		rect = Common::Rect(_x, _y, _x + codecSurf->w, _y + codecSurf->h);
+		rect.clip(Common::Rect(_x, _y, _x + _width, _y + _height));
+
+		renderBlockWhole((const byte *) codecSurf->pixels, rect);
+		return true;
 	}
 
 	if (_blitMode > 0) {
@@ -2376,6 +2385,9 @@
 }
 
 PixelFormat VMDDecoder::getPixelFormat() const {
+	if (_externalCodec && _codec)
+		return _codec->getPixelFormat();
+
 	return PixelFormat::createFormatCLUT8();
 }
 


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