[Scummvm-git-logs] scummvm master -> 7d9f3760205f15518ed050914a5e28bfcef12ab3

sev- noreply at scummvm.org
Wed Feb 5 00:42:41 UTC 2025


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

Summary:
f8d3ad96e2 VIDEO: QTVR: Add method to set target video size
0a796a52bb TESTBED: Set panorama video size
34d8412f72 VIDEO: QTVR: Initial panorama rendering
55f3ec876f VIDEO: QTVR: Split mouse handling code between objects and panoramas
7d9f376020 VIDEO: QTVR: Implemented horizontal scrolling for panoramas


Commit: f8d3ad96e27ceea075ad1f0b79174b5f3185ff8e
    https://github.com/scummvm/scummvm/commit/f8d3ad96e27ceea075ad1f0b79174b5f3185ff8e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-02-05T00:03:07+01:00

Commit Message:
VIDEO: QTVR: Add method to set target video size

Changed paths:
    video/qt_decoder.cpp
    video/qt_decoder.h


diff --git a/video/qt_decoder.cpp b/video/qt_decoder.cpp
index 024665c1e91..fdc3ced1291 100644
--- a/video/qt_decoder.cpp
+++ b/video/qt_decoder.cpp
@@ -95,6 +95,14 @@ void QuickTimeDecoder::close() {
 	closeQTVR();
 }
 
