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 ALG_VIDEO_H
23 #define ALG_VIDEO_H
24 
25 #include "audio/audiostream.h"
26 #include "audio/mixer.h"
27 
28 #include "common/file.h"
29 
30 namespace Alg {
31 
33 public:
35  ~AlgVideoDecoder();
36  void getNextFrame();
37  void loadVideoFromStream(uint32 offset);
38  void skipNumberOfFrames(uint32 num);
39  void setInputFile(Common::File *input) { _input = input; }
40  bool isFinished() const { return _bytesLeft == 0; }
41  Graphics::Surface *getVideoFrame() const { return _frame; }
42  void setPalette(uint8 *palette) { _palette = palette; }
43  bool isPaletteDirty() const { return _paletteDirty; }
44  void pauseAudio(bool pause) const { g_system->getMixer()->pauseHandle(_audioHandle, pause); }
45  uint16 getWidth() const { return _width; }
46  uint16 getHeight() const { return _height; }
47  uint32 getCurrentFrame() const { return _currentFrame; }
48 
49 private:
50  Common::File *_input = nullptr;
51  Graphics::Surface *_frame = nullptr;
52  Audio::PacketizedAudioStream *_audioStream = nullptr;
53  Audio::SoundHandle _audioHandle;
54  uint8 *_palette = nullptr;
55  bool _paletteDirty = false;
56  bool _gotVideoFrame = false;
57  uint32 _currentFrame = 0;
58  uint32 _size = 0;
59  uint32 _bytesLeft = 0;
60  uint16 _currentChunk = 0;
61  uint16 _numChunks = 0;
62  uint16 _frameRate = 0;
63  uint16 _videoMode = 0;
64  uint16 _width = 0;
65  uint16 _height = 0;
66  uint16 _audioType = 0;
67 
68  void readNextChunk();
69  void decodeIntraFrame(uint32 size, uint8 hh, uint8 hv);
70  void decodeInterFrame(uint32 size, uint8 hh, uint8 hv);
71  void updatePalette(uint32 size, bool partial);
72  void readAudioData(uint32 size, uint16 rate);
73 };
74 
75 } // End of namespace Alg
76 
77 #endif
Definition: video.h:32
virtual void pauseHandle(SoundHandle handle, bool paused)=0
Definition: surface.h:67
virtual Audio::Mixer * getMixer()=0
Definition: audiostream.h:446
OSystem * g_system
Definition: mixer.h:49
Definition: file.h:47
Definition: alg.h:30