VIDEO: Implement VMD subtitles

svn-id: r51915
This commit is contained in:
Sven Hesse 2010-08-08 01:05:16 +00:00
parent e6f5785436
commit 0be37b6b28
2 changed files with 21 additions and 4 deletions

View File

@ -221,6 +221,10 @@ Common::MemoryReadStream *CoktelDecoder::getEmbeddedFile(const Common::String &f
return 0;
}
int32 CoktelDecoder::getSubtitleIndex() const {
return -1;
}
void CoktelDecoder::close() {
disableSound();
freeSurface();
@ -1473,7 +1477,8 @@ VMDDecoder::VMDDecoder(Audio::Mixer &mixer, Audio::Mixer::SoundType soundType) :
_audioFormat(kAudioFormat8bitRaw), _hasVideo(false), _videoCodec(0),
_blitMode(0), _bytesPerPixel(0), _firstFramePos(0),
_frameData(0), _frameDataSize(0), _frameDataLen(0),
_videoBuffer(0), _videoBufferSize(0), _externalCodec(false), _codec(0) {
_videoBuffer(0), _videoBufferSize(0), _externalCodec(false), _codec(0),
_subtitle(-1) {
}
@ -1499,6 +1504,8 @@ bool VMDDecoder::seek(int32 frame, int whence, bool restart) {
_stream->seek(_frames[frame + 1].offset);
_curFrame = frame;
_subtitle = -1;
return true;
}
@ -1927,6 +1934,7 @@ void VMDDecoder::processFrame() {
_dirtyRects.clear();
_paletteDirty = false;
_subtitle = -1;
bool startSound = false;
@ -2029,9 +2037,7 @@ void VMDDecoder::processFrame() {
} else if (part.type == kPartTypeSubtitle) {
// TODO:
// state.speechId = part.id;
// Always triggers when speech starts
_subtitle = part.id;
_stream->skip(part.size);
} else {
@ -2443,6 +2449,10 @@ Common::MemoryReadStream *VMDDecoder::getEmbeddedFile(const Common::String &file
return stream;
}
int32 VMDDecoder::getSubtitleIndex() const {
return _subtitle;
}
} // End of namespace Graphics
#endif // GRAPHICS_VIDEO_COKTELDECODER_H

View File

@ -110,6 +110,9 @@ public:
/** Return that embedded file. */
virtual Common::MemoryReadStream *getEmbeddedFile(const Common::String &fileName) const;
/** Return the current subtitle index. */
virtual int32 getSubtitleIndex() const;
// VideoDecoder interface
@ -351,6 +354,8 @@ public:
bool hasEmbeddedFile(const Common::String &fileName) const;
Common::MemoryReadStream *getEmbeddedFile(const Common::String &fileName) const;
int32 getSubtitleIndex() const;
// VideoDecoder interface
@ -459,6 +464,8 @@ private:
bool _externalCodec;
Codec *_codec;
int32 _subtitle;
// Loading helper functions
bool assessVideoProperties();
bool assessAudioProperties();