+void QuickTimeDecoder::setTargetSize(uint16 w, uint16 h) {
+	if (!isVR())
+		error("QuickTimeDecoder::setTargetSize() called on non-VR movie");
+
+	_width = w;
+	_height = h;
+}
+
 const Graphics::Surface *QuickTimeDecoder::decodeNextFrame() {
 	const Graphics::Surface *frame = VideoDecoder::decodeNextFrame();
 
@@ -407,7 +415,7 @@ bool QuickTimeDecoder::VideoTrackHandler::endOfTrack() const {
 	if (!_decoder->_isVR)
 		return _reversed ? (_curEdit == 0 && _curFrame < 0) : atLastEdit();
 	else
-		return false;
+		return true;
 }
 
 bool QuickTimeDecoder::VideoTrackHandler::seek(const Audio::Timestamp &requestedTime) {
diff --git a/video/qt_decoder.h b/video/qt_decoder.h
index f737858a7a6..925bb7780e0 100644
--- a/video/qt_decoder.h
+++ b/video/qt_decoder.h
@@ -75,6 +75,8 @@ public:
 	void enableEditListBoundsCheckQuirk(bool enable) { _enableEditListBoundsCheckQuirk = enable; }
 	Common::String getAliasPath();
 
+	void setTargetSize(uint16 w, uint16 h);
+
 	void handleMouseMove(int16 x, int16 y);
 	void handleMouseButton(bool isDown, int16 x = -1, int16 y = -1);
 
@@ -298,6 +300,7 @@ private:
 		PanoTrackHandler(QuickTimeDecoder *decoder, Common::QuickTimeParser::Track *parent);
 		~PanoTrackHandler();
 
+		bool endOfTrack() const { return false; }
 		uint16 getWidth() const;
 		uint16 getHeight() const;
 		int getCurFrame() const { return 1; }
@@ -327,6 +330,7 @@ private:
 		const Graphics::Surface *bufferNextFrame();
 
 		Graphics::Surface *_constructedPano;
+		Graphics::Surface *_constructedHotspots;
 		Graphics::Surface *_projectedPano;
 
 		bool _isPanoConstructed;


Commit: 0a796a52bb531aec066ff9f868c7fdc80529ec67
    https://github.com/scummvm/scummvm/commit/0a796a52bb531aec066ff9f868c7fdc80529ec67
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-02-05T00:03:50+01:00

Commit Message:
TESTBED: Set panorama video size

Changed paths:
    engines/testbed/video.cpp


diff --git a/engines/testbed/video.cpp b/engines/testbed/video.cpp
index 06e2ecaeda2..019a28c85e9 100644
--- a/engines/testbed/video.cpp
+++ b/engines/testbed/video.cpp
@@ -54,7 +54,7 @@ Common::Error Videotests::videoTest(const Common::FSNode &node) {
 }
 
 Common::Error Videotests::videoTest(Common::SeekableReadStream *stream, const Common::String &name) {
-	Video::VideoDecoder *video = new Video::QuickTimeDecoder();
+	Video::QuickTimeDecoder *video = new Video::QuickTimeDecoder();
 	if (!video->loadStream(stream)) {
 		warning("Cannot open video %s", name.c_str());
 		delete stream;
@@ -62,6 +62,10 @@ Common::Error Videotests::videoTest(Common::SeekableReadStream *stream, const Co
 		return Common::kReadingFailed;
 	}
 
+	video->setTargetSize(400, 300);
+
+	warning("Video size: %d x %d", video->getWidth(), video->getHeight());
+
 	Common::List<Graphics::PixelFormat> supportedFormatsList = g_system->getSupportedFormats();
 	Graphics::PixelFormat pixelformat = supportedFormatsList.front();
 	warning("Best pixel format: %s", pixelformat.toString().c_str());


Commit: 34d8412f72bd62ea00bb2136bb5f6ee5f14468da
    https://github.com/scummvm/scummvm/commit/34d8412f72bd62ea00bb2136bb5f6ee5f14468da
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-02-05T00:04:16+01:00

Commit Message:
VIDEO: QTVR: Initial panorama rendering

Changed paths:
    video/qtvr_decoder.cpp


diff --git a/video/qtvr_decoder.cpp b/video/qtvr_decoder.cpp
index deba638d8de..559f4309f1d 100644
--- a/video/qtvr_decoder.cpp
+++ b/video/qtvr_decoder.cpp
@@ -277,6 +277,7 @@ QuickTimeDecoder::PanoTrackHandler::PanoTrackHandler(QuickTimeDecoder *decoder,
 	_isPanoConstructed = false;
 
 	_constructedPano = nullptr;
+	_constructedHotspots = nullptr;
 	_projectedPano = nullptr;
 }
 
@@ -284,6 +285,9 @@ QuickTimeDecoder::PanoTrackHandler::~PanoTrackHandler() {
 	if (_isPanoConstructed) {
 		_constructedPano->free();
 		delete _constructedPano;
+
+		_constructedHotspots->free();
+		delete _constructedHotspots;
 	}
 
 	if (_projectedPano) {
@@ -332,11 +336,6 @@ const Graphics::Surface *QuickTimeDecoder::PanoTrackHandler::decodeNextFrame() {
 	if (!_isPanoConstructed)
 		return nullptr;
 
-	if (_projectedPano) {
-		_projectedPano->free();
-		delete _projectedPano;
-	}
-
 	projectPanorama();
 	return _projectedPano;
 }
@@ -399,9 +398,7 @@ void QuickTimeDecoder::PanoTrackHandler::constructPanorama() {
 
 	track = (VideoTrackHandler *)(_decoder->getTrack(_decoder->Common::QuickTimeParser::_tracks[desc->_hotSpotTrackID - 1]->targetTrack));
 
-	warning("hotspot format: %s", track->getPixelFormat().toString().c_str());
-
-	constructMosaic(track, desc->_hotSpotNumFramesX, desc->_hotSpotNumFramesY, "dumps/pano-hotspot.png");
+	_constructedHotspots = constructMosaic(track, desc->_hotSpotNumFramesX, desc->_hotSpotNumFramesY, "dumps/pano-hotspot.png");
 
 	_isPanoConstructed = true;
 }
@@ -410,9 +407,25 @@ void QuickTimeDecoder::PanoTrackHandler::projectPanorama() {
 	if (!_isPanoConstructed)
 		return;
 
-	_projectedPano = new Graphics::Surface();
-	_projectedPano->create(_constructedPano->w, _constructedPano->h, _constructedPano->format);
+	uint16 w = _decoder->getWidth(), h = _decoder->getHeight();
 
+	if (!_projectedPano) {
+		_projectedPano = new Graphics::Surface();
+		_projectedPano->create(w, h, _constructedPano->format);
+	}
+
+	for (uint16 y = 0; y < h; y++) {
+		for (uint16 x = 0; x < w; x++) {
+			int setX = y;
+			int setY = x;
+
+			uint32 pixel = _constructedPano->getPixel(setX, setY);
+			_projectedPano->setPixel(x, y, pixel);
+		}
+	}
+
+
+#if 0
 	const float c = _projectedPano->w;
 	const float r = c / (2 * M_PI);
 
@@ -433,6 +446,8 @@ void QuickTimeDecoder::PanoTrackHandler::projectPanorama() {
 			}
 		}
 	}
+
+#endif
 }
 
 enum {


Commit: 55f3ec876fe21f3d38fb3895f16b195f915996bf
    https://github.com/scummvm/scummvm/commit/55f3ec876fe21f3d38fb3895f16b195f915996bf
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-02-05T00:13:28+01:00

Commit Message:
VIDEO: QTVR: Split mouse handling code between objects and panoramas

Changed paths:
    video/qt_decoder.h
    video/qtvr_decoder.cpp


diff --git a/video/qt_decoder.h b/video/qt_decoder.h
index 925bb7780e0..86659a96df2 100644
--- a/video/qt_decoder.h
+++ b/video/qt_decoder.h
@@ -127,6 +127,11 @@ private:
 
 	void updateAudioBuffer();
 
+	void handleObjectMouseMove(int16 x, int16 y);
+	void handleObjectMouseButton(bool isDown, int16 x, int16 y);
+	void handlePanoMouseMove(int16 x, int16 y);
+	void handlePanoMouseButton(bool isDown, int16 x, int16 y);
+
 	void closeQTVR();
 	void updateAngles();
 	void updateQTVRCursor(int16 x, int16 y);
diff --git a/video/qtvr_decoder.cpp b/video/qtvr_decoder.cpp
index 559f4309f1d..fa42fdb4e08 100644
--- a/video/qtvr_decoder.cpp
+++ b/video/qtvr_decoder.cpp
@@ -128,9 +128,13 @@ void QuickTimeDecoder::updateAngles() {
 }
 
 void QuickTimeDecoder::handleMouseMove(int16 x, int16 y) {
-	if (_qtvrType != QTVRType::OBJECT)
-		return;
+	if (_qtvrType == QTVRType::OBJECT)
+		handleObjectMouseMove(x, y);
+	else if (_qtvrType == QTVRType::PANORAMA)
+		handlePanoMouseMove(x, y);
+}
 
+void QuickTimeDecoder::handleObjectMouseMove(int16 x, int16 y) {
 	updateQTVRCursor(x, y);
 
 	if (!_isMouseButtonDown)
@@ -177,7 +181,18 @@ void QuickTimeDecoder::handleMouseMove(int16 x, int16 y) {
 	}
 }
 
+void QuickTimeDecoder::handlePanoMouseMove(int16 x, int16 y) {
+}
+
+
 void QuickTimeDecoder::handleMouseButton(bool isDown, int16 x, int16 y) {
+	if (_qtvrType == QTVRType::OBJECT)
+		handleObjectMouseButton(isDown, x, y);
+	else if (_qtvrType == QTVRType::PANORAMA)
+		handlePanoMouseButton(isDown, x, y);
+}
+
+void QuickTimeDecoder::handleObjectMouseButton(bool isDown, int16 x, int16 y) {
 	if (isDown) {
 		if (y < _curBbox.top) {
 			setCurrentRow(getCurrentRow() + 1);
@@ -199,6 +214,9 @@ void QuickTimeDecoder::handleMouseButton(bool isDown, int16 x, int16 y) {
 	updateQTVRCursor(x, y);
 }
 
+void QuickTimeDecoder::handlePanoMouseButton(bool isDown, int16 x, int16 y) {
+}
+
 void QuickTimeDecoder::setCurrentRow(int row) {
 	VideoTrackHandler *track = (VideoTrackHandler *)_nextVideoTrack;
 


Commit: 7d9f3760205f15518ed050914a5e28bfcef12ab3
    https://github.com/scummvm/scummvm/commit/7d9f3760205f15518ed050914a5e28bfcef12ab3
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-02-05T01:41:21+01:00

Commit Message:
VIDEO: QTVR: Implemented horizontal scrolling for panoramas

Changed paths:
    video/qt_decoder.h
    video/qtvr_decoder.cpp


diff --git a/video/qt_decoder.h b/video/qt_decoder.h
index 86659a96df2..1f36c995801 100644
--- a/video/qt_decoder.h
+++ b/video/qt_decoder.h
@@ -324,6 +324,9 @@ private:
 		void constructPanorama();
 		Graphics::Surface *constructMosaic(VideoTrackHandler *track, uint w, uint h, Common::String fname);
 
+		float getCurAngle() { return _curAngle; }
+		void setCurAngle(float angle);
+
 	private:
 		QuickTimeDecoder *_decoder;
 		Common::QuickTimeParser::Track *_parent;
@@ -339,6 +342,9 @@ private:
 		Graphics::Surface *_projectedPano;
 
 		bool _isPanoConstructed;
+
+		float _curAngle;
+		bool _dirty;
 	};
 };
 
diff --git a/video/qtvr_decoder.cpp b/video/qtvr_decoder.cpp
index fa42fdb4e08..2de219aacfd 100644
--- a/video/qtvr_decoder.cpp
+++ b/video/qtvr_decoder.cpp
@@ -182,6 +182,35 @@ void QuickTimeDecoder::handleObjectMouseMove(int16 x, int16 y) {
 }
 
 void QuickTimeDecoder::handlePanoMouseMove(int16 x, int16 y) {
+	if (!_isMouseButtonDown)
+		return;
+
+	PanoTrackHandler *track = (PanoTrackHandler *)_nextVideoTrack;
+
+	// HACK: FIXME: Hard coded for now
+	const int sensitivity = 10;
+	const float speedFactor = 0.5f;
+
+	int16 mouseDeltaX = x - _prevMouseX;
+	int16 mouseDeltaY = y - _prevMouseY;
+
+	float speedX = (float)mouseDeltaX * speedFactor;
+	float speedY = (float)mouseDeltaY * speedFactor;
+
+	bool changed = false;
+
+	if (ABS(mouseDeltaX) >= sensitivity) {
+		track->setCurAngle(track->getCurAngle() + speedX);
+
+		changed = true;
+	}
+
+	(void)speedY;
+
+	if (changed) {
+		_prevMouseX = x;
+		_prevMouseY = y;
+	}
 }
 
 
@@ -215,6 +244,12 @@ void QuickTimeDecoder::handleObjectMouseButton(bool isDown, int16 x, int16 y) {
 }
 
 void QuickTimeDecoder::handlePanoMouseButton(bool isDown, int16 x, int16 y) {
+	_isMouseButtonDown = isDown;
+
+	if (isDown) {
+		_prevMouseX = x;
+		_prevMouseY = y;
+	}
 }
 
 void QuickTimeDecoder::setCurrentRow(int row) {
@@ -297,6 +332,10 @@ QuickTimeDecoder::PanoTrackHandler::PanoTrackHandler(QuickTimeDecoder *decoder,
 	_constructedPano = nullptr;
 	_constructedHotspots = nullptr;
 	_projectedPano = nullptr;
+
+	_curAngle = 0.0f;
+
+	_dirty = true;
 }
 
 QuickTimeDecoder::PanoTrackHandler::~PanoTrackHandler() {
@@ -354,7 +393,9 @@ const Graphics::Surface *QuickTimeDecoder::PanoTrackHandler::decodeNextFrame() {
 	if (!_isPanoConstructed)
 		return nullptr;
 
-	projectPanorama();
+	if (_dirty)
+		projectPanorama();
+
 	return _projectedPano;
 }
 
@@ -419,6 +460,8 @@ void QuickTimeDecoder::PanoTrackHandler::constructPanorama() {
 	_constructedHotspots = constructMosaic(track, desc->_hotSpotNumFramesX, desc->_hotSpotNumFramesY, "dumps/pano-hotspot.png");
 
 	_isPanoConstructed = true;
+
+	_curAngle = desc->_hPanStart;
 }
 
 void QuickTimeDecoder::PanoTrackHandler::projectPanorama() {
@@ -432,16 +475,21 @@ void QuickTimeDecoder::PanoTrackHandler::projectPanorama() {
 		_projectedPano->create(w, h, _constructedPano->format);
 	}
 
+	PanoSampleDesc *desc = (PanoSampleDesc *)_parent->sampleDescs[0];
+	int startY = ((float)desc->_sceneSizeY / (desc->_hPanEnd - desc->_hPanStart)) * (_curAngle - desc->_hPanStart);
+
 	for (uint16 y = 0; y < h; y++) {
 		for (uint16 x = 0; x < w; x++) {
 			int setX = y;
-			int setY = x;
+			int setY = x + startY;
 
 			uint32 pixel = _constructedPano->getPixel(setX, setY);
 			_projectedPano->setPixel(x, y, pixel);
 		}
 	}
 
+	_dirty = false;
+
 
 #if 0
 	const float c = _projectedPano->w;
@@ -468,6 +516,22 @@ void QuickTimeDecoder::PanoTrackHandler::projectPanorama() {
 #endif
 }
 
+void QuickTimeDecoder::PanoTrackHandler::setCurAngle(float angle) {
+	PanoSampleDesc *desc = (PanoSampleDesc *)_parent->sampleDescs[0];
+
+	if (angle < desc->_hPanStart)
+		angle = desc->_hPanStart;
+
+	if (angle > desc->_hPanEnd)
+		angle = desc->_hPanEnd;
+
+	if (_curAngle != angle) {
+		_curAngle = angle;
+
+		_dirty = true;
+	}
+}
+
 enum {
 	kCurHand = 129,
 	kCurGrab = 130,




More information about the Scummvm-git-logs mailing list