Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

< Previous PageNext Page > Hide TOC

Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Preferred Codec APIs

QuickTime has added two new APIs that help applications specify the codec or effects components that they prefer to use when playing a movie. This supplements the normal behavior of relying on performance and compatibility as the criteria for choosing the codecs to be used.

Applications can use these APIs to access components that all work together as a set (for example, decompressors and effects all working on the same hardware).

Third-party codec providers no longer need to use decompression speed as the only way to have their codecs used in preference –– the application is now able to specify the ones it prefers. Note that applications that don’t use these APIs will continue to rely on the normal behavior of the ICM.

MediaSetUserPreferredCodecs

Requests that a media handler favor specified codec components when selecting components with which to play media.

pascal ComponentResult MediaSetUserPreferredCodecs( MediaHandler mh,  CodecComponentHandle userPreferredCodecs );

Parameters
mh

Specifies your connection to the media handler component. You can call the Movie Toolbox routine GetMediaHandler to obtain a connection to the media handler component for a track's media.

userPreferredCodecs

A handle containing component identifiers. The media handler component will make its own copy of this handle. Pass nil to invalidate the standing request without substituting another.

Discussion

This method does not guarantee that the specified components will be used; other factors may take precedence. Components that are preferred may not be used if they can’t be part of the chain required to play the media (for example, don’t handle the pixel format, or the video output, and so on).

The components should be specified in order from most preferred to least preferred.

Errors:

Example:

CodecComponentHandle userPreferredCodecs = nil;
ComponentDescription cd = { decompressorComponentType,
                            myPreferredCodecType,
                            myPreferredCodecManufacturer,
                            0, 0 };
CodecComponent      c = FindNextComponent( 0, &cd );
MediaHandler        myMedia;
OSErr               err;
 
PtrToHand( &c, (Handle*)&userPreferredCodecs, sizeof(c) );
 
myMedia = GetMediaHandler( GetTrackMedia( track ) );
 
err = MediaSetUserPreferredCodecs( myMedia, userPreferredCodecs );
DisposeHandle( (Handle)userPreferredCodecs );
Availability
Declared In
MediaHandlers.h

MediaGetUserPreferredCodecs

Retrieves the list of components last passed to the media handler with MediaSetUserPreferredCodecs.

pascal ComponentResult MediaGetUserPreferredCodecs( MediaHandler mh,  CodecComponentHandle *userPreferredCodecs );

Parameters
mh

Specifies your connection to the media handler component. You can call the Movie Toolbox routine GetMediaHandler to obtain a connection to the media handler component for a track's media.

userPreferredCodecs

Points to a variable of type CodecComponentHandle. If the media handler currently has a preferred component list, it will copy that list into a new handle and store the new handle in this variable. The caller must dispose this handle. If the media handler does not currently have a preferred component list, it will store nil in this variable.

Discussion

Errors:

Availability
Declared In
MediaHandlers.h

< Previous PageNext Page > Hide TOC


Last updated: 2001-10-01




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.
Get information on Apple products.
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Copyright © 2007 Apple Inc.
All rights reserved. | Terms of use | Privacy Notice