ScummVM API documentation
seq_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 SCI_VIDEO_SEQ_DECODER_H
23 #define SCI_VIDEO_SEQ_DECODER_H
24 
25 #include "common/rational.h"
26 #include "graphics/pixelformat.h"
27 #include "video/video_decoder.h"
28 
29 namespace Common {
30 class SeekableReadStream;
31 }
32 
33 namespace Graphics {
34 struct Surface;
35 }
36 
37 namespace Sci {
38 
43 public:
44  SEQDecoder(uint frameDelay);
45  ~SEQDecoder() override;
46 
47  bool loadStream(Common::SeekableReadStream *stream) override;
48 
49 private:
50  class SEQVideoTrack : public FixedRateVideoTrack {
51  public:
52  SEQVideoTrack(Common::SeekableReadStream *stream, uint frameDelay);
53  ~SEQVideoTrack() override;
54 
55  uint16 getWidth() const override { return SEQ_SCREEN_WIDTH; }
56  uint16 getHeight() const override { return SEQ_SCREEN_HEIGHT; }
57  Graphics::PixelFormat getPixelFormat() const override { return Graphics::PixelFormat::createFormatCLUT8(); }
58  int getCurFrame() const override { return _curFrame; }
59  int getFrameCount() const override { return _frameCount; }
60  const Graphics::Surface *decodeNextFrame() override;
61  const byte *getPalette() const override;
62  bool hasDirtyPalette() const override { return _dirtyPalette; }
63 
64  protected:
65  Common::Rational getFrameRate() const override { return Common::Rational(60, _frameDelay); }
66 
67  private:
68  enum {
69  SEQ_SCREEN_WIDTH = 320,
70  SEQ_SCREEN_HEIGHT = 200
71  };
72 
73  void readPaletteChunk(uint16 chunkSize);
74  bool decodeFrame(byte *rleData, int rleSize, byte *litData, int litSize, byte *dest, int left, int width, int height, int colorKey);
75 
76  Common::SeekableReadStream *_fileStream;
77  int _curFrame, _frameCount;
78  byte _palette[256 * 3];
79  mutable bool _dirtyPalette;
80  Graphics::Surface *_surface;
81  uint _frameDelay;
82  };
83 
84  uint _frameDelay;
85 };
86 
87 } // End of namespace Sci
88 
89 #endif // SCI_VIDEO_SEQ_DECODER_H
Definition: surface.h:67
Definition: video_decoder.h:686
Definition: seq_decoder.h:42
Definition: pixelformat.h:138
Definition: stream.h:745
Definition: rational.h:40
Definition: video_decoder.h:53
Definition: algorithm.h:29
Definition: formatinfo.h:28
Definition: console.h:28
static PixelFormat createFormatCLUT8()
Definition: pixelformat.h:184