Technical: QuickTime
Advanced Search
Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

Finding Movie Export Components

Dispatch 6

If you have code that must open a particular QuickTime export component to perform some operation, you should be as specific as possible in the ComponentDescription you use to find the component.

In the past, developers using an earlier version of QuickTime put code in their applications to find a particular component only to find that a later version of QuickTime added a new export component that also met the conditions for which they searched. In particular, developers had added code to find the export component that expected a sound track and output an AIFF file. QuickTime registered this component using the following type/subtype/manufacturer:

componentType - MovieExportType
componentSubType - kQTFileTypeAIFF
componentManufacturer - SoundMediaType

In searching for this component, the developers had used a ComponentDescription like the following with FindNextComponent:

ComponentDescription looking;
Component foundComponent = 0;
   
looking.componentType = MovieExportType;
looking.componentSubType = kQTFileTypeAIFF;
looking.componentManufacturer = 0;
looking.componentFlags = 0;
looking.componentFlagsMask = 0;
   
foundComponent = FindNextComponent( 0, &looking );
... use the component ...
   

The componentManufacturer is set to 0 meaning that any value is allowed for the componentManufacturer field. This worked fine until QuickTime added the Music track to AIFF exporter. This new exporter was registered using the settings shown next:

componentType - MovieExportType
componentSubType - kQTFileTypeAIFF
componentManufacturer - MusicMediaType

When the above developer code ran with the newer version of QuickTime, it found the new component instead of the one expected. Not surprisingly, this wasn't expected.

This could have been addressed earlier by being more specific in setting up the looking ComponentDescription. Above, if the line that set looking.componentManufacturer field was changed to:

looking.componentManufacter = SoundMediaType;

things would have worked from the beginning.

How Export Components are registered

Before QuickTime 3.0, export components were registered according to the following rules:

  • componentType was MovieExportType
  • componentSubType was set to the MacOS file type for the exported file (AIFF, PICT, TEXT, etc.)
  • componentManufacturer was set either to an OSType corresponding to a track type (subtype of a media handler component) or to an OSType with value 0. If set to a non-zero OSType, the movie must contain a track of this type for the exporter to be useful. Zero was used to indicate that the exporter did not depend upon the movie having a particular type of track.
  • componentFlags had various values depending upon the capabilities of the exporter.

Among other things, the subtype and manufacturer information is used by QuickTime to build the list of export formats available in the ConvertMovieToFile dialog (the same one seen in Movie Player's Export choice). It is also used to find a movie exporter with ConvertMovieToFile and PasteMovieIntoTypedHandle based upon any track type specified.

A problem with this registration mechanism is that it isn't possible to have more than one export component registered for a particular file type and for the same track type (or 0 if not track specific). So, it's possible to have one exporter that exports from a sound track to a AIFF file but not two.

With QuickTime 3.0, a change was made to overcome this limitation. Now, the componentManufacturer field can be assigned a unique OSType that is neither a media handler type nor 0. If this is done, the componentFlags field must have the movieExportMustGetSourceMediaType bit set and the component must implement the MovieExportGetSourceMediaType component routine. This routine simply returns either the track type if the component is track specific or 0 if it is track independent. This routine returns the same values that were previously stored in the componentManufacturer field. This frees up the componentManufacturer field to be used as, well, the manufacturer.

With this change, it is now possible to implement multiple export components that export to the same file type. QuickTime transparently handles finding components registered using either the older mechanism or the newer mechanism. In general, this should cause no problem for developers using ConvertMovieToFile or PasteMovieIntoTypedHandle. Developers who iterate through export components will be affected.

Finding the QuickTime Movie and DV Export Component

Only two exporters shipping with QuickTime 3.0 use the new registration mechanism. In both cases, these are new exporters so will cause no compatibility problems for applications based upon earlier releases of QuickTime. All other export components are registered as they were before.

The first component is the Movie to QuickTime Movie export component. It is registered using:

componentType - MovieExportType
componentSubType - MovieFileType
componentManufacturer - kAppleManufacturer
componentFlags - movieExportMustGetSourceMediaType and others

The second is the DV export component and is registered using:

componentType - MovieExportType
componentSubType - kQTFileTypeDVC
componentManufacturer - kAppleManufacturer
componentFlags - movieExportMustGetSourceMediaType and others

Applications that search for these components should search for these using the above information. As an example, to find the DV export component, you could use:

looking.componentType = MovieExportType;
looking.componentSubType = kQTFileTypeDVC;
looking.componentManufacturer = kAppleManufacturer;
looking.componentFlags = movieExportMustGetSourceMediaType;
looking.componentFlagsMask = movieExportMustGetSourceMediaType;

By setting the flags and flags mask to be movieExportMustGetSourceMediaType, this will only find the component that also has this bit set. This isn't strictly necessary but doesn't hurt.

Where else is this used?

Besides the newly added QuickTime movie export component, there are other export components available that use this registration mechanism. Specifically, there are a few QuickTime VR specific movie export components that also export QuickTime movie files (MovieFileType). Without the new way to register exporters, these components would have to set their componentSubTypes to something other than MovieFileType and there would be no way to know that these files export to movie files. By employing the new regisration mechanism, they can instead set their componentSubTypes to MovieFileType and change the manufacturer for each different component. Finding all the components that export to QuickTime movie files can be done easily like this:

ComponentDescription looking;
Component foundComponent = 0;
   
looking.componentType = MovieExportType;
looking.componentSubType = MovieFileType;
looking.componentManufacturer = 0;
looking.componentFlags = 0;
looking.componentFlagsMask = 0;
   
while( foundComponent = FindNextComponent( foundComponent,&looking ) ) {
    ... do something with the component ...
}
   

See Also

QuickTime 3 Reference - New registration mechanism

Modification History

4/16/98 - clf - First published
Topics
Previous | Next