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

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Sun Jan 16 17:27:53 CET 2011


Revision: 55259
          http://scummvm.svn.sourceforge.net/scummvm/?rev=55259&view=rev
Author:   drmccoy
Date:     2011-01-16 16:27:52 +0000 (Sun, 16 Jan 2011)

Log Message:
-----------
VIDEO: Add color mode methods

To query the video's color mode and notifying the decoder that
the system's color mode changed.

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

Modified: scummvm/trunk/graphics/video/coktel_decoder.cpp
===================================================================
--- scummvm/trunk/graphics/video/coktel_decoder.cpp	2011-01-16 16:27:22 UTC (rev 55258)
+++ scummvm/trunk/graphics/video/coktel_decoder.cpp	2011-01-16 16:27:52 UTC (rev 55259)
@@ -211,6 +211,9 @@
 	_audioStream  = 0;
 }
 
+void CoktelDecoder::colorModeChanged() {
+}
+
 bool CoktelDecoder::getFrameCoords(int16 frame, int16 &x, int16 &y, int16 &width, int16 &height) {
 	return false;
 }
@@ -231,6 +234,10 @@
 	return -1;
 }
 
+bool CoktelDecoder::isPaletted() const {
+	return true;
+}
+
 void CoktelDecoder::close() {
 	disableSound();
 	freeSurface();
@@ -1523,7 +1530,7 @@
 	_soundBytesPerSample(0), _soundStereo(0), _soundHeaderSize(0), _soundDataSize(0),
 	_audioFormat(kAudioFormat8bitRaw), _hasVideo(false), _videoCodec(0),
 	_blitMode(0), _bytesPerPixel(0), _firstFramePos(0), _videoBufferSize(0),
-	_externalCodec(false), _codec(0), _subtitle(-1) {
+	_externalCodec(false), _codec(0), _subtitle(-1), _isPaletted(true) {
 
 	_videoBuffer   [0] = 0;
 	_videoBuffer   [1] = 0;
@@ -1582,6 +1589,34 @@
 		_y = y;
 }
 
+bool VMDDecoder::openExternalCodec() {
+	delete _codec;
+	_codec = 0;
+
+	if (_externalCodec) {
+		if (_videoCodec == kVideoCodecIndeo3) {
+			_isPaletted = false;
+
+#ifdef USE_INDEO3
+			_codec = new Indeo3Decoder(_width, _height);
+#else
+			warning("VMDDecoder::openExternalCodec(): Indeo3 decoder not compiled in");
+#endif
+
+		} else {
+			warning("VMDDecoder::openExternalCodec(): Unknown video codec FourCC \"%s\"",
+					tag2str(_videoCodec));
+			return false;
+		}
+	}
+
+	return true;
+}
+
+void VMDDecoder::colorModeChanged() {
+	openExternalCodec();
+}
+
 bool VMDDecoder::load(Common::SeekableReadStream *stream) {
 	close();
 
@@ -1703,25 +1738,16 @@
 }
 
 bool VMDDecoder::assessVideoProperties() {
+	_isPaletted = true;
+
 	if ((_version & 2) && !(_version & 8)) {
 		_externalCodec   = true;
 		_videoBufferSize = 0;
 	} else
 		_externalCodec = false;
 
-	if (_externalCodec) {
-		if (_videoCodec == kVideoCodecIndeo3) {
-#ifdef USE_INDEO3
-			_codec = new Indeo3Decoder(_width, _height);
-#else
-			warning("VMDDecoder::assessVideoProperties(): Indeo3 decoder not compiled in");
-#endif
-		} else {
-			warning("VMDDecoder::assessVideoProperties(): Unknown video codec FourCC \"%s\"",
-					tag2str(_videoCodec));
-			return false;
-		}
-	}
+	if (!openExternalCodec())
+		return false;
 
 	if (_externalCodec)
 		_blitMode = 0;
@@ -1732,6 +1758,8 @@
 
 		_blitMode      = n - 1;
 		_bytesPerPixel = n;
+
+		_isPaletted = false;
 	}
 
 	if ((_bytesPerPixel > 1) && !_externalCodec) {
@@ -1967,6 +1995,8 @@
 
 	_externalCodec = false;
 	_codec         = 0;
+
+	_isPaletted = true;
 }
 
 bool VMDDecoder::isVideoLoaded() const {
@@ -2534,6 +2564,10 @@
 	return _subtitle;
 }
 
+bool VMDDecoder::isPaletted() const {
+	return _isPaletted;
+}
+
 } // End of namespace Graphics
 
 #endif // GRAPHICS_VIDEO_COKTELDECODER_H

Modified: scummvm/trunk/graphics/video/coktel_decoder.h
===================================================================
--- scummvm/trunk/graphics/video/coktel_decoder.h	2011-01-16 16:27:22 UTC (rev 55258)
+++ scummvm/trunk/graphics/video/coktel_decoder.h	2011-01-16 16:27:52 UTC (rev 55259)
@@ -98,6 +98,8 @@
 	void enableSound();
 	void disableSound();
 
+	virtual void colorModeChanged();
+
 	/** Return the coordinates of the specified frame. */
 	virtual bool getFrameCoords(int16 frame, int16 &x, int16 &y, int16 &width, int16 &height);
 
@@ -113,7 +115,10 @@
 	/** Return the current subtitle index. */
 	virtual int32 getSubtitleIndex() const;
 
+	/** Is the video paletted or true color? */
+	virtual bool isPaletted() const;
 
+
 	// VideoDecoder interface
 
 	void close();
@@ -343,6 +348,8 @@
 
 	void setXY(uint16 x, uint16 y);
 
+	void colorModeChanged();
+
 	bool getFrameCoords(int16 frame, int16 &x, int16 &y, int16 &width, int16 &height);
 
 	bool hasEmbeddedFiles() const;
@@ -351,7 +358,9 @@
 
 	int32 getSubtitleIndex() const;
 
+	virtual bool isPaletted() const;
 
+
 	// VideoDecoder interface
 
 	bool load(Common::SeekableReadStream *stream);
@@ -456,9 +465,12 @@
 
 	int32 _subtitle;
 
+	bool _isPaletted;
+
 	// Loading helper functions
 	bool assessVideoProperties();
 	bool assessAudioProperties();
+	bool openExternalCodec();
 	bool readFrameTable(int &numFiles);
 	bool readFiles();
 


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