aboutsummaryrefslogtreecommitdiff
path: root/graphics/video
diff options
context:
space:
mode:
authorSven Hesse2010-08-08 00:33:59 +0000
committerSven Hesse2010-08-08 00:33:59 +0000
commita802e1e64f56b5c6b0534a481e84418078b2699f (patch)
tree6d4becdefb786c0f277859be491f0624554645c7 /graphics/video
parentb5b47d50c8984361965c49eead999eb7bc672171 (diff)
downloadscummvm-rg350-a802e1e64f56b5c6b0534a481e84418078b2699f.tar.gz
scummvm-rg350-a802e1e64f56b5c6b0534a481e84418078b2699f.tar.bz2
scummvm-rg350-a802e1e64f56b5c6b0534a481e84418078b2699f.zip
VIDEO: Stub a VideoDecoder-like CoktelDecoder
This creates a new CoktelDecoder class using the VideoDecoder interface, which will eventually become the new way to decode PreIMD, IMD and VMD videos. Since the VideoPlayer in gob is not yet ready for this, we're disabling all video playback in the gob engine for now. svn-id: r51850
Diffstat (limited to 'graphics/video')
-rw-r--r--graphics/video/coktel_decoder.cpp105
-rw-r--r--graphics/video/coktel_decoder.h119
2 files changed, 224 insertions, 0 deletions
diff --git a/graphics/video/coktel_decoder.cpp b/graphics/video/coktel_decoder.cpp
new file mode 100644
index 0000000000..a6c79cc1df
--- /dev/null
+++ b/graphics/video/coktel_decoder.cpp
@@ -0,0 +1,105 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#include "graphics/video/coktel_decoder.h"
+
+#ifdef GRAPHICS_VIDEO_COKTELDECODER_H
+
+namespace Graphics {
+
+CoktelDecoder::State::State() : left(0), top(0), right(0), bottom(0), flags(0), speechId(0) {
+}
+
+
+CoktelDecoder::CoktelDecoder(Audio::Mixer &mixer, Audio::Mixer::SoundType soundType) :
+ _mixer(&mixer), _soundType(soundType), _width(0), _height(0), _frameCount(0), _paletteDirty(false) {
+
+ memset(_palette, 0, 768);
+}
+
+CoktelDecoder::~CoktelDecoder() {
+}
+
+uint16 CoktelDecoder::getWidth() const {
+ return _width;
+}
+
+uint16 CoktelDecoder::getHeight() const {
+ return _height;
+}
+
+uint32 CoktelDecoder::getFrameCount() const {
+ return _frameCount;
+}
+
+byte *CoktelDecoder::getPalette() {
+ return _palette;
+}
+
+bool CoktelDecoder::hasDirtyPalette() const {
+ return _paletteDirty;
+}
+
+Common::Rational CoktelDecoder::getFrameRate() const {
+ return _frameRate;
+}
+
+
+PreIMDDecoder::PreIMDDecoder(uint16 width, uint16 height,
+ Audio::Mixer &mixer, Audio::Mixer::SoundType soundType) : CoktelDecoder(mixer, soundType) {
+
+ _width = width;
+ _height = height;
+}
+
+PreIMDDecoder::~PreIMDDecoder() {
+}
+
+bool PreIMDDecoder::seek(uint32 frame, int whence, bool restart) {
+ return false;
+}
+
+bool PreIMDDecoder::load(Common::SeekableReadStream &stream) {
+ return false;
+}
+
+void PreIMDDecoder::close() {
+}
+
+bool PreIMDDecoder::isVideoLoaded() const {
+ return false;
+}
+
+Surface *PreIMDDecoder::decodeNextFrame() {
+ return 0;
+}
+
+PixelFormat PreIMDDecoder::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
new file mode 100644
index 0000000000..acbd533c00
--- /dev/null
+++ b/graphics/video/coktel_decoder.h
@@ -0,0 +1,119 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+// Currently, only GOB and SCI32 games play IMDs and VMDs, so skip compiling if GOB and SCI32 is disabled.
+#if !(defined(ENABLE_GOB) || defined(ENABLE_SCI32) || defined(DYNAMIC_MODULES))
+
+// Do not compile the CoktelDecoder code
+
+#else
+
+#ifndef GRAPHICS_VIDEO_COKTELDECODER_H
+#define GRAPHICS_VIDEO_COKTELDECODER_H
+
+#include "graphics/video/video_decoder.h"
+
+#include "sound/mixer.h"
+
+namespace Graphics {
+
+class CoktelDecoder : public FixedRateVideoDecoder {
+public:
+ struct State {
+ /** Left-most value of the updated rectangle. */
+ int16 left;
+ /** Top-most value of the updated rectangle. */
+ int16 top;
+ /** Right-most value of the updated rectangle. */
+ int16 right;
+ /** Bottom-most value of the updated rectangle. */
+ int16 bottom;
+ /** Set accordingly to what was done. */
+ uint32 flags;
+ /** The id of the spoken words. */
+ uint16 speechId;
+
+ State();
+ };
+
+ CoktelDecoder(Audio::Mixer &mixer,
+ Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType);
+ ~CoktelDecoder();
+
+ virtual bool seek(uint32 frame, int whence = SEEK_SET, bool restart = false) = 0;
+
+ // VideoDecoder interface
+
+ uint16 getWidth() const;
+ uint16 getHeight() const;
+
+ uint32 getFrameCount() const;
+
+ byte *getPalette();
+ bool hasDirtyPalette() const;
+
+protected:
+ Audio::Mixer *_mixer;
+ Audio::Mixer::SoundType _soundType;
+
+ uint16 _width;
+ uint16 _height;
+
+ uint32 _frameCount;
+
+ byte _palette[768];
+ bool _paletteDirty;
+
+ Common::Rational _frameRate;
+
+ // FixedRateVideoDecoder interface
+ Common::Rational getFrameRate() const;
+};
+
+class PreIMDDecoder : public CoktelDecoder {
+public:
+ PreIMDDecoder(uint16 width, uint16 height, Audio::Mixer &mixer,
+ Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType);
+ ~PreIMDDecoder();
+
+ bool seek(uint32 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;
+};
+
+} // End of namespace Graphics
+
+#endif // GRAPHICS_VIDEO_COKTELDECODER_H
+
+#endif // Engine and dynamic plugins guard