ADC Home > Reference Library > Technical Q&As > QuickTime > QuickTime Component Creation >
|
Q:
I'm currently working on implementing the MovieExportFromProceduresToDataRef
function for an export component, but I've run into
couldNotResolveDataRef errors using In the DataHSetDataRef case, I manually iterate over all the Data Handler components using FindNextComponent until I find a handler for the dataRefType I'm passed in (I'm currently only concerned with 'alis' references). I open it using OpenComponent and call DataHSetDataRef. This results in a couldNotResolveDataRef (-2000) error. After looking though some QuickTime documentation I encountered OpenADataHandler. This seemed like a much better, more convenient way to do what I needed. I removed all my previous code in favor of this single API, but it returns the same couldNotResolveDataRef error. Is there something else I can do to get DataHSetDataRef to work? Is OpenADataHandler the correct API? A: DataHSetDataRef assigns a data reference to the data handler
component you're working with, this reference is used to identify and
locate a movie's container. The 'alis' Data Handler Components internal implementation of DataHSetDataRef performs a MatchAlias to find the file referenced. If the file does not yet exist, MatchAlias will return a file not found error ('fnfErr') but will also return a valid FSSpec. The error returned from DataHSetDataRef in this case is couldNotResolveDataRef, exactly what is being seen. The data reference is good, even though the call returned an error. OpenADataHandler on the other hand is a 'convenience' function which finds, opens, and sets up a data handler component in a single call. It's internal implementation uses the sequence of GetDataHandler, OpenAComponent and SetDataRef calls. However, it checks the result of DataHSetDataRef and fails if the result is not 'noErr', again returning couldNotResolveDataRef. Therefore, you currently cannot replace the GetDataHandler, OpenAComponent, SetDataRef sequence of calls (see Listing 1) with the simpler OpenADataHandler call for the writing case. If the file already exists you will not encounter this problem. Notice the result from DataHSetDataRef is ignored in the code because the file might not exist.
Additionally, developers should be aware that component manager functions are often unable to make the best choice when there are several different data handlers available for data references of a specific type. Developers should always use either GetDataHandler or OpenADataHandler (note the case discussed above) APIs when attempting to find and/or open a Data Handler Component. Using FindNextComponent may get you something you didn't really want. For example, when looking for an 'alis' Data Handler you could find the "Apple Alias Data Handler for CDi Disks" or the "Apple Alias Data Handler" or the "Streaming file data handler." All three have the same Type and SubType but serve different purposes. Additional information: QuickTime Data Handler Documentation [Feb 07 2002] |
|