The easiest way to open a graphics importer is to use a data reference. The data reference tells QuickTime where to find the data it needs, which is the texture file for the purposes of this article. Call the function QTNewDataReferenceFromCFURL() to create a data reference. This function was introduced in QuickTime 6.4. QuickTime 6.4 shipped with Mac OS X 10.3, which means QTNewDataReferenceFromCFURL() works on Mac OS X 10.3 and later. People running Mac OS X 10.2 have to download and install QuickTime 6.4.
QTNewDataReferenceFromCFURL() takes four arguments. The first argument is the file location you retrieved by calling CFBundleCopyResourceURL(). The second argument is flags, which you should set to 0. The third argument is the data reference that QTNewDataReferenceFromCFURL() returns. The fourth argument is the data type of the data reference that QTNewDataReferenceFromCFURL() returns.
OSErr error; Handle dataRef; OSType dataRefType; CFURLRef fileLocation; error = QTNewDataReferenceFromCFURL(fileLocation, 0, &dataRef, &dataRefType);
The data reference QTNewDataReferenceFromCFURL() returns is a handle, a pointer to a pointer. Before calling QTNewDataReferenceFromCFURL(), you must allocate memory for the handle by calling NewHandle(). The size of the handle is AliasHandle.
Handle dataRef; dataRef = NewHandle(sizeof(AliasHandle));
Next (Opening the Graphics Importer)
Previous (Finding the File in the Application Bundle)