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