[Scummvm-git-logs] scummvm master -> 806c946fd6070eba5ec21763f229f5f2859e03ad
sev-
sev at scummvm.org
Sun Aug 23 17:47:14 UTC 2020
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
d35a2aa96e TESTBED: Added simple movie player. Plays QT movies only so far
564b5f104e DIRECTOR: LINGO: Play video when 'updateScreen' is called
806c946fd6 DIRECTOR: Attempt to implement 'directToStage'
Commit: d35a2aa96e0f15d6d0fe5c7db3c743f1df70e74f
https://github.com/scummvm/scummvm/commit/d35a2aa96e0f15d6d0fe5c7db3c743f1df70e74f
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-08-23T19:46:58+02:00
Commit Message:
TESTBED: Added simple movie player. Plays QT movies only so far
Invoke with --start-movie flag
Changed paths:
A engines/testbed/video.cpp
engines/testbed/module.mk
engines/testbed/testbed.cpp
engines/testbed/testbed.h
diff --git a/engines/testbed/module.mk b/engines/testbed/module.mk
index afbba5ce94..4142b613c2 100644
--- a/engines/testbed/module.mk
+++ b/engines/testbed/module.mk
@@ -13,7 +13,8 @@ MODULE_OBJS := \
sound.o \
encoding.o \
testbed.o \
- testsuite.o
+ testsuite.o \
+ video.o
ifdef USE_CLOUD
ifdef USE_LIBCURL
diff --git a/engines/testbed/testbed.cpp b/engines/testbed/testbed.cpp
index 39a053d935..e17b68e656 100644
--- a/engines/testbed/testbed.cpp
+++ b/engines/testbed/testbed.cpp
@@ -215,6 +215,11 @@ void TestbedEngine::checkForAllAchievements() {
}
Common::Error TestbedEngine::run() {
+ if (ConfMan.hasKey("start_movie")) {
+ videoTest();
+ return Common::kNoError;
+ }
+
// Initialize graphics using following:
initGraphics(320, 200);
diff --git a/engines/testbed/testbed.h b/engines/testbed/testbed.h
index 8f05568cca..f3c4286f60 100644
--- a/engines/testbed/testbed.h
+++ b/engines/testbed/testbed.h
@@ -61,6 +61,8 @@ public:
private:
void checkForAllAchievements();
+ void videoTest();
+
Common::Array<Testsuite *> _testsuiteList;
};
diff --git a/engines/testbed/video.cpp b/engines/testbed/video.cpp
new file mode 100644
index 0000000000..9331fc022b
--- /dev/null
+++ b/engines/testbed/video.cpp
@@ -0,0 +1,82 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "common/events.h"
+#include "engines/util.h"
+#include "video/qt_decoder.h"
+
+#include "testbed/testbed.h"
+
+namespace Testbed {
+
+void TestbedEngine::videoTest() {
+ Graphics::PixelFormat pixelformat = Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0);
+
+ initGraphics(640, 480, &pixelformat);
+
+ Common::String path = ConfMan.get("start_movie");
+
+ Video::VideoDecoder *video = new Video::QuickTimeDecoder();
+
+ if (!video->loadFile(path)) {
+ warning("Cannot open video %s", path.c_str());
+ return;
+ }
+
+ video->start();
+
+ while (!video->endOfVideo()) {
+ if (video->needsUpdate()) {
+ uint32 pos = video->getTime();
+ warning("video time: %d", pos);
+
+ const Graphics::Surface *frame = video->decodeNextFrame();
+ if (frame) {
+ Graphics::Surface *conv = frame->convertTo(pixelformat);
+
+ int x = 0, y = 0;
+
+ if (conv->w < g_system->getWidth() && conv->h < g_system->getHeight()) {
+ x = (g_system->getWidth() - conv->w) >> 1;
+ y = (g_system->getHeight() - conv->h) >> 1;
+ }
+ g_system->copyRectToScreen(conv->getPixels(), conv->pitch, x, y, MIN<uint16>(conv->w, 640), MIN<uint16>(conv->h, 480));
+ }
+
+ Common::Event event;
+
+ while (g_system->getEventManager()->pollEvent(event)) {
+ if (Engine::shouldQuit()) {
+ delete video;
+ return;
+ }
+ }
+
+ g_system->updateScreen();
+ g_system->delayMillis(10);
+ }
+ }
+
+ delete video;
+}
+
+}
Commit: 564b5f104ee42d5f04da63639c748688f97dc5ac
https://github.com/scummvm/scummvm/commit/564b5f104ee42d5f04da63639c748688f97dc5ac
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-08-23T19:46:58+02:00
Commit Message:
DIRECTOR: LINGO: Play video when 'updateScreen' is called
Changed paths:
engines/director/lingo/lingo-builtins.cpp
diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index 7bbb3776b7..5f24e80354 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -2080,6 +2080,10 @@ void LB::b_updateStage(int nargs) {
}
Score *score = movie->getScore();
+ if (movie->_videoPlayback) {
+ movie->getScore()->renderFrame(movie->getScore()->getCurrentFrame());
+ }
+
if (movie->getWindow()->render())
g_director->draw();
Commit: 806c946fd6070eba5ec21763f229f5f2859e03ad
https://github.com/scummvm/scummvm/commit/806c946fd6070eba5ec21763f229f5f2859e03ad
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-08-23T19:46:58+02:00
Commit Message:
DIRECTOR: Attempt to implement 'directToStage'
Not working, as it is not clear how to change priority of a channel
Changed paths:
engines/director/channel.cpp
engines/director/channel.h
engines/director/score.cpp
diff --git a/engines/director/channel.cpp b/engines/director/channel.cpp
index 84d6988533..98890905d8 100644
--- a/engines/director/channel.cpp
+++ b/engines/director/channel.cpp
@@ -253,6 +253,13 @@ bool Channel::isActiveVideo() {
return true;
}
+bool Channel::isVideoDirectToStage() {
+ if (!_sprite->_cast || _sprite->_cast->_type != kCastDigitalVideo)
+ return false;
+
+ return ((DigitalVideoCastMember *)_sprite->_cast)->_directToStage;
+}
+
Common::Rect Channel::getBbox(bool unstretched) {
Common::Rect result(unstretched ? _sprite->_width : _width,
unstretched ? _sprite->_height : _height);
diff --git a/engines/director/channel.h b/engines/director/channel.h
index a235f24d24..93f1999fda 100644
--- a/engines/director/channel.h
+++ b/engines/director/channel.h
@@ -53,6 +53,7 @@ public:
bool isMatteIntersect(Channel *channel);
bool isMatteWithin(Channel *channel);
bool isActiveVideo();
+ bool isVideoDirectToStage();
void setWidth(int w);
void setHeight(int h);
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index f000849ccc..8ccfdf3161 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -487,30 +487,40 @@ void Score::renderSprites(uint16 frameId, RenderMode mode) {
_movie->_videoPlayback = false;
- for (uint16 i = 0; i < _channels.size(); i++) {
- Channel *channel = _channels[i];
- Sprite *currentSprite = channel->_sprite;
- Sprite *nextSprite = _frames[frameId]->_sprites[i];
+ for (int pass = 0; pass < 2; pass++) {
+ for (uint16 i = 0; i < _channels.size(); i++) {
+ Channel *channel = _channels[i];
+ Sprite *currentSprite = channel->_sprite;
+ Sprite *nextSprite = _frames[frameId]->_sprites[i];
+
+ if (channel->isActiveVideo() && channel->isVideoDirectToStage()) {
+ if (pass == 0)
+ continue;
+ } else {
+ if (pass == 1)
+ continue;
+ }
- // widget content has changed and needs a redraw.
- // this doesn't include changes in dimension or position!
- bool widgetRedrawn = channel->updateWidget();
+ // widget content has changed and needs a redraw.
+ // this doesn't include changes in dimension or position!
+ bool widgetRedrawn = channel->updateWidget();
- if (channel->isActiveText())
- _movie->_currentEditableTextChannel = i;
+ if (channel->isActiveText())
+ _movie->_currentEditableTextChannel = i;
- if (channel->isActiveVideo())
- _movie->_videoPlayback = true;
+ if (channel->isActiveVideo())
+ _movie->_videoPlayback = true;
- if (channel->isDirty(nextSprite) || channel->isActiveVideo() || widgetRedrawn || mode == kRenderForceUpdate) {
- if (!currentSprite->_trails)
- _window->addDirtyRect(channel->getBbox());
+ if (channel->isDirty(nextSprite) || channel->isActiveVideo() || widgetRedrawn || mode == kRenderForceUpdate) {
+ if (!currentSprite->_trails)
+ _window->addDirtyRect(channel->getBbox());
- channel->setClean(nextSprite, i);
- _window->addDirtyRect(channel->getBbox());
- debugC(2, kDebugImages, "Score::renderSprites(): CH: %-3d castId: %03d(%s) [ink: %d, puppet: %d, moveable: %d, visible: %d] [bbox: %d,%d,%d,%d] [type: %d fg: %d bg: %d] [script: %d]", i, currentSprite->_castId, numToCastNum(currentSprite->_castId), currentSprite->_ink, currentSprite->_puppet, currentSprite->_moveable, channel->_visible, PRINT_RECT(channel->getBbox()), currentSprite->_spriteType, currentSprite->_foreColor, currentSprite->_backColor, currentSprite->_scriptId);
- } else {
- channel->setClean(nextSprite, i, true);
+ channel->setClean(nextSprite, i);
+ _window->addDirtyRect(channel->getBbox());
+ debugC(2, kDebugImages, "Score::renderSprites(): CH: %-3d castId: %03d(%s) [ink: %d, puppet: %d, moveable: %d, visible: %d] [bbox: %d,%d,%d,%d] [type: %d fg: %d bg: %d] [script: %d]", i, currentSprite->_castId, numToCastNum(currentSprite->_castId), currentSprite->_ink, currentSprite->_puppet, currentSprite->_moveable, channel->_visible, PRINT_RECT(channel->getBbox()), currentSprite->_spriteType, currentSprite->_foreColor, currentSprite->_backColor, currentSprite->_scriptId);
+ } else {
+ channel->setClean(nextSprite, i, true);
+ }
}
}
}
More information about the Scummvm-git-logs
mailing list