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

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Sun Aug 8 02:56:04 CEST 2010


Revision: 51896
          http://scummvm.svn.sourceforge.net/scummvm/?rev=51896&view=rev
Author:   drmccoy
Date:     2010-08-08 00:56:04 +0000 (Sun, 08 Aug 2010)

Log Message:
-----------
VIDEO/GOB: Stubb VMDDecoder

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

Modified: scummvm/trunk/engines/gob/videoplayer.cpp
===================================================================
--- scummvm/trunk/engines/gob/videoplayer.cpp	2010-08-08 00:55:27 UTC (rev 51895)
+++ scummvm/trunk/engines/gob/videoplayer.cpp	2010-08-08 00:56:04 UTC (rev 51896)
@@ -679,11 +679,9 @@
 	else if (properties.type == kVideoTypePreIMD)
 		video = new Graphics::PreIMDDecoder(properties.width, properties.height, *_vm->_mixer, Audio::Mixer::kSFXSoundType);
 	else if (properties.type == kVideoTypeVMD)
-		warning("TODO: VMD");
-		//_video = new Graphics::Vmd(_vm->_video->_palLUT);
+		video = new Graphics::VMDDecoder(*_vm->_mixer, Audio::Mixer::kSFXSoundType);
 	else if (properties.type == kVideoTypeRMD)
-		warning("TODO: RMD");
-		//_video = new Graphics::Vmd(_vm->_video->_palLUT);
+		video = new Graphics::VMDDecoder(*_vm->_mixer, Audio::Mixer::kSFXSoundType);
 	else
 		warning("Couldn't open video \"%s\": Invalid video Type", fileName.c_str());
 

Modified: scummvm/trunk/graphics/video/coktel_decoder.cpp
===================================================================
--- scummvm/trunk/graphics/video/coktel_decoder.cpp	2010-08-08 00:55:27 UTC (rev 51895)
+++ scummvm/trunk/graphics/video/coktel_decoder.cpp	2010-08-08 00:56:04 UTC (rev 51896)
@@ -1314,6 +1314,102 @@
 	return PixelFormat::createFormatCLUT8();
 }
 
+
+VMDDecoder::VMDDecoder(Audio::Mixer &mixer, Audio::Mixer::SoundType soundType) : CoktelDecoder(mixer, soundType),
+	_stream(0), _videoBuffer(0), _videoBufferSize(0) {
+
+}
+
+VMDDecoder::~VMDDecoder() {
+	close();
+}
+
+bool VMDDecoder::seek(int32 frame, int whence, bool restart) {
+	if (!isVideoLoaded())
+		// Nothing to do
+		return false;
+
+	// Find the frame to which to seek
+	if      (whence == SEEK_CUR)
+		frame += _curFrame;
+	else if (whence == SEEK_END)
+		frame = _frameCount - frame - 1;
+	else if (whence == SEEK_SET)
+		frame--;
+	else
+		return false;
+
+	if ((frame < -1) || (((uint32) frame) >= _frameCount))
+		// Out of range
+		return false;
+
+	if (frame == _curFrame)
+		// Nothing to do
+		return true;
+
+	// TODO
+
+	return true;
+}
+
+bool VMDDecoder::load(Common::SeekableReadStream &stream) {
+	close();
+
+	_stream = &stream;
+
+	_stream->seek(0);
+
+	warning("TODO: VMDDecoder::load()");
+
+	return false;
+}
+
+void VMDDecoder::close() {
+	reset();
+
+	CoktelDecoder::close();
+
+	delete _stream;
+
+	delete[] _videoBuffer;
+
+	_stream = 0;
+
+	_videoBuffer     = 0;
+	_videoBufferSize = 0;
+}
+
+bool VMDDecoder::isVideoLoaded() const {
+	return _stream != 0;
+}
+
+Surface *VMDDecoder::decodeNextFrame() {
+	if (!isVideoLoaded() || endOfVideo())
+		return 0;
+
+	createSurface();
+
+	processFrame();
+	renderFrame();
+
+	if (_curFrame == 0)
+		_startTime = g_system->getMillis();
+
+	return &_surface;
+}
+
+void VMDDecoder::processFrame() {
+	_curFrame++;
+}
+
+// Just a simple blit
+void VMDDecoder::renderFrame() {
+}
+
+PixelFormat VMDDecoder::getPixelFormat() const {
+	return PixelFormat::createFormatCLUT8();
+}
+
 } // End of namespace Graphics
 
 #endif // GRAPHICS_VIDEO_COKTELDECODER_H

Modified: scummvm/trunk/graphics/video/coktel_decoder.h
===================================================================
--- scummvm/trunk/graphics/video/coktel_decoder.h	2010-08-08 00:55:27 UTC (rev 51895)
+++ scummvm/trunk/graphics/video/coktel_decoder.h	2010-08-08 00:56:04 UTC (rev 51896)
@@ -324,6 +324,37 @@
 	void emptySoundSlice(bool hasNextCmd);
 };
 
+class VMDDecoder : public CoktelDecoder {
+public:
+	VMDDecoder(Audio::Mixer &mixer, Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType);
+	~VMDDecoder();
+
+	bool seek(int32 frame, int whence = SEEK_SET, bool restart = false);
+
+
+	// VideoDecoder interface
+
+	bool load(Common::SeekableReadStream &stream);
+	void close();
+
+	bool isVideoLoaded() const;
+
+	Surface *decodeNextFrame();
+
+	PixelFormat getPixelFormat() const;
+
+private:
+	Common::SeekableReadStream *_stream;
+
+	// Buffer for processed frame data
+	byte  *_videoBuffer;
+	uint32 _videoBufferSize;
+
+	// Frame decoding
+	void processFrame();
+	void renderFrame();
+};
+
 } // End of namespace Graphics
 
 #endif // GRAPHICS_VIDEO_COKTELDECODER_H


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