aboutsummaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
authorSven Hesse2010-08-08 01:05:16 +0000
committerSven Hesse2010-08-08 01:05:16 +0000
commit0be37b6b28bf0089dd1f23bc6b81fb256c2cb4ae (patch)
treeb2e0e797889f3383abefa9039a89ccc769d4b5b6 /graphics
parente6f57854363452f3189e547ca945790d030ef409 (diff)
downloadscummvm-rg350-0be37b6b28bf0089dd1f23bc6b81fb256c2cb4ae.tar.gz
scummvm-rg350-0be37b6b28bf0089dd1f23bc6b81fb256c2cb4ae.tar.bz2
scummvm-rg350-0be37b6b28bf0089dd1f23bc6b81fb256c2cb4ae.zip
VIDEO: Implement VMD subtitles
svn-id: r51915
Diffstat (limited to 'graphics')
-rw-r--r--graphics/video/coktel_decoder.cpp18
-rw-r--r--graphics/video/coktel_decoder.h7
2 files changed, 21 insertions, 4 deletions
diff --git a/graphics/video/coktel_decoder.cpp b/graphics/video/coktel_decoder.cpp
index 3caf7f2e7f..f9a5ad4b62 100644
--- a/graphics/video/coktel_decoder.cpp
+++ b/graphics/video/coktel_decoder.cpp
@@ -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
diff --git a/graphics/video/coktel_decoder.h b/graphics/video/coktel_decoder.h
index 755406b491..76c266f5f6 100644
--- a/graphics/video/coktel_decoder.h
+++ b/graphics/video/coktel_decoder.h
@@ -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();