[Scummvm-git-logs] scummvm master -> 06e6f95c925be1abc668480e5933b9f7c39119e6

sev- noreply at scummvm.org
Tue Jan 28 01:08:57 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:
06e6f95c92 VIDEO: Initial code for reading 'pano' description chunk in QTVR


Commit: 06e6f95c925be1abc668480e5933b9f7c39119e6
    https://github.com/scummvm/scummvm/commit/06e6f95c925be1abc668480e5933b9f7c39119e6
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-01-28T02:08:20+01:00

Commit Message:
VIDEO: Initial code for reading 'pano' description chunk in QTVR

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


diff --git a/video/qt_decoder.cpp b/video/qt_decoder.cpp
index 60f526d5c1a..f1060642142 100644
--- a/video/qt_decoder.cpp
+++ b/video/qt_decoder.cpp
@@ -219,7 +219,7 @@ Common::QuickTimeParser::SampleDesc *QuickTimeDecoder::readSampleDesc(Common::Qu
 
 		return entry;
 	} else if (track->codecType == CODEC_TYPE_PANO) {
-		//return readPanoSampleDesc(track, format, descSize);
+		return readPanoSampleDesc(track, format, descSize);
 	}
 
 	// Pass it on up
diff --git a/video/qt_decoder.h b/video/qt_decoder.h
index fa8e7f239d3..fe9b9a20d45 100644
--- a/video/qt_decoder.h
+++ b/video/qt_decoder.h
@@ -118,6 +118,7 @@ public:
 
 protected:
 	Common::QuickTimeParser::SampleDesc *readSampleDesc(Common::QuickTimeParser::Track *track, uint32 format, uint32 descSize);
+	Common::QuickTimeParser::SampleDesc *readPanoSampleDesc(Common::QuickTimeParser::Track *track, uint32 format, uint32 descSize);
 
 private:
 	void init();
@@ -186,6 +187,45 @@ private:
 		QuickTimeAudioTrack *_audioTrack;
 	};
 
+	class PanoSampleDesc : public Common::QuickTimeParser::SampleDesc {
+	public:
+		PanoSampleDesc(Common::QuickTimeParser::Track *parentTrack, uint32 codecTag);
+		~PanoSampleDesc();
+
+		uint32 _reserved1;
+		uint32 _reserved2;
+		int16 _majorVersion;
+		int16 _minorVersion;
+		int32 _sceneTrackID;
+		int32 _loResSceneTrackID;
+		byte _reserved3[4 * 6];
+		int32 _hotSpotTrackID;
+		byte _reserved4[4 * 9];
+		float _hPanStart;
+		float _hPanEnd;
+		float _vPanTop;
+		float _vPanBottom;
+		float _minimumZoom;
+		float _maximumZoom;
+
+		// info for the highest res version of scene track
+		uint32 _sceneSizeX;
+		uint32 _sceneSizeY;
+		uint32 _numFrames;
+		int16 _reserved5;
+		int16 _sceneNumFramesX;
+		int16 _sceneNumFramesY;
+		int16 _sceneColorDepth;
+
+		// info for the highest rest version of hotSpot track
+		int32 _hotSpotSizeX;
+		int32 _hotSpotSizeY;
+		int16 _reserved6;
+		int16 _hotSpotNumFramesX;
+		int16 _hotSpotNumFramesY;
+		int16 _hotSpotColorDepth;
+	};
+
 	// The VideoTrackHandler is the bridge between the time of playback
 	// and the media for the given track. It calculates when to start
 	// tracks and at what rate to play the media using the edit list.
diff --git a/video/qtvr_decoder.cpp b/video/qtvr_decoder.cpp
index e483aad016e..1a2a4b1bfb5 100644
--- a/video/qtvr_decoder.cpp
+++ b/video/qtvr_decoder.cpp
@@ -52,9 +52,68 @@ namespace Video {
 static const char * const MACGUI_DATA_BUNDLE = "macgui.dat";
 
 ////////////////////////////////////////////
-// QuickTimeDecoder
+// QuickTimeDecoder methods related to QTVR
 ////////////////////////////////////////////
 
+static float readAppleFloatField(Common::SeekableReadStream *stream) {
+	int16 a = stream->readSint16BE();
+	uint16 b = stream->readUint16BE();
+
+	float value = (float)a + (float)b / 65536.0f;
+
+	return value;
+}
+
+QuickTimeDecoder::PanoSampleDesc::PanoSampleDesc(Common::QuickTimeParser::Track *parentTrack, uint32 codecTag) : Common::QuickTimeParser::SampleDesc(parentTrack, codecTag) {
+}
+
+QuickTimeDecoder::PanoSampleDesc::~PanoSampleDesc() {
+}
+
+//
+// Panorama Track Sample Description
+//
+// Source: https://developer.apple.com/library/archive/technotes/tn/tn1035.html
+Common::QuickTimeParser::SampleDesc *QuickTimeDecoder::readPanoSampleDesc(Common::QuickTimeParser::Track *track, uint32 format, uint32 descSize) {
+
+	PanoSampleDesc *entry = new PanoSampleDesc(track, format);
+
+	entry->_reserved1         = _fd->readUint32BE(); //
+	entry->_reserved2         = _fd->readUint32BE(); // must be zero, also observed to be 1
+	entry->_majorVersion      = _fd->readSint16BE(); // must be zero, also observed to be 1
+	entry->_minorVersion      = _fd->readSint16BE();
+	entry->_sceneTrackID      = _fd->readSint32BE();
+	entry->_loResSceneTrackID = _fd->readSint32BE();
+	_fd->read(entry->_reserved3, 4 * 6);
+	entry->_hotSpotTrackID    = _fd->readSint32BE();
+	_fd->read(entry->_reserved4, 4 * 9);
+	entry->_hPanStart         = readAppleFloatField(_fd);
+	entry->_hPanEnd           = readAppleFloatField(_fd);
+	entry->_vPanTop           = readAppleFloatField(_fd);
+	entry->_vPanBottom        = readAppleFloatField(_fd);
+	entry->_minimumZoom       = readAppleFloatField(_fd);
+	entry->_maximumZoom       = readAppleFloatField(_fd);
+
+	// info for the highest res version of scene track
+	entry->_sceneSizeX        = _fd->readUint32BE();
+	entry->_sceneSizeY        = _fd->readUint32BE();
+	entry->_numFrames         = _fd->readUint32BE();
+	entry->_reserved5         = _fd->readSint16BE();
+	entry->_sceneNumFramesX   = _fd->readSint16BE();
+	entry->_sceneNumFramesY   = _fd->readSint16BE();
+	entry->_sceneColorDepth   = _fd->readSint16BE();
+
+	// info for the highest rest version of hotSpot track
+	entry->_hotSpotSizeX      = _fd->readSint32BE(); // pixel width of the hot spot panorama
+	entry->_hotSpotSizeY      = _fd->readSint32BE(); // pixel height of the hot spot panorama
+	entry->_reserved6         = _fd->readSint16BE();
+	entry->_hotSpotNumFramesX = _fd->readSint16BE(); // diced frames wide
+	entry->_hotSpotNumFramesY = _fd->readSint16BE(); // dices frame high
+	entry->_hotSpotColorDepth = _fd->readSint16BE(); // must be 8
+
+	return entry;
+}
+
 void QuickTimeDecoder::closeQTVR() {
 	delete _dataBundle;
 	_dataBundle = nullptr;




More information about the Scummvm-git-logs mailing list