22 #ifndef VIDEO_HNM_DECODER_H 23 #define VIDEO_HNM_DECODER_H 25 #include "audio/audiostream.h" 26 #include "common/rational.h" 27 #include "graphics/surface.h" 28 #include "video/video_decoder.h" 36 class SeekableReadStream;
57 void readNextPacket()
override;
58 void close()
override;
60 void setRegularFrameDelay(uint32 regularFrameDelay) { _regularFrameDelayMs = regularFrameDelay; }
65 HNMVideoTrack(uint32 frameCount, uint32 regularFrameDelayMs, uint32 audioSampleRate);
68 bool endOfTrack()
const override {
return (_frameCount == 0) ? false : VideoTrack::endOfTrack(); }
69 int getCurFrame()
const override {
return _curFrame; }
70 int getFrameCount()
const override {
return _frameCount; }
71 uint32 getNextFrameStartTime()
const override {
return _nextFrameStartTime.msecs(); }
73 void restart() { _lastFrameDelaySamps = 0; }
75 virtual void newFrame(uint32 frameDelay) = 0;
76 virtual void decodeChunk(byte *data, uint32 size,
77 uint16 chunkType, uint16 flags) = 0;
80 uint32 _regularFrameDelayMs;
81 uint32 _lastFrameDelaySamps;
88 class HNM45VideoTrack :
public HNMVideoTrack {
91 uint16 getWidth()
const override {
return _surface.w; }
92 uint16 getHeight()
const override {
return _surface.h; }
95 const byte *getPalette()
const override { _dirtyPalette =
false;
return _palette; }
96 bool hasDirtyPalette()
const override {
return _dirtyPalette; }
98 virtual void newFrame(uint32 frameDelay)
override;
101 HNM45VideoTrack(uint32 width, uint32 height, uint32 frameSize, uint32 frameCount,
102 uint32 regularFrameDelayMs, uint32 audioSampleRate,
103 const byte *initialPalette =
nullptr);
104 ~HNM45VideoTrack()
override;
107 void decodePalette(byte *data, uint32 size);
111 byte _palette[256 * 3];
112 mutable bool _dirtyPalette;
118 class HNM4VideoTrack :
public HNM45VideoTrack {
120 HNM4VideoTrack(uint32 width, uint32 height, uint32 frameSize, uint32 frameCount,
121 uint32 regularFrameDelayMs, uint32 audioSampleRate,
122 const byte *initialPalette =
nullptr);
123 ~HNM4VideoTrack()
override;
126 void decodeChunk(byte *data, uint32 size,
127 uint16 chunkType, uint16 flags)
override;
131 void decodeInterframe(byte *data, uint32 size);
132 void decodeInterframeA(byte *data, uint32 size);
133 void decodeIntraframe(byte *data, uint32 size);
134 void presentFrame(uint16 flags);
139 class HNM5VideoTrack :
public HNM45VideoTrack {
141 HNM5VideoTrack(uint32 width, uint32 height, uint32 frameSize, uint32 frameCount,
142 uint32 regularFrameDelayMs, uint32 audioSampleRate,
143 const byte *initialPalette =
nullptr) :
144 HNM45VideoTrack(width, height, frameSize, frameCount, regularFrameDelayMs, audioSampleRate,
147 void decodeChunk(byte *data, uint32 size,
148 uint16 chunkType, uint16 flags)
override;
152 void decodeFrame(byte *data, uint32 size);
155 class HNM6VideoTrack :
public HNMVideoTrack {
157 HNM6VideoTrack(uint32 width, uint32 height, uint32 frameSize, uint32 frameCount,
158 uint32 regularFrameDelayMs, uint32 audioSampleRate,
160 ~HNM6VideoTrack()
override;
162 uint16 getWidth()
const override;
163 uint16 getHeight()
const override;
168 virtual void newFrame(uint32 frameDelay)
override;
170 void decodeChunk(byte *data, uint32 size,
171 uint16 chunkType, uint16 flags)
override;
181 virtual uint32 decodeSound(uint16 chunkType, byte *data, uint32 size) = 0;
184 class DPCMAudioTrack :
public HNMAudioTrack {
186 DPCMAudioTrack(uint16 format, uint16 bits, uint sampleRate,
bool stereo,
188 ~DPCMAudioTrack()
override;
190 uint32 decodeSound(uint16 chunkType, byte *data, uint32 size)
override;
203 class APCAudioTrack :
public HNMAudioTrack {
205 APCAudioTrack(uint sampleRate, byte stereo,
207 ~APCAudioTrack()
override;
209 uint32 decodeSound(uint16 chunkType, byte *data, uint32 size)
override;
218 byte *_initialPalette;
220 uint32 _regularFrameDelayMs;
222 HNMVideoTrack *_videoTrack;
223 HNMAudioTrack *_audioTrack;
228 uint32 _dataBufferAlloc;
Definition: video_decoder.h:711
Definition: timestamp.h:83
SoundType
Definition: mixer.h:62
Definition: video_decoder.h:53
Definition: hnm_decoder.h:52
Definition: algorithm.h:29
Definition: audiostream.h:50
Definition: audiostream.h:370
Definition: avi_frames.h:36
Definition: movie_decoder.h:32
Definition: video_decoder.h:577