ScummVM API documentation
dxa_decoder.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 VIDEO_DXA_DECODER_H
23#define VIDEO_DXA_DECODER_H
24
25#include "common/rational.h"
26#include "graphics/palette.h"
27#include "graphics/pixelformat.h"
28#include "video/video_decoder.h"
29
30namespace Common {
31class SeekableReadStream;
32}
33
34namespace Video {
35
44class DXADecoder : public VideoDecoder {
45public:
46 DXADecoder();
47 virtual ~DXADecoder();
48
49 bool loadStream(Common::SeekableReadStream *stream) override;
50
51protected:
56
57private:
58 class DXAVideoTrack : public FixedRateVideoTrack {
59 public:
60 DXAVideoTrack(Common::SeekableReadStream *stream);
61 ~DXAVideoTrack();
62
63 bool isRewindable() const override { return true; }
64 bool rewind() override;
65
66 uint16 getWidth() const override { return _width; }
67 uint16 getHeight() const override { return _height; }
69 int getCurFrame() const override { return _curFrame; }
70 int getFrameCount() const override { return _frameCount; }
71 const Graphics::Surface *decodeNextFrame() override;
72 const byte *getPalette() const override { _dirtyPalette = false; return _palette.data(); }
73 bool hasDirtyPalette() const override { return _dirtyPalette; }
74
75 void setFrameStartPos();
76
77 protected:
78 Common::Rational getFrameRate() const override { return _frameRate; }
79
80 private:
81 void decodeZlib(byte *data, int size, int totalSize);
82 void decode12(int size);
83 void decode13(int size);
84
85 enum ScaleMode {
86 S_NONE,
87 S_INTERLACED,
88 S_DOUBLE
89 };
90
91 Common::SeekableReadStream *_fileStream;
92 Graphics::Surface *_surface;
93
94 byte *_frameBuffer1;
95 byte *_frameBuffer2;
96 byte *_scaledBuffer;
97 byte *_inBuffer;
98 uint32 _inBufferSize;
99 byte *_decompBuffer;
100 uint32 _decompBufferSize;
101 uint16 _curHeight;
102 uint32 _frameSize;
103 ScaleMode _scaleMode;
104 uint16 _width, _height;
105 uint32 _frameRate;
106 uint32 _frameCount;
107 Graphics::Palette _palette;
108 mutable bool _dirtyPalette;
109 int _curFrame;
110 uint32 _frameStartOffset;
111 };
112};
113
114} // End of namespace Video
115
116#endif
Definition: rational.h:40
Definition: stream.h:745
Simple class for handling a palette data.
Definition: palette.h:61
Definition: dxa_decoder.h:44
bool loadStream(Common::SeekableReadStream *stream) override
virtual void readSoundData(Common::SeekableReadStream *stream)
Definition: video_decoder.h:734
Definition: video_decoder.h:53
Graphics::PixelFormat getPixelFormat() const
bool hasDirtyPalette() const
Definition: video_decoder.h:337
virtual uint16 getHeight() const
const byte * getPalette()
virtual const Graphics::Surface * decodeNextFrame()
virtual bool isRewindable() const
virtual bool rewind()
int getCurFrame() const
uint32 getFrameCount() const
virtual uint16 getWidth() const
Definition: algorithm.h:29
Definition: pixelformat.h:138
Definition: surface.h:67