aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/gob/videoplayer.cpp2
-rw-r--r--graphics/video/coktel_decoder.cpp36
-rw-r--r--graphics/video/coktel_decoder.h7
3 files changed, 43 insertions, 2 deletions
diff --git a/engines/gob/videoplayer.cpp b/engines/gob/videoplayer.cpp
index 16d3a7c6fd..83a70a648b 100644
--- a/engines/gob/videoplayer.cpp
+++ b/engines/gob/videoplayer.cpp
@@ -494,10 +494,8 @@ void VideoPlayer::writeVideoInfo(const Common::String &file, int16 varX, int16 v
width = video.decoder->getWidth();
width = video.decoder->getHeight();
- /*
if (VAR_OFFSET(varX) == 0xFFFFFFFF)
video.decoder->getFrameCoords(1, x, y, width, height);
- */
WRITE_VAR_OFFSET(varX , x);
WRITE_VAR_OFFSET(varY , y);
diff --git a/graphics/video/coktel_decoder.cpp b/graphics/video/coktel_decoder.cpp
index 4af11c3f1a..9d056da48d 100644
--- a/graphics/video/coktel_decoder.cpp
+++ b/graphics/video/coktel_decoder.cpp
@@ -205,6 +205,10 @@ void CoktelDecoder::disableSound() {
_audioStream = 0;
}
+bool CoktelDecoder::getFrameCoords(int16 frame, int16 &x, int16 &y, int16 &width, int16 &height) {
+ return false;
+}
+
bool CoktelDecoder::hasEmbeddedFiles() const {
return false;
}
@@ -2332,6 +2336,38 @@ PixelFormat VMDDecoder::getPixelFormat() const {
return PixelFormat::createFormatCLUT8();
}
+bool VMDDecoder::getPartCoords(int16 frame, PartType type, int16 &x, int16 &y, int16 &width, int16 &height) {
+ if (frame >= ((int32) _frameCount))
+ return false;
+
+ Frame &f = _frames[frame];
+
+ // Look for a part matching the requested type, stopping at a separator
+ Part *part = 0;
+ for (int i = 0; i < _partsPerFrame; i++) {
+ Part &p = f.parts[i];
+
+ if ((p.type == kPartTypeSeparator) || (p.type == type)) {
+ part = &p;
+ break;
+ }
+ }
+
+ if (!part)
+ return false;
+
+ x = part->left;
+ y = part->top;
+ width = part->right - part->left + 1;
+ height = part->bottom - part->top + 1;
+
+ return true;
+}
+
+bool VMDDecoder::getFrameCoords(int16 frame, int16 &x, int16 &y, int16 &width, int16 &height) {
+ return getPartCoords(frame, kPartTypeVideo, x, y, width, height);
+}
+
bool VMDDecoder::hasEmbeddedFiles() const {
return !_files.empty();
}
diff --git a/graphics/video/coktel_decoder.h b/graphics/video/coktel_decoder.h
index 408523ff48..60fdb57123 100644
--- a/graphics/video/coktel_decoder.h
+++ b/graphics/video/coktel_decoder.h
@@ -98,6 +98,9 @@ public:
void enableSound();
void disableSound();
+ /** Return the coordinates of the specified frame. */
+ bool getFrameCoords(int16 frame, int16 &x, int16 &y, int16 &width, int16 &height);
+
/** Return whether that video has any embedded files. */
virtual bool hasEmbeddedFiles() const;
@@ -340,6 +343,8 @@ public:
bool seek(int32 frame, int whence = SEEK_SET, bool restart = false);
+ bool getFrameCoords(int16 frame, int16 &x, int16 &y, int16 &width, int16 &height);
+
bool hasEmbeddedFiles() const;
bool hasEmbeddedFile(const Common::String &fileName) const;
Common::MemoryReadStream *getEmbeddedFile(const Common::String &fileName) const;
@@ -480,6 +485,8 @@ private:
// Sound decompression
byte *deDPCM (const byte *data, uint32 &size, int32 init[2]);
byte *deADPCM(const byte *data, uint32 &size, int32 init, int32 index);
+
+ bool getPartCoords(int16 frame, PartType type, int16 &x, int16 &y, int16 &width, int16 &height);
};
} // End of namespace Graphics