Movie Import Components - MovieImportDataRef Invoked For File Import Operations

Q: Did QuickTime 7.4 change the way Movie Import Components are called when importing from files?

A: Yes, QuickTime 7.4 changed how the Movie Toolbox invokes Movie Import Components when specifically importing from files. With the release of QuickTime 7.4, the Movie Toolbox directly calls MovieImportDataRef with an 'alis' (rAliasType) Data Reference when importing from files instead of calling MovieImportFile with an FSSpec.

Component Developers

There are two APIs clients of Movie Import Components may call to invoke an import operation from a file; MovieImportFile and MovieImportDataRef.

MovieImportFile

MovieImportFile is defined to take a File System Specification Record, or FSSpec, as the parameter specifying the name and location of a file. Since the time MovieImportFile was defined, use of the FSSpec with the Carbon File Manager has been deprecated and superseded by the FSRef.

pascal ComponentResult MyComponent_MovieImportFile(My_Globals glob,
                                                   const FSSpec *theFile,
                                                   Movie theMovie,
                                                   Track targetTrack,
                                                   Track *usedTrack,
                                                   TimeValue atTime,
                                                   TimeValue *durationAdded,
                                                   long inFlags,
                                                   long *outFlags)

Note: The FSSpec cannot encode long or Unicode file names. Using an alias Data Reference created from an FSRef gives QuickTime more reliable support for files with long and Unicode names.

Back to Top 

MovieImportDataRef

MovieImportDataRef is defined to use the standard QuickTime Data Reference abstraction, this is the general way QuickTime describes the location of media data.

pascal ComponentResult MyComponent_MovieImportDataRef(My_Globals glob,
                                                      Handle dataRef,
                                                      OSType dataRefType,
                                                      Movie theMovie,
                                                      Track targetTrack,
                                                      Track *usedTrack,
                                                      TimeValue atTime,
                                                      TimeValue *durationAdded,
                                                      long inFlags,
                                                      long *outFlags)

Developers writing Movie Import Components should implement both selectors to accommodate both older and newer behavior. MovieImportDataRef may be considered the designated import API and therefore MovieImportFile can simply be implemented by calling MovieImportDataRef as shown in Listing 1.

Listing 1: Example MovieImportFile Component Implementation.

pascal ComponentResult MyComponent_MovieImportFile(My_Globals glob,
                                                   const FSSpec *theFile,
                                                   Movie theMovie,
                                                   Track targetTrack,
                                                   Track *usedTrack,
                                                   TimeValue atTime,
                                                   TimeValue *durationAdded,
                                                   long inFlags,
                                                   long *outFlags)
{
    ComponentResult err = noErr;
    AliasHandle alias = NULL;

    *outFlags = 0;

    err = NewAliasMinimal(theFile, &alias);
    if (err) return err;

    err = MovieImportDataRef(glob->self,
                            (Handle)alias,
                            rAliasType,
                            theMovie,
                            targetTrack,
                            usedTrack,
                            atTime,
                            durationAdded,
                            inFlags,
                            outFlags);

    if (alias) DisposeHandle((Handle)alias);

    return err;
}

Back to Top 

Application Developers

Application developers calling Movie Import Components directly to import from files should not call MovieImportFile and move to MovieImportDataRef. For further details about Data Reference based QuickTime APIs see Modernizing QuickTime Applications.

Back to Top 

References

Back to Top 

Document Revision History

DateNotes
2008-03-11First Version

Posted: 2008-03-11


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.