diff options
author | Sven Hesse | 2010-08-08 00:56:04 +0000 |
---|---|---|
committer | Sven Hesse | 2010-08-08 00:56:04 +0000 |
commit | 1f630094268a76fd73e7a1f01e725aef2aa61e8e (patch) | |
tree | 354311c1f225b52a046183780017f3737d37259e /graphics/video | |
parent | bab55f3a1d8f24e959fa98bda3a775452cc14198 (diff) | |
download | scummvm-rg350-1f630094268a76fd73e7a1f01e725aef2aa61e8e.tar.gz scummvm-rg350-1f630094268a76fd73e7a1f01e725aef2aa61e8e.tar.bz2 scummvm-rg350-1f630094268a76fd73e7a1f01e725aef2aa61e8e.zip |
VIDEO/GOB: Stubb VMDDecoder
svn-id: r51896
Diffstat (limited to 'graphics/video')
-rw-r--r-- | graphics/video/coktel_decoder.cpp | 96 | ||||
-rw-r--r-- | graphics/video/coktel_decoder.h | 31 |
2 files changed, 127 insertions, 0 deletions
diff --git a/graphics/video/coktel_decoder.cpp b/graphics/video/coktel_decoder.cpp index 8e8c6f9e93..e79ea8c45d 100644 --- a/graphics/video/coktel_decoder.cpp +++ b/graphics/video/coktel_decoder.cpp @@ -1314,6 +1314,102 @@ PixelFormat IMDDecoder::getPixelFormat() const { 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 diff --git a/graphics/video/coktel_decoder.h b/graphics/video/coktel_decoder.h index 646e55b0bc..435f289c2c 100644 --- a/graphics/video/coktel_decoder.h +++ b/graphics/video/coktel_decoder.h @@ -324,6 +324,37 @@ private: 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 |