aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra/vqa.h
diff options
context:
space:
mode:
authorMarisa-Chan2014-06-13 21:43:04 +0700
committerMarisa-Chan2014-06-13 21:43:04 +0700
commit45589950c0fb1a449351e6a00ef10d42290d8bae (patch)
tree44e4eedcb7e69d5fc386155b000ed038af07251d /engines/kyra/vqa.h
parent48360645dcd5f8fddb135b6e31ae5cae4be8d77f (diff)
parent5c005ad3a3f1df0bc968c85c1cf0fc48e36ab0b2 (diff)
downloadscummvm-rg350-45589950c0fb1a449351e6a00ef10d42290d8bae.tar.gz
scummvm-rg350-45589950c0fb1a449351e6a00ef10d42290d8bae.tar.bz2
scummvm-rg350-45589950c0fb1a449351e6a00ef10d42290d8bae.zip
Merge remote-tracking branch 'upstream/master' into zvision
Conflicts: engines/zvision/animation/rlf_animation.cpp engines/zvision/animation_control.h engines/zvision/core/console.cpp engines/zvision/core/events.cpp engines/zvision/cursors/cursor.cpp engines/zvision/cursors/cursor_manager.cpp engines/zvision/cursors/cursor_manager.h engines/zvision/fonts/truetype_font.cpp engines/zvision/graphics/render_manager.cpp engines/zvision/graphics/render_manager.h engines/zvision/inventory/inventory_manager.h engines/zvision/inventory_manager.h engines/zvision/meta_animation.h engines/zvision/module.mk engines/zvision/scripting/actions.cpp engines/zvision/scripting/control.h engines/zvision/scripting/controls/animation_control.cpp engines/zvision/scripting/controls/animation_control.h engines/zvision/scripting/controls/input_control.cpp engines/zvision/scripting/controls/lever_control.cpp engines/zvision/scripting/controls/timer_node.cpp engines/zvision/scripting/controls/timer_node.h engines/zvision/scripting/puzzle.h engines/zvision/scripting/scr_file_handling.cpp engines/zvision/scripting/script_manager.cpp engines/zvision/scripting/script_manager.h engines/zvision/sidefx.cpp engines/zvision/sound/zork_raw.cpp engines/zvision/sound/zork_raw.h engines/zvision/video/video.cpp engines/zvision/video/zork_avi_decoder.h engines/zvision/zvision.cpp engines/zvision/zvision.h
Diffstat (limited to 'engines/kyra/vqa.h')
-rw-r--r--engines/kyra/vqa.h143
1 files changed, 86 insertions, 57 deletions
diff --git a/engines/kyra/vqa.h b/engines/kyra/vqa.h
index 839bf5ac48..d23704a9ea 100644
--- a/engines/kyra/vqa.h
+++ b/engines/kyra/vqa.h
@@ -8,12 +8,12 @@
* 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.
@@ -23,9 +23,9 @@
#ifndef KYRA_VQA_H
#define KYRA_VQA_H
-#include "common/scummsys.h"
-
-#include "audio/mixer.h"
+#include "video/video_decoder.h"
+#include "common/file.h"
+#include "common/rational.h"
class OSystem;
@@ -33,40 +33,24 @@ namespace Audio {
class QueuingAudioStream;
} // End of namespace Audio
-namespace Common {
-class SeekableReadStream;
-} // End of namespace Common
-
namespace Kyra {
class KyraEngine_v1;
class Screen;
-class VQAMovie {
+class VQADecoder : public Video::VideoDecoder {
public:
- VQAMovie(KyraEngine_v1 *vm, OSystem *system);
- ~VQAMovie();
+ VQADecoder();
+ virtual ~VQADecoder();
- bool opened() { return _opened; }
- int frames() { return _opened ? _header.numFrames : -1; }
+ bool loadStream(Common::SeekableReadStream *stream);
+ void readNextPacket();
- // It's unlikely that we ever want to change the movie position from
- // its default.
+private:
+ Common::SeekableReadStream *_fileStream;
- void setDrawPage(int page) { _drawPage = page; }
-
- bool open(const char *filename);
- void close();
- void play();
-
-protected:
- OSystem *_system;
- KyraEngine_v1 *_vm;
- Screen *_screen;
-
- bool _opened;
- int _x, _y;
- int _drawPage;
+ void handleVQHD(Common::SeekableReadStream *stream);
+ void handleFINF(Common::SeekableReadStream *stream);
struct VQAHeader {
uint16 version;
@@ -91,40 +75,85 @@ protected:
uint32 unk5;
};
- struct Buffer {
- uint8 *data;
- uint32 size;
- };
-
- Buffer _buffers[2];
-
- void initBuffers();
- void *allocBuffer(int num, uint32 size);
- void freeBuffers();
+ VQAHeader _header;
+ uint32 *_frameInfo;
- void decodeSND1(byte *inbuf, uint32 insize, byte *outbuf, uint32 outsize);
+ class VQAAudioTrack : public AudioTrack {
+ public:
+ VQAAudioTrack(const VQAHeader *header);
+ ~VQAAudioTrack();
- void displayFrame(uint frameNum);
+ void handleSND0(Common::SeekableReadStream *stream);
+ void handleSND1(Common::SeekableReadStream *stream);
+ void handleSND2(Common::SeekableReadStream *stream);
- Common::SeekableReadStream *_file;
+ protected:
+ Audio::AudioStream *getAudioStream() const;
- VQAHeader _header;
- uint32 *_frameInfo;
- uint32 _codeBookSize;
- byte *_codeBook;
- byte *_partialCodeBook;
- bool _compressedCodeBook;
- int _partialCodeBookSize;
- int _numPartialCodeBooks;
- uint32 _numVectorPointers;
- uint16 *_vectorPointers;
+ private:
+ Audio::QueuingAudioStream *_audioStream;
+ };
- byte *_frame;
+ class VQAVideoTrack : public FixedRateVideoTrack {
+ public:
+ VQAVideoTrack(const VQAHeader *header);
+ ~VQAVideoTrack();
+
+ uint16 getWidth() const;
+ uint16 getHeight() const;
+ Graphics::PixelFormat getPixelFormat() const;
+ int getCurFrame() const;
+ int getFrameCount() const;
+ const Graphics::Surface *decodeNextFrame();
+
+ void setHasDirtyPalette();
+ bool hasDirtyPalette() const;
+ const byte *getPalette() const;
+
+ void handleVQFR(Common::SeekableReadStream *stream);
+
+ protected:
+ Common::Rational getFrameRate() const;
+
+ private:
+ Graphics::Surface *_surface;
+ byte _palette[3 * 256];
+ mutable bool _dirtyPalette;
+
+ bool _newFrame;
+
+ uint16 _width, _height;
+ uint8 _blockW, _blockH;
+ uint8 _cbParts;
+ int _frameCount;
+ int _curFrame;
+ byte _frameRate;
+
+ uint32 _codeBookSize;
+ bool _compressedCodeBook;
+ byte *_codeBook;
+ int _partialCodeBookSize;
+ int _numPartialCodeBooks;
+ byte *_partialCodeBook;
+ uint32 _numVectorPointers;
+ uint16 *_vectorPointers;
+ };
+};
- Audio::QueuingAudioStream *_stream;
- Audio::SoundHandle _sound;
+class VQAMovie {
+public:
+ VQAMovie(KyraEngine_v1 *vm, OSystem *system);
+ ~VQAMovie();
- uint32 readTag();
+ bool open(const char *filename);
+ void close();
+ void play();
+private:
+ OSystem *_system;
+ KyraEngine_v1 *_vm;
+ Screen *_screen;
+ VQADecoder *_decoder;
+ Common::File _file;
};
} // End of namespace Kyra