ScummVM API documentation
flic_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_FLICDECODER_H
23#define VIDEO_FLICDECODER_H
24
25#include "video/video_decoder.h"
26#include "common/list.h"
27#include "common/rect.h"
28#include "graphics/palette.h"
29
30namespace Common {
31class SeekableReadStream;
32}
33
34namespace Graphics {
35struct PixelFormat;
36struct Surface;
37}
38
39namespace Video {
40
50class FlicDecoder : public VideoDecoder {
51public:
53 virtual ~FlicDecoder();
54
55 bool loadStream(Common::SeekableReadStream *stream) override;
56
57 const Common::List<Common::Rect> *getDirtyRects() const;
58 void clearDirtyRects();
59 void copyDirtyRectsToBuffer(uint8 *dst, uint pitch);
60
61protected:
62 class FlicVideoTrack : public VideoTrack {
63 public:
64 FlicVideoTrack(Common::SeekableReadStream *stream, uint16 frameCount, uint16 width, uint16 height, bool skipHeader = false);
66
67 virtual void readHeader();
68
69 bool endOfTrack() const override;
70 bool isRewindable() const override{ return true; }
71 bool rewind() override;
72
73 uint16 getWidth() const override;
74 uint16 getHeight() const override;
76 int getCurFrame() const override { return _curFrame; }
77 int getCurFrameDelay() const override { return _frameDelay; }
78 int getFrameCount() const override { return _frameCount; }
79 uint32 getNextFrameStartTime() const override { return _nextFrameStartTime; }
81 virtual void handleFrame();
82 const byte *getPalette() const override{ _dirtyPalette = false; return _palette.data(); }
83 bool hasDirtyPalette() const override { return _dirtyPalette; }
84
85 const Common::List<Common::Rect> *getDirtyRects() const { return &_dirtyRects; }
86 void clearDirtyRects() { _dirtyRects.clear(); }
87 void copyDirtyRectsToBuffer(uint8 *dst, uint pitch);
88
89 protected:
90 Common::SeekableReadStream *_fileStream;
91 Graphics::Surface *_surface;
92
93 int _curFrame;
94 bool _atRingFrame;
95
96 uint32 _offsetFrame1;
97 uint32 _offsetFrame2;
98 Graphics::Palette _palette;
99 mutable bool _dirtyPalette;
100
101 uint32 _frameCount;
102 uint32 _frameDelay, _startFrameDelay;
103 uint32 _nextFrameStartTime;
104
105 Common::List<Common::Rect> _dirtyRects;
106
107 void copyFrame(uint8 *data);
108 void decodeByteRun(uint8 *data);
109 void decodeDeltaFLC(uint8 *data);
110 void unpackPalette(uint8 *mem);
111 };
112};
113
114} // End of namespace Video
115
116#endif
void clear()
Definition: list.h:245
Definition: stream.h:745
Simple class for handling a palette data.
Definition: palette.h:61
Definition: flic_decoder.h:62
bool isRewindable() const override
Definition: flic_decoder.h:70
uint16 getWidth() const override
int getCurFrameDelay() const override
Definition: flic_decoder.h:77
int getCurFrame() const override
Definition: flic_decoder.h:76
uint16 getHeight() const override
bool hasDirtyPalette() const override
Definition: flic_decoder.h:83
bool endOfTrack() const override
const byte * getPalette() const override
Definition: flic_decoder.h:82
int getFrameCount() const override
Definition: flic_decoder.h:78
const Graphics::Surface * decodeNextFrame() override
uint32 getNextFrameStartTime() const override
Definition: flic_decoder.h:79
Graphics::PixelFormat getPixelFormat() const override
Definition: flic_decoder.h:50
bool loadStream(Common::SeekableReadStream *stream) override
Definition: video_decoder.h:616
Definition: video_decoder.h:53
Definition: algorithm.h:29
Definition: formatinfo.h:28
Definition: pixelformat.h:138
Definition: surface.h:67