Retired Document
Important: This document may not represent best practices for current development. Links to downloads and other resources may no longer be valid.
Using Image Transcoder Components
QuickTime’s image transcoding support is part of the Image Compression Manager API. The Image Compression Manager uses an image sequence when compressing or decompressing data. An image sequence allows QuickTime to make certain optimizations because it knows that a similar operation will be repeated multiple times (that is, images will be repeatedly compressed to the same image data format).
A transcoder translates image data from one compressed format to another. This is done automatically, if an appropriate transcoder component is available, when QuickTime plays a movie that has been compressed in a format for which there is no decompressor on the playback machine. Transcoder components can also be used when an application provides an export function that saves data in a compressed format different from the compressed format of the source data.
Transcoding has two distinct advantages over the decompress-then-recompress approach to converting the format of compressed data. The first advantage is that the operation is usually substantially faster, since much of the data can be copied directly from the source image data format to the destination image data format. The second advantage is that the operation is usually more accurate because decompressing and recompressing provides two steps for introducing rounding and quantization errors. By directly transcoding, opportunities for small errors are substantially reduced.
QuickTime’s image transcoding support is part of the Image Compression Manager API. Image transcoding can be invoked either explicitly, using transcoder-specific Image Compression Manager functions such as the ImageTranscoderBeginSequence
function, or implicitly, using standard routines for decompressing images that in turn may use a transcoder when needed.
As with most other services in QuickTime, the details of image transcoding are handled by components. The Image Compression Manager uses image transcoder components to perform both implicit and explicit image transcoding. Application developers that perform image transcoding interact with the Image Compression Manager, not directly with the image transcoder components themselves. The Image Compression Manager takes care of the details of working with image transcoder components.
If you want to add new image transcoding capabilities to QuickTime, you can write an image transcoder component, as described in Creating Image Transcoder Components.
Invoking an Image Transcoding Process
Image transcoding can be invoked either explicitly, using transcoder-specific Image Compression Manager functions such as the ImageTranscoderBeginSequence
function, or implicitly, using standard routines for decompressing images that in turn may use a transcoder when needed.
If a request is issued to decompress an image, but no image decompressor component is installed for that image format, QuickTime attempts to locate an image transcoder to convert the image data into a supported format. This automatic image transcoding is supported for both QuickTime movies and compressed image data. Implicit use of transcoders is transparent to the applications programmer and requires no special coding. For more information about decompressing images, see The Image Compression Manager.
QuickTime also provides a set of functions that applications can use explicitly to transcode images. These functions make it possible for any application to take compressed image data and transcode it into another format. For example, some applications create QuickTime movies by combining segments of other QuickTime movies that may be compressed in various formats. These applications often export the compressed image data by decompressing the images and then recompressing them to a common format. You can often use image transcoders to increase the speed and fidelity of these operations.
Transcoding Paths
The Image Compression Manager’s support for image transcoding is based on an image transcoding sequence. The Image Compression Manager supports two paths for transcoding:
ImageTranscodeSequenceBegin
,ImageTranscodeFrame
,ImageTranscodeDisposeFrameData
,ImageTranscodeSequenceEnd
ImageTranscoderBeginSequence
,ImageTranscoderConvert
,ImageTranscoderDisposeData
,ImageTranscoderEndSequence
Use path #1 (the ...codeSequenceBegin
series) if you want QuickTime to find a transcoder component for you, opening it for you and closing it when the sequence is complete. This is the simplest path.
Use path #2 (the ...coderBeginSequence
series) if you want to use a particular transcoder component, or if you already have a transcoder component open and want to reuse it. One reason for doing this is if you are transcoding data with more than one image description (for example, the height or width of the source data changes at some point). This path is more efficient for multiple transcoding sequences, but requires you to find, open, and close the transcoder component yourself.
In either case, you begin by initiating a sequence and specifying the source and destination buffers and the source image description. You then make a series of calls to convert images, disposing of the transcoded data when you are done with it. Finally, you end the sequence, allowing QuickTime to release the resources associated with it.
If you are using path #2, you must find and open a transcoder component before beginning the first transcoding sequence, and close the component after you have completed the last transcoding sequence. Image transcoder components have component type 'imtc'
. The subtype and manufacturer fields specify the input and output data compression formats. For example, a transcoder that converts Motion JPEG to PICT would have type 'imtc'
, subtype 'mjpg'
, manufacturer code 'pict'
.
Here is a list of the image transcoder functions:
Transcode sequence functions (QuickTime opens and closes component)
ImageTranscoderBeginSequence
initiates an image transcoding sequence and specifies the input data format.ImageTranscoderConvert
performs image transcoding operations.ImageTranscoderDisposeData
disposes of transcoded data.ImageTranscoderEndSequence
ends an image transcoding sequence.
Transcoder component sequence functions (your application opens and closes component)
ImageTranscodeSequenceBegin
initiates an image transcoder sequence operation.ImageTranscodeFrame
transcodes a frame of image data.ImageTranscodeDisposeFrameData
disposes transcoded image data.ImageTranscodeSequenceEnd
ends an image transcoder sequence operation.
For further information about these functions, see the QuickTime API Reference.
Copyright © 2005, 2006 Apple Computer, Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2006-01-10