13.07.2015 Views

Quicktime File Format (2012-08-14).pdf

Quicktime File Format (2012-08-14).pdf

Quicktime File Format (2012-08-14).pdf

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Some Useful Examples and ScenariosCreating, Copying, and Disposing of Atom ContainersFailOSErr (QTInsertChildren (containerA, targetAtom, containerB));Figure 6-4QT atom container after child atoms have been insertedQT atomcontainer A'abcd'1000Index = 1Offset = 10Index = 1Offset = 20'defg''hijk'900 2000DataIndex = 2Offset = 30In Listing 6-5 (page 329), the QTInsertChild function inserts a parent atom into the atom container theSample.Then, the code calls QTInsertChildren to insert the container theSprite into the container theSample.The parent atom is newSpriteAtom.Listing 6-5Inserting a container into another containerFailOSErr (QTInsertChild (theSample, kParentAtomIsContainer,kSpriteAtomType, spriteID, 0, 0, nil, &newSpriteAtom));FailOSErr (QTInsertChildren (theSample, newSpriteAtom, theSprite));QuickTime provides three other functions you can use to manipulate atoms in an atom container. TheQTReplaceAtom function replaces an atom and its children with a different atom and its children. You cancall the QTSwapAtoms function to swap the contents of two atoms in an atom container; after swapping, theID and index of each atom remains the same. The QTCopyAtom function copies an atom and its children to anew atom container.Retrieving Atoms From an Atom ContainerQuickTime provides functions you can use to retrieve information about the types of a parent atom’s children,to search for a specific atom, and to retrieve a leaf atom’s data.<strong>2012</strong>-<strong>08</strong>-<strong>14</strong> | © 2004, <strong>2012</strong> Apple Inc. All Rights Reserved.329

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!