diff options
author | Sven Hesse | 2010-08-08 00:40:24 +0000 |
---|---|---|
committer | Sven Hesse | 2010-08-08 00:40:24 +0000 |
commit | dcf8298a75cfeb44c6059f03b57f0a61bc062ac0 (patch) | |
tree | 8dd1635d08f69dec42b08c04c5b594968c8619ef | |
parent | bb746b5b619b439669c878f218b9be91faff549a (diff) | |
download | scummvm-rg350-dcf8298a75cfeb44c6059f03b57f0a61bc062ac0.tar.gz scummvm-rg350-dcf8298a75cfeb44c6059f03b57f0a61bc062ac0.tar.bz2 scummvm-rg350-dcf8298a75cfeb44c6059f03b57f0a61bc062ac0.zip |
VIDEO: Stub IMDDecoder
svn-id: r51862
-rw-r--r-- | graphics/video/coktel_decoder.cpp | 99 | ||||
-rw-r--r-- | graphics/video/coktel_decoder.h | 28 |
2 files changed, 127 insertions, 0 deletions
diff --git a/graphics/video/coktel_decoder.cpp b/graphics/video/coktel_decoder.cpp index 9e4fc1edc6..220a290da6 100644 --- a/graphics/video/coktel_decoder.cpp +++ b/graphics/video/coktel_decoder.cpp @@ -338,6 +338,105 @@ PixelFormat PreIMDDecoder::getPixelFormat() const { return PixelFormat::createFormatCLUT8(); } + +IMDDecoder::IMDDecoder(Audio::Mixer &mixer, Audio::Mixer::SoundType soundType) : CoktelDecoder(mixer, soundType), + _stream(0), _videoBuffer(0), _videoBufferSize(0) { +} + +IMDDecoder::~IMDDecoder() { + close(); +} + +bool IMDDecoder::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 IMDDecoder::load(Common::SeekableReadStream &stream) { + close(); + + _stream = &stream; + + warning("IMDDecoder::load()"); + + // TODO + + return false; +} + +void IMDDecoder::close() { + reset(); + + CoktelDecoder::close(); + + delete _stream; + + delete[] _videoBuffer; + + _stream = 0; + + _videoBuffer = 0; + _videoBufferSize = 0; +} + +bool IMDDecoder::isVideoLoaded() const { + return _stream != 0; +} + +Surface *IMDDecoder::decodeNextFrame() { + if (!isVideoLoaded() || endOfVideo()) + return 0; + + createSurface(); + + processFrame(); + renderFrame(); + + _curFrame++; + + if (_curFrame == 0) + _startTime = g_system->getMillis(); + + return &_surface; +} + +void IMDDecoder::processFrame() { + // TODO +} + +void IMDDecoder::renderFrame() { + _dirtyRects.clear(); + + // TODO +} + +PixelFormat IMDDecoder::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 6a0ff28762..3e8c03e49e 100644 --- a/graphics/video/coktel_decoder.h +++ b/graphics/video/coktel_decoder.h @@ -144,6 +144,34 @@ private: void renderFrame(); }; +class IMDDecoder : public CoktelDecoder { +public: + IMDDecoder(Audio::Mixer &mixer, Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType); + ~IMDDecoder(); + + 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; + + byte *_videoBuffer; + uint32 _videoBufferSize; + + void processFrame(); + void renderFrame(); +}; + } // End of namespace Graphics #endif // GRAPHICS_VIDEO_COKTELDECODER_H |