[Scummvm-git-logs] scummvm master -> 9852f49329c4f8288446dbdf051836247ba0a0fc

moralrecordings code at moral.net.au
Sat Aug 1 15:17:43 UTC 2020


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
628273226b DIRECTOR: Move digital video properties to channel
9852f49329 DIRECTOR: Add load hook for QuickTime movies


Commit: 628273226b6a0df685ef50fcf8460371a53b6bc2
    https://github.com/scummvm/scummvm/commit/628273226b6a0df685ef50fcf8460371a53b6bc2
Author: Scott Percival (code at moral.net.au)
Date: 2020-08-01T23:15:12+08:00

Commit Message:
DIRECTOR: Move digital video properties to channel

Changed paths:
    engines/director/channel.cpp
    engines/director/channel.h
    engines/director/lingo/lingo-the.cpp
    engines/director/sprite.cpp
    engines/director/sprite.h


diff --git a/engines/director/channel.cpp b/engines/director/channel.cpp
index b17752c98e..f6775aa152 100644
--- a/engines/director/channel.cpp
+++ b/engines/director/channel.cpp
@@ -44,6 +44,11 @@ Channel::Channel(Sprite *sp, int priority) {
 	_width = _sprite->_width;
 	_height = _sprite->_height;
 
+	_movieRate = 0;
+	_movieTime = 0;
+	_startTime = 0;
+	_stopTime = 0;
+
 	_visible = true;
 	_dirty = true;
 
diff --git a/engines/director/channel.h b/engines/director/channel.h
index 6f353061a8..f36824c0d3 100644
--- a/engines/director/channel.h
+++ b/engines/director/channel.h
@@ -78,6 +78,12 @@ public:
 	int _width;
 	int _height;
 
+	// Using in digital movie sprites
+	byte _movieRate;
+	uint16 _movieTime;
+	uint16 _startTime;
+	uint16 _stopTime;
+
 private:
 	Graphics::ManagedSurface *getSurface();
 	MacShape *getShape();
diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp
index 97bb351a49..1e8e077329 100644
--- a/engines/director/lingo/lingo-the.cpp
+++ b/engines/director/lingo/lingo-the.cpp
@@ -1143,10 +1143,10 @@ Datum Lingo::getTheSprite(Datum &id1, int field) {
 		d.u.i = sprite->_moveable;
 		break;
 	case kTheMovieRate:
-		d.u.i = sprite->_movieRate;
+		d.u.i = channel->_movieRate;
 		break;
 	case kTheMovieTime:
-		d.u.i = sprite->_movieTime;
+		d.u.i = channel->_movieTime;
 		break;
 	case kThePattern:
 		d.u.i = sprite->getPattern();
@@ -1167,10 +1167,10 @@ Datum Lingo::getTheSprite(Datum &id1, int field) {
 		warning("STUB: Lingo::getTheSprite(): Unprocessed getting field \"%s\" of sprite", field2str(field));
 		break;
 	case kTheStartTime:
-		d.u.i = sprite->_startTime;
+		d.u.i = channel->_startTime;
 		break;
 	case kTheStopTime:
-		d.u.i = sprite->_stopTime;
+		d.u.i = channel->_stopTime;
 		break;
 	case kTheStretch:
 		d.u.i = sprite->_stretch;
@@ -1323,10 +1323,10 @@ void Lingo::setTheSprite(Datum &id1, int field, Datum &d) {
 		sprite->_moveable = d.asInt();
 		break;
 	case kTheMovieRate:
-		sprite->_movieRate = d.asInt();
+		channel->_movieRate = d.asInt();
 		break;
 	case kTheMovieTime:
-		sprite->_movieTime = d.asInt();
+		channel->_movieTime = d.asInt();
 		break;
 	case kThePattern:
 		if (d.asInt() != sprite->getPattern()){
@@ -1342,10 +1342,10 @@ void Lingo::setTheSprite(Datum &id1, int field, Datum &d) {
 		}
 		break;
 	case kTheStartTime:
-		sprite->_startTime = d.asInt();
+		channel->_startTime = d.asInt();
 		break;
 	case kTheStopTime:
-		sprite->_stopTime = d.asInt();
+		channel->_stopTime = d.asInt();
 		break;
 	case kTheStretch:
 		if (d.asInt() != sprite->_stretch) {
diff --git a/engines/director/sprite.cpp b/engines/director/sprite.cpp
index 7997bc0949..8353c03d49 100644
--- a/engines/director/sprite.cpp
+++ b/engines/director/sprite.cpp
@@ -67,10 +67,7 @@ Sprite::Sprite(Frame *frame) {
 	_foreColor = 0;
 
 	_blend = 0;
-	_movieRate = 0;
-	_movieTime = 0;
-	_startTime = 0;
-	_stopTime = 0;
+
 	_volume = 0;
 	_stretch = 0;
 }
diff --git a/engines/director/sprite.h b/engines/director/sprite.h
index 9941eb3b72..0fe66ac342 100644
--- a/engines/director/sprite.h
+++ b/engines/director/sprite.h
@@ -110,11 +110,7 @@ public:
 	byte _foreColor;
 
 	byte _blend;
-	// Using in digital movie sprites
-	byte _movieRate;
-	uint16 _movieTime;
-	uint16 _startTime;
-	uint16 _stopTime;
+
 	byte _volume;
 	byte _stretch;
 };


Commit: 9852f49329c4f8288446dbdf051836247ba0a0fc
    https://github.com/scummvm/scummvm/commit/9852f49329c4f8288446dbdf051836247ba0a0fc
Author: Scott Percival (code at moral.net.au)
Date: 2020-08-01T23:15:12+08:00

Commit Message:
DIRECTOR: Add load hook for QuickTime movies

Changed paths:
    engines/director/cast.cpp
    engines/director/cast.h
    engines/director/castmember.cpp
    engines/director/castmember.h


diff --git a/engines/director/cast.cpp b/engines/director/cast.cpp
index a80e9b2606..a6f3ca2c62 100644
--- a/engines/director/cast.cpp
+++ b/engines/director/cast.cpp
@@ -28,6 +28,7 @@
 #include "graphics/macgui/macfontmanager.h"
 #include "graphics/macgui/macwindowmanager.h"
 #include "image/bmp.h"
+#include "video/qt_decoder.h"
 
 #include "director/director.h"
 #include "director/cast.h"
@@ -352,7 +353,8 @@ bool Cast::loadArchive() {
 	copyCastStxts();
 
 	loadCastChildren();
-	loadSpriteSounds();
+	loadSoundCasts();
+	loadDigitalVideoCasts();
 
 	return true;
 }
@@ -538,8 +540,8 @@ void Cast::loadCastChildren() {
 	}
 }
 
-void Cast::loadSpriteSounds() {
-	debugC(1, kDebugLoading, "****** Preloading sprite sounds");
+void Cast::loadSoundCasts() {
+	debugC(1, kDebugLoading, "****** Preloading sound casts");
 
 	for (Common::HashMap<int, CastMember *>::iterator c = _loadedCast->begin(); c != _loadedCast->end(); ++c) {
 		if (!c->_value)
@@ -574,7 +576,7 @@ void Cast::loadSpriteSounds() {
 			break;
 		}
 
-		if (sndData != NULL && soundCast != NULL) {
+		if (sndData != NULL) {
 			if (sndData->size() == 0) {
 				// audio file is linked, load from the filesystem
 				AudioFileDecoder *audio = new AudioFileDecoder(_castsInfo[c->_key]->fileName);
@@ -590,6 +592,54 @@ void Cast::loadSpriteSounds() {
 	}
 }
 
+void Cast::loadDigitalVideoCasts() {
+	debugC(1, kDebugLoading, "****** Preloading digital video casts");
+
+	for (Common::HashMap<int, CastMember *>::iterator c = _loadedCast->begin(); c != _loadedCast->end(); ++c) {
+		if (!c->_value)
+			continue;
+
+		if (c->_value->_type != kCastDigitalVideo)
+			continue;
+
+		DigitalVideoCastMember *digitalVideoCast = (DigitalVideoCastMember *)c->_value;
+		uint32 tag = MKTAG('M', 'o', 'o', 'V');
+		uint16 videoId = (uint16)(c->_key + _castIDoffset);
+
+		if (_vm->getVersion() >= 4 && digitalVideoCast->_children.size() > 0) {
+			videoId = digitalVideoCast->_children[0].index;
+			tag = digitalVideoCast->_children[0].tag;
+		}
+
+		Common::SeekableSubReadStreamEndian *videoData = NULL;
+
+		switch (tag) {
+		case MKTAG('M', 'o', 'o', 'V'):
+			if (_castArchive->hasResource(MKTAG('M', 'o', 'o', 'V'), videoId)) {
+				debugC(2, kDebugLoading, "****** Loading 'MooV' id: %d", videoId);
+				videoData = _castArchive->getResource(MKTAG('M', 'o', 'o', 'V'), videoId);
+			}
+			break;
+		}
+
+		if (videoData == NULL || videoData->size() == 0) {
+			// video file is linked, load from the filesystem
+
+			// TODO: detect file type (AVI, QuickTime, FLIC) based on magic number,
+			// insert the right video decoder
+			digitalVideoCast->_video = new Video::QuickTimeDecoder();
+			if (!digitalVideoCast->_video->loadFile(_castsInfo[c->_key]->fileName)) {
+				warning("Cast::loadDigitalVideoCasts: failed to load QuickTime file for cast member %d", videoId);
+			}
+		} else {
+			warning("STUB: Cast::loadDigitalVideoCasts: unsupported non-zero MooV block");
+		}
+		if (videoData)
+			delete videoData;
+	}
+
+}
+
 PaletteV4 Cast::loadPalette(Common::SeekableSubReadStreamEndian &stream) {
 	uint16 steps = stream.size() / 6;
 	uint16 index = (steps * 3) - 1;
diff --git a/engines/director/cast.h b/engines/director/cast.h
index 645e93e8cc..bba930a04f 100644
--- a/engines/director/cast.h
+++ b/engines/director/cast.h
@@ -64,7 +64,8 @@ public:
 	void loadLingoContext(Common::SeekableSubReadStreamEndian &stream);
 
 	void loadCastChildren();
-	void loadSpriteSounds();
+	void loadSoundCasts();
+	void loadDigitalVideoCasts();
 
 	void copyCastStxts();
 	Common::Rect getCastMemberInitialRect(int castId);
diff --git a/engines/director/castmember.cpp b/engines/director/castmember.cpp
index cf77d21f2f..7c3945f95a 100644
--- a/engines/director/castmember.cpp
+++ b/engines/director/castmember.cpp
@@ -22,6 +22,7 @@
 
 #include "graphics/macgui/macbutton.h"
 #include "image/image_decoder.h"
+#include "video/qt_decoder.h"
 
 #include "director/director.h"
 #include "director/castmember.h"
@@ -233,6 +234,7 @@ Graphics::Surface *BitmapCastMember::getMatte() {
 DigitalVideoCastMember::DigitalVideoCastMember(Cast *cast, uint16 castId, Common::SeekableReadStreamEndian &stream, uint16 version)
 		: CastMember(cast, castId, stream) {
 	_type = kCastDigitalVideo;
+	_video = nullptr;
 
 	if (version < 4) {
 		warning("STUB: DigitalVideoCastMember: unhandled rect data");
diff --git a/engines/director/castmember.h b/engines/director/castmember.h
index 2ede8a81c3..26c2e48205 100644
--- a/engines/director/castmember.h
+++ b/engines/director/castmember.h
@@ -46,6 +46,10 @@ namespace Image {
 class ImageDecoder;
 }
 
+namespace Video {
+class VideoDecoder;
+}
+
 namespace Director {
 
 class Stxt;
@@ -130,6 +134,8 @@ public:
 	FrameRateType _frameRateType;
 
 	uint16 _frameRate;
+
+	Video::VideoDecoder *_video;
 };
 
 class SoundCastMember : public CastMember {




More information about the Scummvm-git-logs mailing list