ScummVM API documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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 
30 namespace Common {
31 class SeekableReadStream;
32 }
33 
34 namespace Video {
35 
44 class DXADecoder : public VideoDecoder {
45 public:
46  DXADecoder();
47  virtual ~DXADecoder();
48 
49  bool loadStream(Common::SeekableReadStream *stream);
50 
51 protected:
55  virtual void readSoundData(Common::SeekableReadStream *stream);
56 
57 private:
58  class DXAVideoTrack : public FixedRateVideoTrack {
59  public:
60  DXAVideoTrack(Common::SeekableReadStream *stream);
61  ~DXAVideoTrack();
62 
63  bool isRewindable() const { return true; }
64  bool rewind();
65 
66  uint16 getWidth() const { return _width; }
67  uint16 getHeight() const { return _height; }
68  Graphics::PixelFormat getPixelFormat() const;
69  int getCurFrame() const { return _curFrame; }
70  int getFrameCount() const { return _frameCount; }
71  const Graphics::Surface *decodeNextFrame();
72  const byte *getPalette() const { _dirtyPalette = false; return _palette.data(); }
73  bool hasDirtyPalette() const { return _dirtyPalette; }
74 
75  void setFrameStartPos();
76 
77  protected:
78  Common::Rational getFrameRate() const { 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: surface.h:67
Definition: dxa_decoder.h:44
Definition: video_decoder.h:698
Definition: pixelformat.h:138
Definition: stream.h:745
Definition: rational.h:40
Definition: video_decoder.h:53
Definition: algorithm.h:29
Simple class for handling a palette data.
Definition: palette.h:51
Definition: avi_frames.h:36