Assuming you have already created the QuickTime VR world and node information atom containers, you would use the code (minus error checking) Listing 5-16 to add them to the QTVR track.
Listing 5-16 Adding atom containers to a track
long descSize; |
QTVRSampleDescriptionHandle qtvrSampleDesc; |
// Create a QTVR sample description handle |
descSize = sizeof(QTVRSampleDescription) + GetHandleSize((Handle) vrWorld) - |
sizeof(UInt32); |
qtvrSampleDesc = (QTVRSampleDescriptionHandle) NewHandleClear (descSize); |
(*qtvrSampleDesc)->size = descSize; |
(*qtvrSampleDesc)->type = kQTVRQTVRType; |
// Copy the VR world atom container data into the QTVR sample description |
BlockMove (*((Handle) vrWorld), &((*qtvrSampleDesc)->data), |
GetHandleSize((Handle) vrWorld)); |
// Now add it to the QTVR track's media |
err = BeginMediaEdits (qtvrMedia); |
err = AddMediaSample (qtvrMedia, (Handle) nodeInfo, 0, |
GetHandleSize((Handle) nodeInfo), duration, |
(SampleDescriptionHandle) qtvrSampleDesc, 1, 0, &sampleTime); |
err = EndMediaEdits (qtvrMedia); |
InsertMediaIntoTrack (qtvrTrack, trackTime, sampleTime, duration, 1L<<16); |
The duration value
is computed based on the duration of the corresponding image track samples
for the node. The value of trackTime is
the time for the beginning of the current node (zero for a single
node movie). The values of duration and sampleTime are
in the time base of the media; the value of trackTime is
in the movie’s time base.
Last updated: 2007-09-04