ScummVM API documentation
video.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 ACCESS_VIDEO_H
23#define ACCESS_VIDEO_H
24
25#include "common/scummsys.h"
26#include "common/memstream.h"
27#include "audio/audiostream.h"
28#include "audio/mixer.h"
29
30#include "access/data.h"
31#include "access/asurface.h"
32#include "access/files.h"
33
34namespace Access {
35
36enum VideoFlags { VIDEOFLAG_NONE = 0, VIDEOFLAG_BG = 1 };
37
38class VideoPlayer : public Manager {
39public:
41 virtual ~VideoPlayer();
42
46 void setVideo(BaseSurface *vidSurface, const Common::Point &pt, const FileIdent &videoFile, int rate);
47 void setVideo(BaseSurface *vidSurface, const Common::Point &pt, const Common::Path &filename, int rate);
48
52 virtual void playVideo() = 0;
53
54 virtual void copyVideo() = 0;
58 virtual void closeVideo();
59
63 void playToEnd();
64
65 virtual int getWidth() = 0;
66
67 virtual int getHeight() = 0;
68
69protected:
70 virtual void setVideo(const Common::Point &pt) = 0;
71
72 virtual void setRate(int rate) = 0;
73
74 virtual void delayToNextFrame() = 0;
75
76 Resource *_videoData;
77 BaseSurface *_vidSurface;
78
79public:
80 int _videoFrame;
81 bool _soundFlag;
82 int _soundFrame;
83 bool _videoEnd;
84};
85
86
88 struct VideoHeader {
89 int _frameCount;
90 int _width, _height;
91 VideoFlags _flags;
92 };
93private:
94 VideoHeader _header;
95 byte *_startCoord;
96 int _frameCount;
97 int _xCount;
98 int _scanCount;
99 int _frameSize;
100 Common::Rect _videoBounds;
101 int _rate;
102
103 void getFrame();
104protected:
105 void setVideo(const Common::Point &pt) override;
106
107 void setRate(int rate) override;
108
109 void delayToNextFrame() override;
110
111public:
113
115
116 void playVideo() override;
117
118 void copyVideo() override;
119
120 int getWidth() override { return _header._width; }
121
122 int getHeight() override { return _header._height; }
123
124};
125
127 struct VideoHeader {
128 uint32 _id;
129 byte _version;
130 int _frameCount;
131 int _width, _height;
132 int _frameIncr;
133 uint16 _unk;
134 VideoFlags _flags;
135 };
136private:
137 VideoHeader _header;
138 BaseSurface *_frame;
139 uint32 _nextFrameTime;
140 bool _setPal;
141 bool _drawBorder;
142 uint32 _startMs;
143 uint32 _delayTotal;
144
145 Audio::QueuingAudioStream *_audioStream;
146 Audio::SoundHandle _audioStreamHandle;
148
149 void handleStraitChunk();
150 void handlePaletteChunk();
151 void handleFrameChunk(bool delta, bool skipLines);
152 void handleSoundChunk(bool init);
153
154 void calcNextFrameTime(int delay);
155
156protected:
157 void setVideo(const Common::Point &pt) override;
158
159 void setRate(int rate) override { };
160
161 void delayToNextFrame() override;
162public:
163 VideoPlayer_v2(AccessEngine *vm, bool setPal = false);
164
166
167 void playVideo() override;
168
169 void copyVideo() override {};
170
171 void closeVideo() override;
172
173 int getWidth() override { return _header._width; }
174
175 int getHeight() override { return _header._height; }
176
177 void setVideoPalNow();
178
179 void setDrawBorder(bool drawBorder) { _drawBorder = drawBorder; }
180};
181
182
183} // End of namespace Access
184
185#endif /* ACCESS_VIDEO_H */
Definition: access.h:141
Definition: asurface.h:42
Definition: data.h:37
Definition: files.h:55
Definition: video.h:87
void playVideo() override
Definition: video.h:126
void playVideo() override
void closeVideo() override
Definition: video.h:38
virtual void playVideo()=0
void setVideo(BaseSurface *vidSurface, const Common::Point &pt, const FileIdent &videoFile, int rate)
virtual void closeVideo()
Definition: audiostream.h:370
Definition: mixer.h:49
Definition: path.h:52
Simple class for handling a palette data.
Definition: palette.h:61
Definition: access.h:62
Definition: files.h:36
Definition: rect.h:144
Definition: rect.h:536