29 #if !(defined(ENABLE_GOB) || defined(ENABLE_SCI32) || defined(DYNAMIC_MODULES)) 35 #ifndef VIDEO_COKTELDECODER_H 36 #define VIDEO_COKTELDECODER_H 38 #include "common/list.h" 39 #include "common/array.h" 40 #include "common/rational.h" 41 #include "common/str.h" 43 #include "graphics/palette.h" 44 #include "graphics/surface.h" 46 #include "video/video_decoder.h" 48 #include "audio/mixer.h" 52 class MemoryReadWriteStream;
53 class SeekableReadStream;
56 class QueuingAudioStream;
89 virtual ~CoktelDecoder();
94 virtual bool seek(int32 frame,
int whence = SEEK_SET,
bool restart =
false) = 0;
97 void setSurfaceMemory(
void *mem, uint16 width, uint16 height, uint8 bpp);
99 void setSurfaceMemory();
104 virtual void setXY(uint16 x, uint16 y);
108 void setDouble(
bool isDouble);
116 uint16 getDefaultX()
const;
118 uint16 getDefaultY()
const;
123 bool hasPalette()
const;
124 virtual bool hasVideo()
const;
126 bool hasSound()
const;
127 bool isSoundEnabled()
const;
128 bool isSoundPlaying()
const;
134 virtual void colorModeChanged();
137 virtual bool getFrameCoords(int16 frame, int16 &x, int16 &y, int16 &width, int16 &height);
140 virtual bool hasEmbeddedFiles()
const;
143 virtual bool hasEmbeddedFile(
const Common::String &fileName)
const;
149 virtual int32 getSubtitleIndex()
const;
152 virtual bool isPaletted()
const;
158 int getCurFrame()
const;
173 virtual bool isVideoLoaded()
const = 0;
176 bool endOfVideo()
const;
186 uint16 getWidth()
const;
187 uint16 getHeight()
const;
188 virtual uint32 getFlags()
const = 0;
191 uint32 getFrameCount()
const;
193 const byte *getPalette();
194 bool hasDirtyPalette()
const;
196 uint32 getTimeToNextFrame()
const;
197 uint32 getStaticTimeToNextFrame()
const;
198 int32 getExpectedFrameFromCurrentTime()
const;
200 void pauseVideo(
bool pause);
211 kFeaturesNone = 0x0000,
212 kFeaturesPalette = 0x0008,
213 kFeaturesDataSize = 0x0020,
214 kFeaturesSound = 0x0040,
215 kFeaturesFrameCoords = 0x0080,
216 kFeaturesStdCoords = 0x0100,
217 kFeaturesFramePos = 0x0200,
218 kFeaturesVideo = 0x0400
255 SoundStage _soundStage;
260 bool evaluateSeekFrame(int32 &frame,
int whence)
const;
264 void createSurface();
268 uint32 deLZ77(byte *dest,
const byte *src, uint32 srcSize, uint32 destSize);
269 void deRLE(byte *&destPtr,
const byte *&srcPtr, int16 destLen, int16 srcLen);
282 inline void unsignedToSigned(byte *buffer,
int length);
285 uint32 _pauseStartTime;
289 class PreIMDDecoder :
public CoktelDecoder {
291 PreIMDDecoder(uint16 width, uint16 height,
Audio::Mixer *mixer,
297 bool seek(int32 frame,
int whence = SEEK_SET,
bool restart =
false);
302 bool isVideoLoaded()
const;
306 uint32 getFlags()
const;
315 uint32 _videoBufferSize;
322 class IMDDecoder :
public CoktelDecoder {
329 bool seek(int32 frame,
int whence = SEEK_SET,
bool restart =
false);
331 void setXY(uint16 x, uint16 y);
336 bool isVideoLoaded()
const;
340 uint32 getFlags()
const;
346 kCommandNextSound = 0xFF00,
347 kCommandStartSound = 0xFF01,
349 kCommandBreak = 0xFFF0,
350 kCommandBreakSkip0 = 0xFFF1,
351 kCommandBreakSkip16 = 0xFFF2,
352 kCommandBreakSkip32 = 0xFFF3,
353 kCommandBreakMask = 0xFFF8,
355 kCommandPalette = 0xFFF4,
356 kCommandVideoData = 0xFFFC,
358 kCommandJump = 0xFFFD
380 uint32 _firstFramePos;
384 uint32 _videoBufferSize;
385 byte *_videoBuffer[2];
386 uint32 _videoBufferLen[2];
391 int16 _soundSliceSize;
392 int16 _soundSlicesCount;
395 bool loadCoordinates();
396 bool loadFrameTableOffsets(uint32 &framePosPos, uint32 &frameCoordsPos);
397 bool assessVideoProperties();
398 bool assessAudioProperties();
399 bool loadFrameTables(uint32 framePosPos, uint32 frameCoordsPos);
409 void nextSoundSlice(
bool hasNextCmd);
410 bool initialSoundSlice(
bool hasNextCmd);
411 void emptySoundSlice(
bool hasNextCmd);
414 class VMDDecoder :
public CoktelDecoder {
415 friend class AdvancedVMDDecoder;
423 bool seek(int32 frame,
int whence = SEEK_SET,
bool restart =
false);
425 void setXY(uint16 x, uint16 y);
427 void colorModeChanged();
429 bool getFrameCoords(int16 frame, int16 &x, int16 &y, int16 &width, int16 &height);
431 bool hasEmbeddedFiles()
const;
435 int32 getSubtitleIndex()
const;
437 bool hasVideo()
const;
438 bool isPaletted()
const;
443 bool isVideoLoaded()
const;
447 uint32 getFlags()
const;
452 void setAutoStartSound(
bool autoStartSound);
456 kPartTypeSeparator = 0,
461 kPartTypeSubtitle = 5
465 kAudioFormat8bitRaw = 0,
466 kAudioFormat16bitDPCM = 1,
467 kAudioFormat16bitADPCM = 2
508 uint32 _frameInfoOffset;
509 uint16 _partsPerFrame;
517 int16 _soundSliceSize;
518 int16 _soundSlicesCount;
519 byte _soundBytesPerSample;
521 uint32 _soundHeaderSize;
522 uint32 _soundDataSize;
523 uint32 _soundLastFilledFrame;
524 AudioFormat _audioFormat;
525 bool _autoStartSound;
544 uint32 _firstFramePos;
546 uint32 _videoBufferSize;
547 byte *_videoBuffer[3];
548 uint32 _videoBufferLen[3];
560 bool assessVideoProperties();
561 bool assessAudioProperties();
562 bool openExternalCodec();
563 bool readFrameTable(
int &numFiles);
577 void emptySoundSlice (uint32 size);
578 void filledSoundSlice (uint32 size);
579 void filledSoundSlices(uint32 size, uint32 mask);
580 void createAudioStream();
582 uint8 evaluateMask(uint32 mask,
bool *fillInfo, uint8 &max);
589 bool getPartCoords(int16 frame, PartType type, int16 &x, int16 &y, int16 &width, int16 &height);
596 class AdvancedVMDDecoder :
public VideoDecoder {
599 ~AdvancedVMDDecoder();
604 void setSurfaceMemory(
void *mem, uint16 width, uint16 height, uint8 bpp);
607 class VMDVideoTrack :
public FixedRateVideoTrack {
609 VMDVideoTrack(VMDDecoder *decoder);
611 uint16 getWidth()
const;
612 uint16 getHeight()
const;
614 int getCurFrame()
const;
615 int getFrameCount()
const;
617 const byte *getPalette()
const;
618 bool hasDirtyPalette()
const;
624 VMDDecoder *_decoder;
627 class VMDAudioTrack :
public AudioTrack {
629 VMDAudioTrack(VMDDecoder *decoder);
635 VMDDecoder *_decoder;
638 VMDDecoder *_decoder;
639 VMDVideoTrack *_videoTrack;
640 VMDAudioTrack *_audioTrack;
645 #endif // VIDEO_COKTELDECODER_H 647 #endif // Engine and dynamic plugins guard
Definition: rational.h:40
SoundType
Definition: mixer.h:62
Definition: algorithm.h:29
Definition: formatinfo.h:28
Definition: audiostream.h:50
Definition: memstream.h:283
Definition: audiostream.h:370
Simple class for handling a palette data.
Definition: palette.h:51
Definition: avi_frames.h:36
Definition: movie_decoder.h:32