What's New in QuickTime 5

| Previous | Chapter Contents | Chapter Top | Next |

Taking Advantage of Asynchronous MP Codecs in Your Application

QuickTime will automatically call a codec asynchronously when you're playing a movie. If your application calls the Image Compression Manager directly to perform compression or decompression operations, you can pass a completion routine to CompressSequenceFrame or DecompressSequenceFrame/S/When to enable asynchronous operation. (If the codec does not support asynchronous operation, the API will run synchronously but call your completion routine before returning.)

If your application calls the Standard Compression component to perform image compression, you'll need to call a new API variant, SCCompressSequenceFrameAsync , which is new with QuickTime 5 and supports completion routines. While this is running, you should occasionally call SCAsyncIdle from system task time.

Note that the H.263 compressor has been modified to run asynchronously if requested.

SCCompressSequenceFrame (available in previous versions of QuickTime)

This function compresses a single frame in a sequence-compression operation. You must call this function once for each frame in the sequence, including the first frame.

pascal ComponentResult SCCompressSequenceFrame (ComponentInstance ci,
                                                PixMapHandle src,
                                             const Rect *srcRect,
                                                Handle *data,
                                            long *dataSize, short
                                                *notSyncFlag);

SCCompressSequenceFrameAsync

This is an asynchronous variant of SCCompressSequenceFrame which accepts a completion routine.

SCCompressSequenceFrameAsync (ComponentInstance ci,
                                PixMapHandle src,
                                const Rect * srcRect, Handle
                                * data, long * dataSize, short
                                * notSyncFlag,              
                                ICMCompletionProcRecordPtr
                                asyncCompletionProc);

If you pass a nil completion routine, this routine behaves like SCCompressSequenceFrame .

While performing asynchronous compression with SCCompressSequenceFrameAsync , you should occasionally call SCAsyncIdle . This gives the standard compression component an opportunity to restart its compression operation if it needs to force a key frame.

SCAsyncIdle

SCAsyncIdle (ComponentInstance ci);

© 2001 Apple Computer, Inc.

What's New in QuickTime 5

| Previous | Chapter Contents | Chapter Top | Next |