What's New in QuickTime 5
| Previous | Chapter Contents | Chapter Top | Next |
QuickTime 5 includes the addition of new data handler APIs -- DataHGetFileTypeOrdering and DataHGetMIMETypeAsync , discussed in this section.
The DataHGetFileTypeOrdering call allows for returning a list defining the order that file type-related information should be considered (for example, file type, file extension, MIME type) by a client. This allows a data handler such the URL data handler to indicate that MIME type information is more useful than, say, filename extension or Mac OS file type.
The DataHGetMIMETypeAsync call has been introduced in order to remove synchronous blocks from QuickTime's movie opening code.
QuickTime 5 also introduces a Pointer data handler, which supports references to data in memory.
Returns a handle of OSTypes which defines a preferred ordering for file typing information.
ComponentResult DataHGetFileTypeOrdering(DataHandler dh,
DataHFileTypeOrderingHandle * orderingListHandle);The OSTypes in the list can have one of these values:
// Types for DataHGetFileTypeOrdering
enum {
kDataHFileTypeMacOSFileType= 'ftyp',
kDataHFileTypeExtension= 'fext',
kDataHFileTypeMIME= 'mime'
};This is a new optional data handler component API that allows for returning a handle of OSTypes. The returned handle may only contain a subset of the currently defined types (i.e., Mac OS file type, extension, MIME type) to limit the consideration to reasonable types. For example, a Mac OS file type isn't meaningful if a data handler doesn't know it.
Before making a call to DataHGetFileTypeOrdering , the client should have opened the data handler and called DataHSetDataRef or DataHSetDataRefWithAnchor . This allows the data handler to return a different ordering based on the particular file. This might allow for a data handler to vary its ordering based on the location of the file. For example, on the Mac OS, it might use extensions only on foreign volumes. For other volumes, it might use a Mac OS file type followed by a file extension.
If the data handler has not set the data reference, it can either choose to return an error, or a reasonable default ordering list.
The GetMovieImporterForDataRef function has been updated to call DataHGetMIMETypeAsync if instructed to do so. There is a new flag kGetMovieImporterUseAsyncCalls that the client can pass to indicate this behavior. If GetMovieImporterForDataRef is allowed to use async calls, it should return notEnoughDataErr if it would block. Without this flag, the call may block.
Accommodates asynchronous discovery of a HTTP/FTP connection's MIME type.
pascal ComponentResult DataHGetMIMETypeAsync(DataHandler dh, Str255
mimeType, DataHCompletionUPP
completionRtn, long refCon);The DataHGetMIMETypeAsync call removes synchronous blocks from QuickTime's movie opening code. DataHGetMIMEType , the only call available before, will block if the data is not available yet and will continue blocking until either the information becomes available or the operation times out in 60 seconds. If it times out, it returns the error notEnoughDataErr.
The semantics of usage are the same as the already-available DataHGetFileTypeAsync call. With each call, a pointer to the value to be updated is passed to the routine. For DataHGetMIMEType , it is a pointer to a Str255 that will hold the MIME type when (if) it becomes available. The completionRtn is a standard DataHCompletion proc that is called when either the data becomes available or there is a failure (timeout, DataHFinishData() called with cancel). The refCon value is passed to the completion routine. The pointer will not be updated until the completion routine fires.
If a completion routine is not specified, however, the call will return immediately. If the MIME type is known, it will update mimeType and return noErr . If the information is not known yet, the error notEnoughDataErr will be returned. This allows non-blocking calls to be made to DataHGetMIMETypeAsync . If it returns another error, that indicates some other failure.
Allows information to be retrieved about a particular MIME type. The type of information is specified by a selector.
pascal OSErr QTGetMIMETypeInfo ( const char * mimeStringStart, short
mimeStringLength, OSType infoSelector,
void *infoDataPtr, long *infoDataSize );where the mimeStringStart argument is a pointer to the first character of a string holding the MIME type amd mimeStringLength contains the number of characters in the MIME type string. These two arguments allow references to Pascal, C and non-delimited string buffers to be passed with equal abandon.
The infoSelector parameter holds the type of information being requested. infoDataPtr is a pointer to the value to be updated. infoDataSize on input is the size of the data being expected and on output is the size of the data being retrieved. In all current cases these will hold the same size. In general, this approach allows some sanity checking on the size of the info data buffer passed.
kQTGetMIMETypeInfoIsQuickTimeMovieType = 'moov',// info is a pointer to a Boolean
kQTGetMIMETypeInfoIsUnhelpfulType = 'dumb'// info is a pointer to a BooleanWhat's New in QuickTime 5
| Previous | Chapter Contents | Chapter Top | Next |