ScummVM API documentation
vqa.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef KYRA_VQA_H
23 #define KYRA_VQA_H
24 
25 #include "video/video_decoder.h"
26 #include "common/file.h"
27 #include "common/rational.h"
28 
29 class OSystem;
30 
31 namespace Audio {
32 class QueuingAudioStream;
33 } // End of namespace Audio
34 
35 namespace Kyra {
36 
37 class KyraEngine_v1;
38 class Screen;
39 
41 public:
42  VQADecoder();
43  ~VQADecoder() override;
44 
45  bool loadStream(Common::SeekableReadStream *stream) override;
46  void readNextPacket() override;
47 
48 private:
49  Common::SeekableReadStream *_fileStream;
50 
51  void handleVQHD(Common::SeekableReadStream *stream);
52  void handleFINF(Common::SeekableReadStream *stream);
53 
54  struct VQAHeader {
55  uint16 version;
56  uint16 flags;
57  uint16 numFrames;
58  uint16 width;
59  uint16 height;
60  uint8 blockW;
61  uint8 blockH;
62  uint8 frameRate;
63  uint8 cbParts;
64  uint16 colors;
65  uint16 maxBlocks;
66  uint32 unk1;
67  uint16 unk2;
68  uint16 freq;
69  uint8 channels;
70  uint8 bits;
71  uint32 unk3;
72  uint16 unk4;
73  uint32 maxCBFZSize;
74  uint32 unk5;
75  };
76 
77  VQAHeader _header;
78  uint32 *_frameInfo;
79 
80  class VQAAudioTrack : public AudioTrack {
81  public:
82  VQAAudioTrack(const VQAHeader *header, Audio::Mixer::SoundType soundType);
83  ~VQAAudioTrack() override;
84 
85  void handleSND0(Common::SeekableReadStream *stream);
86  void handleSND1(Common::SeekableReadStream *stream);
87  void handleSND2(Common::SeekableReadStream *stream);
88 
89  protected:
90  Audio::AudioStream *getAudioStream() const override;
91 
92  private:
93  Audio::QueuingAudioStream *_audioStream;
94  };
95 
96  class VQAVideoTrack : public FixedRateVideoTrack {
97  public:
98  VQAVideoTrack(const VQAHeader *header);
99  ~VQAVideoTrack() override;
100 
101  uint16 getWidth() const override;
102  uint16 getHeight() const override;
103  Graphics::PixelFormat getPixelFormat() const override;
104  int getCurFrame() const override;
105  int getFrameCount() const override;
106  const Graphics::Surface *decodeNextFrame() override;
107 
108  void setHasDirtyPalette();
109  bool hasDirtyPalette() const override;
110  const byte *getPalette() const override;
111 
112  void handleVQFR(Common::SeekableReadStream *stream);
113 
114  protected:
115  Common::Rational getFrameRate() const override;
116 
117  private:
118  Graphics::Surface *_surface;
119  byte _palette[3 * 256];
120  mutable bool _dirtyPalette;
121 
122  bool _newFrame;
123 
124  uint16 _width, _height;
125  uint8 _blockW, _blockH;
126  uint8 _cbParts;
127  int _frameCount;
128  int _curFrame;
129  byte _frameRate;
130 
131  uint32 _codeBookSize;
132  bool _compressedCodeBook;
133  byte *_codeBook;
134  int _partialCodeBookSize;
135  int _numPartialCodeBooks;
136  byte *_partialCodeBook;
137  uint32 _numVectorPointers;
138  uint16 *_vectorPointers;
139  };
140 };
141 
142 class VQAMovie {
143 public:
144  VQAMovie(KyraEngine_v1 *vm, OSystem *system);
145  ~VQAMovie();
146 
147  bool open(const char *filename);
148  void close();
149  void play();
150 private:
151  OSystem *_system;
152  KyraEngine_v1 *_vm;
153  Screen *_screen;
154  VQADecoder *_decoder;
155  Common::File _file;
156 };
157 
158 } // End of namespace Kyra
159 
160 #endif
Definition: vqa.h:142
Definition: surface.h:67
Definition: video_decoder.h:686
Definition: vqa.h:40
Definition: pixelformat.h:138
Definition: video_decoder.h:711
Definition: kyra_v1.h:126
Definition: screen.h:565
Definition: atari-screen.h:60
Definition: stream.h:745
Definition: rational.h:40
SoundType
Definition: mixer.h:62
Definition: file.h:47
Definition: video_decoder.h:53
Definition: audiostream.h:50
Definition: detection.h:27
Definition: audiostream.h:370
Definition: system.h:161
Definition: system.h:38