[Scummvm-git-logs] scummvm master -> afda417473afd843a36718ce32059a5a52c35ab0

sev- noreply at scummvm.org
Tue Feb 4 00:59:32 UTC 2025


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

Summary:
afda417473 VIDEO: Fix reading of 'pano' chunk from QTVR and initial panorama construction preps


Commit: afda417473afd843a36718ce32059a5a52c35ab0
    https://github.com/scummvm/scummvm/commit/afda417473afd843a36718ce32059a5a52c35ab0
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-02-04T01:58:59+01:00

Commit Message:
VIDEO: Fix reading of 'pano' chunk from QTVR and initial panorama construction preps

Changed paths:
    common/formats/quicktime.cpp
    video/qt_decoder.cpp
    video/qt_decoder.h
    video/qtvr_decoder.cpp


diff --git a/common/formats/quicktime.cpp b/common/formats/quicktime.cpp
index b7be8c86fe1..16bc59b62d8 100644
--- a/common/formats/quicktime.cpp
+++ b/common/formats/quicktime.cpp
@@ -613,9 +613,9 @@ int QuickTimeParser::readSTSD(Atom atom) {
 		_fd->readUint16BE(); // reserved
 		_fd->readUint16BE(); // index
 
-		track->sampleDescs.push_back(readSampleDesc(track, format, size - 16));
+		debug(0, "sampledesc %d: size=%d 4CC= %s codec_type=%d", i, size, tag2str(format), track->codecType);
 
-		debug(0, "size=%d 4CC= %s codec_type=%d", size, tag2str(format), track->codecType);
+		track->sampleDescs.push_back(readSampleDesc(track, format, size - 16));
 
 		if (!track->sampleDescs[i]) {
 			// other codec type, just skip (rtp, mp4s, tmcd ...)
diff --git a/video/qt_decoder.cpp b/video/qt_decoder.cpp
index eb0741ec1e4..29445a2e0dd 100644
--- a/video/qt_decoder.cpp
+++ b/video/qt_decoder.cpp
@@ -250,6 +250,14 @@ void QuickTimeDecoder::init() {
 			addTrack(new PanoTrackHandler(this, tracks[i]));
 	}
 
+	if (_qtvrType == QTVRType::PANORAMA) {
+		for (uint32 i = 0; i < Common::QuickTimeParser::_tracks.size(); i++) {
+			if (Common::QuickTimeParser::_tracks[i]->codecType == CODEC_TYPE_PANO) {
+				constructPanorama(i);
+			}
+		}
+	}
+
 	// Prepare the first video track
 	VideoTrackHandler *nextVideoTrack = (VideoTrackHandler *)findNextVideoTrack();
 
@@ -523,6 +531,21 @@ uint32 QuickTimeDecoder::VideoTrackHandler::getNextFrameStartTime() const {
 }
 
 const Graphics::Surface *QuickTimeDecoder::VideoTrackHandler::decodeNextFrame() {
+#if 0
+	if (_decoder->_qtvrType == QTVRType::PANORAMA) {
+		if (!_isPanoConstructed)
+			return nullptr;
+
+		if (_projectedPano) {
+			_projectedPano->free();
+			delete _projectedPano;
+		}
+
+		projectPanorama();
+		return _projectedPano;
+	}
+#endif
+
 	if (endOfTrack())
 		return 0;
 
diff --git a/video/qt_decoder.h b/video/qt_decoder.h
index 9f087c58790..3b4ae477ccc 100644
--- a/video/qt_decoder.h
+++ b/video/qt_decoder.h
@@ -132,6 +132,8 @@ private:
 	void cleanupCursors();
 	void computeInteractivityZones();
 
+	void constructPanorama(int trackNum);
+
 	uint16 _width, _height;
 
 	uint16 _prevMouseX, _prevMouseY;
@@ -192,9 +194,6 @@ private:
 		PanoSampleDesc(Common::QuickTimeParser::Track *parentTrack, uint32 codecTag);
 		~PanoSampleDesc();
 
-		uint32 _reserved1;			// must be zero
-		uint32 _reserved2;			// must be zero
-
 		int16 _majorVersion;		// must be zero, also observed to be 1
 		int16 _minorVersion;		// must be zero, also observed to be 1
 
@@ -321,7 +320,6 @@ private:
 
 		const byte *_curPalette;
 
-		void constructPanorama();
 		void projectPanorama();
 
 		const Graphics::Surface *bufferNextFrame();
diff --git a/video/qtvr_decoder.cpp b/video/qtvr_decoder.cpp
index ce16cdbdb76..7f96eb50a45 100644
--- a/video/qtvr_decoder.cpp
+++ b/video/qtvr_decoder.cpp
@@ -78,8 +78,8 @@ Common::QuickTimeParser::SampleDesc *QuickTimeDecoder::readPanoSampleDesc(Common
 
 	PanoSampleDesc *entry = new PanoSampleDesc(track, format);
 
-	entry->_reserved1         = _fd->readUint32BE(); //
-	entry->_reserved2         = _fd->readUint32BE(); // must be zero, also observed to be 1
+	uint32 pos = (uint32)_fd->pos();
+
 	entry->_majorVersion      = _fd->readSint16BE(); // must be zero, also observed to be 1
 	entry->_minorVersion      = _fd->readSint16BE();
 	entry->_sceneTrackID      = _fd->readSint32BE();
@@ -278,8 +278,6 @@ QuickTimeDecoder::PanoTrackHandler::PanoTrackHandler(QuickTimeDecoder *decoder,
 
 	_constructedPano = nullptr;
 	_projectedPano = nullptr;
-
-	constructPanorama();
 }
 
 QuickTimeDecoder::PanoTrackHandler::~PanoTrackHandler() {
@@ -303,7 +301,7 @@ uint16 QuickTimeDecoder::PanoTrackHandler::getHeight() const {
 }
 
 Graphics::PixelFormat QuickTimeDecoder::PanoTrackHandler::getPixelFormat() const {
-	return ((VideoSampleDesc *)_parent->sampleDescs[0])->_videoCodec->getPixelFormat();
+	return Graphics::PixelFormat::createFormatCLUT8();
 }
 
 Common::Rational QuickTimeDecoder::PanoTrackHandler::getScaledWidth() const {
@@ -347,7 +345,12 @@ const Graphics::Surface *QuickTimeDecoder::PanoTrackHandler::bufferNextFrame() {
 	return nullptr;
 }
 
-void QuickTimeDecoder::PanoTrackHandler::constructPanorama() {
+void QuickTimeDecoder::constructPanorama(int trackNum) {
+	PanoSampleDesc *desc = (PanoSampleDesc *)(Common::QuickTimeParser::_tracks[trackNum]->sampleDescs[0]);
+	warning("scene: %d (%d x %d) hotspots: %d (%d x %d)", desc->_sceneTrackID, desc->_sceneSizeX, desc->_sceneSizeY,
+			desc->_hotSpotTrackID, desc->_hotSpotSizeX, desc->_hotSpotSizeY);
+
+#if 0
 	int16 totalWidth = getHeight() * _parent->frameCount;
 	int16 totalHeight = getWidth();
 
@@ -377,6 +380,7 @@ void QuickTimeDecoder::PanoTrackHandler::constructPanorama() {
 	}
 
 	_isPanoConstructed = true;
+#endif
 }
 
 void QuickTimeDecoder::PanoTrackHandler::projectPanorama() {




More information about the Scummvm-git-logs mailing list