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