Retired Document
Important: This document may not represent best practices for current development. Links to downloads and other resources may no longer be valid.
Compression Sessions - Configuring options using the Standard Compression dialog
Q: Is there an easier way to configure Compression Session options or does each option have to be set by hand?
A: Yes there is an easier way by using the UI provided by Standard Compression.
The Standard compression dialog component provides applications with a high level consistent user interface for specifying the parameters that control compression operations, and allows for easy configuration of a Compression Session options object. Figure 1 shows what this dialog looks like when configuring the H.264 codec.

Listing 1 demonstrates one way to use the Standard Compression component to retrieve Compression Session options.
Once the Standard Compression dialog has been dismissed, call SCCopyCompressionSessionOptions
to retrieve the fully configured ICMCompressionSessionOptionsRef
which can be passed to ICMCompressionSessionCreate
.
The newly created Compression Session will retain this options object. Call ICMCompressionSessionOptionsRelease
once the Compression Session is created if your application will not be modifying any compression options during the compression operation.
Listing 1 Using Standard Compression to configure Compression Session options.
ICMCompressionSessionOptionsRef GrabCSessionOptionsFromStdCompression() |
{ |
ComponentInstance stdCompression = 0; |
long scPreferences; |
ICMCompressionSessionOptionsRef sessionOptionsRef = NULL; |
ComponentResult err; |
// open the standard compression component |
err = OpenADefaultComponent(StandardCompressionType, StandardCompressionSubType, &stdCompression); |
if (err || 0 == stdCompression) goto bail; |
// Indicates the client is ready to use the ICM compression session API to perform compression operations |
// StdCompression will disable frame reordering and multi pass encoding if this flag not set because the |
// older sequence APIs do not support these capabilities |
scPreferences = scAllowEncodingWithCompressionSession; |
// set the preferences we want |
err = SCSetInfo(stdCompression, scPreferenceFlagsType, &scPreferences); |
if (err) goto bail; |
// display the standard compression dialog box |
err = SCRequestSequenceSettings(stdCompression); |
if (err) goto bail; |
// creates a compression session options object based on configured settings |
err = SCCopyCompressionSessionOptions(stdCompression, &sessionOptionsRef); |
bail: |
if (0 != stdCompression) CloseComponent(stdCompression); |
return sessionOptionsRef; |
} |
References:
Document Revision History
Date | Notes |
---|---|
2006-01-12 | New document that discusses how to configure Compression Session options using Standard Compression dialog. |
Copyright © 2006 Apple Computer, Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2006-01-12