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;
154 virtual uint32 getVideoBufferSize()
const = 0;
160 int getCurFrame()
const;
161 int getNbFramesPastEnd()
const;
176 virtual bool isVideoLoaded()
const = 0;
179 bool endOfVideo()
const;
189 uint16 getWidth()
const;
190 uint16 getHeight()
const;
191 virtual uint32 getFlags()
const = 0;
192 virtual uint16 getSoundFlags()
const = 0;
195 uint32 getFrameCount()
const;
197 const byte *getPalette();
198 bool hasDirtyPalette()
const;
200 uint32 getTimeToNextFrame()
const;
201 uint32 getStaticTimeToNextFrame()
const;
202 int32 getExpectedFrameFromCurrentTime()
const;
204 void pauseVideo(
bool pause);
215 kFeaturesNone = 0x0000,
216 kFeaturesPalette = 0x0008,
217 kFeaturesDataSize = 0x0020,
218 kFeaturesSound = 0x0040,
219 kFeaturesFrameCoords = 0x0080,
220 kFeaturesStdCoords = 0x0100,
221 kFeaturesFramePos = 0x0200,
222 kFeaturesVideo = 0x0400
240 int32 _nbFramesPastEnd;
260 SoundStage _soundStage;
265 bool evaluateSeekFrame(int32 &frame,
int whence)
const;
269 void createSurface();
273 uint32 deLZ77(byte *dest,
const byte *src, uint32 srcSize, uint32 destSize);
274 void deRLE(byte *&destPtr,
const byte *&srcPtr, int16 destLen, int16 srcLen);
287 inline void unsignedToSigned(byte *buffer,
int length);
290 uint32 _pauseStartTime;
294 class PreIMDDecoder :
public CoktelDecoder {
296 PreIMDDecoder(uint16 width, uint16 height,
Audio::Mixer *mixer,
302 bool seek(int32 frame,
int whence = SEEK_SET,
bool restart =
false);
307 bool isVideoLoaded()
const;
311 uint32 getFlags()
const;
312 uint16 getSoundFlags()
const;
313 uint32 getVideoBufferSize()
const;
322 uint32 _videoBufferSize;
329 class IMDDecoder :
public CoktelDecoder {
336 bool seek(int32 frame,
int whence = SEEK_SET,
bool restart =
false);
338 void setXY(uint16 x, uint16 y);
343 bool isVideoLoaded()
const;
347 uint32 getFlags()
const;
348 uint16 getSoundFlags()
const;
349 uint32 getVideoBufferSize()
const;
355 kCommandNextSound = 0xFF00,
356 kCommandStartSound = 0xFF01,
358 kCommandBreak = 0xFFF0,
359 kCommandBreakSkip0 = 0xFFF1,
360 kCommandBreakSkip16 = 0xFFF2,
361 kCommandBreakSkip32 = 0xFFF3,
362 kCommandBreakMask = 0xFFF8,
364 kCommandPalette = 0xFFF4,
365 kCommandVideoData = 0xFFFC,
367 kCommandJump = 0xFFFD
389 uint32 _firstFramePos;
393 uint32 _videoBufferSize;
394 byte *_videoBuffer[2];
395 uint32 _videoBufferLen[2];
400 int16 _soundSliceSize;
401 int16 _soundSlicesCount;
404 bool loadCoordinates();
405 bool loadFrameTableOffsets(uint32 &framePosPos, uint32 &frameCoordsPos);
406 bool assessVideoProperties();
407 bool assessAudioProperties();
408 bool loadFrameTables(uint32 framePosPos, uint32 frameCoordsPos);
418 void nextSoundSlice(
bool hasNextCmd);
419 bool initialSoundSlice(
bool hasNextCmd);
420 void emptySoundSlice(
bool hasNextCmd);
423 class VMDDecoder :
public CoktelDecoder {
424 friend class AdvancedVMDDecoder;
432 bool seek(int32 frame,
int whence = SEEK_SET,
bool restart =
false);
434 void setXY(uint16 x, uint16 y);
436 void colorModeChanged();
438 bool getFrameCoords(int16 frame, int16 &x, int16 &y, int16 &width, int16 &height);
440 bool hasEmbeddedFiles()
const;
444 int32 getSubtitleIndex()
const;
446 bool hasVideo()
const;
447 bool isPaletted()
const;
452 bool isVideoLoaded()
const;
456 uint32 getFlags()
const;
457 uint16 getSoundFlags()
const;
458 uint32 getVideoBufferSize()
const;
463 void setAutoStartSound(
bool autoStartSound);
467 kPartTypeSeparator = 0,
472 kPartTypeSubtitle = 5
476 kAudioFormat8bitRaw = 0,
477 kAudioFormat16bitDPCM = 1,
478 kAudioFormat16bitADPCM = 2
519 uint32 _frameInfoOffset;
520 uint16 _partsPerFrame;
528 int16 _soundSliceSize;
529 int16 _soundSlicesCount;
530 byte _soundBytesPerSample;
532 uint32 _soundHeaderSize;
533 uint32 _soundDataSize;
534 uint32 _soundLastFilledFrame;
535 AudioFormat _audioFormat;
536 bool _autoStartSound;
555 uint32 _firstFramePos;
557 uint32 _videoBufferSize;
558 byte *_videoBuffer[3];
559 uint32 _videoBufferLen[3];
571 bool assessVideoProperties();
572 bool assessAudioProperties();
573 bool openExternalCodec();
574 bool readFrameTable(
int &numFiles);
588 void emptySoundSlice (uint32 size);
589 void filledSoundSlice (uint32 size);
590 void filledSoundSlices(uint32 size, uint32 mask);
591 void createAudioStream();
593 uint8 evaluateMask(uint32 mask,
bool *fillInfo, uint8 &max);
600 bool getPartCoords(int16 frame, PartType type, int16 &x, int16 &y, int16 &width, int16 &height);
607 class AdvancedVMDDecoder :
public VideoDecoder {
610 ~AdvancedVMDDecoder();
615 void setSurfaceMemory(
void *mem, uint16 width, uint16 height, uint8 bpp);
618 class VMDVideoTrack :
public FixedRateVideoTrack {
620 VMDVideoTrack(VMDDecoder *decoder);
622 uint16 getWidth()
const;
623 uint16 getHeight()
const;
625 int getCurFrame()
const;
626 int getFrameCount()
const;
628 const byte *getPalette()
const;
629 bool hasDirtyPalette()
const;
635 VMDDecoder *_decoder;
638 class VMDAudioTrack :
public AudioTrack {
640 VMDAudioTrack(VMDDecoder *decoder);
646 VMDDecoder *_decoder;
649 VMDDecoder *_decoder;
650 VMDVideoTrack *_videoTrack;
651 VMDAudioTrack *_audioTrack;
656 #endif // VIDEO_COKTELDECODER_H 658 #endif // Engine and dynamic plugins guard
Definition: rational.h:40
SoundType
Definition: mixer.h:73
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:55
Definition: avi_frames.h:36
Definition: movie_decoder.h:32