CMFormatDescription

A media format descriptor that describes the samples in a sample buffer.

Overview

CMFormatDescriptions are immutable Core Foundation objects that describe media data of various types, including audio, video, and muxed media data. There are two types of API: media-type-agnostic APIs (supported by all CMFormatDescriptions) and media-type-specific APIs. The media-type-agnostic APIs are prefixed with CMFormatDescription, and the media-type-specific APIs are prefixed with CMAudioFormatDescription, CMVideoFormatDescription, and so on.

Topics

Common Functions

func CMFormatDescriptionCreate(allocator: CFAllocator?, mediaType: CMMediaType, mediaSubType: FourCharCode, extensions: CFDictionary?, formatDescriptionOut: UnsafeMutablePointer<CMFormatDescription?>) -> OSStatus

Creates a generic CMFormatDescription object. You should not call this method for the media types that has specific create functions such as audio, video, text, muxed, metaData and timeCode.

func CMFormatDescriptionEqualIgnoringExtensionKeys(CMFormatDescription?, otherFormatDescription: CMFormatDescription?, extensionKeysToIgnore: CFTypeRef?, sampleDescriptionExtensionAtomKeysToIgnore: CFTypeRef?) -> Bool

Compares two CMFormatDescription objects for equality, ignoring differences in the specified lists of format description extension keys and sample description extension keys.

func CMFormatDescriptionGetExtensions(CMFormatDescription) -> CFDictionary?

Returns an immutable dictionary containing all the extensions of a CMFormatDescription.

func CMFormatDescriptionGetMediaSubType(CMFormatDescription) -> FourCharCode

Returns the media subtype of a CMFormatDescription.

func CMFormatDescriptionGetMediaType(CMFormatDescription) -> CMMediaType

Returns the media type of a CMFormatDescription.

func CMFormatDescriptionGetTypeID() -> CFTypeID

Returns the CFTypeID of CMFormatDescription objects.

Audio-Specific Functions

func CMAudioFormatDescriptionGetChannelLayout(CMAudioFormatDescription, sizeOut: UnsafeMutablePointer<Int>?) -> UnsafePointer<AudioChannelLayout>?

Returns a read-only pointer to (and size of) the AudioChannelLayout inside an audio CMFormatDescription.

func CMAudioFormatDescriptionGetFormatList(CMAudioFormatDescription, sizeOut: UnsafeMutablePointer<Int>?) -> UnsafePointer<AudioFormatListItem>?

Returns a read-only pointer to (and size of) the array of AudioFormatListItem structs inside an audio CMFormatDescription.

func CMAudioFormatDescriptionGetMagicCookie(CMAudioFormatDescription, sizeOut: UnsafeMutablePointer<Int>?) -> UnsafeRawPointer?

Returns a read-only pointer to (and size of) the magic cookie inside an audio CMFormatDescription.

func CMAudioFormatDescriptionGetMostCompatibleFormat(CMAudioFormatDescription) -> UnsafePointer<AudioFormatListItem>?

Returns a read-only pointer to the appropriate AudioFormatListItem inside an audio CMFormatDescription.

func CMAudioFormatDescriptionGetRichestDecodableFormat(CMAudioFormatDescription) -> UnsafePointer<AudioFormatListItem>?

Returns a read-only pointer to the appropriate AudioFormatListItem inside an audio CMFormatDescription.

func CMAudioFormatDescriptionGetStreamBasicDescription(CMAudioFormatDescription) -> UnsafePointer<AudioStreamBasicDescription>?

Returns a read-only pointer to the AudioStreamBasicDescription inside an audio CMFormatDescription.

func CMDoesBigEndianSoundDescriptionRequireLegacyCBRSampleTableLayout(CMBlockBuffer, flavor: CMSoundDescriptionFlavor?) -> Bool

Examine a big-endian SoundDescription data structure in a CMBlockBuffer, and report whether the sample tables will need to use the legacy CBR layout.

func CMSwapBigEndianSoundDescriptionToHost(UnsafeMutablePointer<UInt8>, Int) -> OSStatus

Converts a SoundDescription data structure from big-endian to host-endian in place.

func CMSwapHostEndianSoundDescriptionToBig(UnsafeMutablePointer<UInt8>, Int) -> OSStatus

Converts a SoundDescription data structure from host-endian to big-endian in place.

Video-Specific Functions

func CMVideoFormatDescriptionGetExtensionKeysCommonWithImageBuffers() -> CFArray

Returns an array of the keys that are used both as CMVideoFormatDescription extensions and CVImageBuffer attachments and attributes.

func CMVideoFormatDescriptionGetPresentationDimensions(CMVideoFormatDescription, usePixelAspectRatio: Bool, useCleanAperture: Bool) -> CGSize

Returns the dimensions, adjusted to take pixel aspect ratio and/or clean aperture into account.

func CMSwapBigEndianImageDescriptionToHost(UnsafeMutablePointer<UInt8>, Int) -> OSStatus

Converts an ImageDescription data structure from big-endian to host-endian in place.

func CMSwapHostEndianImageDescriptionToBig(UnsafeMutablePointer<UInt8>, Int) -> OSStatus

Converts an ImageDescription data structure from host-endian to big-endian in place.

Metadata-Specific Functions

func CMSwapBigEndianMetadataDescriptionToHost(UnsafeMutablePointer<UInt8>, Int) -> OSStatus

Converts a MetadataDescription data structure from big-endian to host-endian in place.

func CMSwapHostEndianMetadataDescriptionToBig(UnsafeMutablePointer<UInt8>, Int) -> OSStatus

Converts a MetadataDescription data structure from host-endian to big-endian in place.

func CMMetadataFormatDescriptionGetIdentifiers(CMMetadataFormatDescription) -> CFArray?

Gets an array of metadata identifiers from a metadata format description.

Text-Specific Functions

func CMSwapBigEndianTextDescriptionToHost(UnsafeMutablePointer<UInt8>, Int) -> OSStatus

Converts a TextDescription data structure from big-endian to host-endian in place.

func CMSwapHostEndianTextDescriptionToBig(UnsafeMutablePointer<UInt8>, Int) -> OSStatus

Converts a TextDescription data structure from host-endian to big-endian in place.

TimeCode-Specific Functions

func CMTimeCodeFormatDescriptionGetFrameDuration(CMTimeCodeFormatDescription) -> CMTime

Returns the duration of each frame (for example 100/2997).

func CMTimeCodeFormatDescriptionGetFrameQuanta(CMTimeCodeFormatDescription) -> UInt32

Returns the frames/sec for timecode (for example, 30) or frames/tick for counter mode.

func CMTimeCodeFormatDescriptionGetTimeCodeFlags(CMTimeCodeFormatDescription) -> UInt32

Returns the flags for kCMTimeCodeFlag_DropFrame, kCMTimeCodeFlag_24HourMax, kCMTimeCodeFlag_NegTimesOK

func CMSwapBigEndianTimeCodeDescriptionToHost(UnsafeMutablePointer<UInt8>, Int) -> OSStatus

Converts a TimeCodeDescription data structure from big-endian to host-endian in place.

func CMSwapHostEndianTimeCodeDescriptionToBig(UnsafeMutablePointer<UInt8>, Int) -> OSStatus

Converts a TimeCodeDescription data structure from host-endian to big-endian in place.

Closed Captioning-Functions

func CMSwapHostEndianClosedCaptionDescriptionToBig(UnsafeMutablePointer<UInt8>, Int) -> OSStatus

Converts a ClosedCaptionDescription data structure from host-endian to big-endian in place.

func CMSwapBigEndianClosedCaptionDescriptionToHost(UnsafeMutablePointer<UInt8>, Int) -> OSStatus

Converts a ClosedCaptionDescription data structure from big-endian to host-endian in place.

Format Description Types

class CMFormatDescription

A reference to a CMFormatDescription object.

typealias CMAudioFormatDescription

A synonym type used for manipulating audio CMFormatDescriptions.

typealias CMClosedCaptionFormatDescription

A synonym type used for manipulating closed-caption media CMFormatDescriptions.

typealias CMMetadataFormatDescription

A synonym type used for manipulating metadata CMFormatDescriptions.

typealias CMMuxedFormatDescription

A synonym type used for manipulating muxed media CMFormatDescriptions.

typealias CMTimeCodeFormatDescription

A synonym type used for manipulating TimeCode CMFormatDescriptions.

typealias CMVideoFormatDescription

A synonym type used for manipulating video CMFormatDescriptions.

Data Types

typealias CMAudioFormatDescription

A synonym type used for manipulating audio CMFormatDescriptions.

typealias CMAudioFormatDescriptionMask

A type for mask bits passed to (and returned from) CMFormatDescription, representing various parts of an audio format description.

struct CMVideoDimensions

Type used for video dimensions.

typealias CMMediaType

The type of media described by a CMFormatDescription.

typealias CMTimeCodeFormatType

The types of time Code.

typealias CMTextFormatType

Text media format/subtype.

typealias CMAudioCodecType

Codes to identify audio codecs.

typealias CMClosedCaptionFormatType

Four-character codes identifying closed-caption media format types.

typealias CMPixelFormatType

Four-character codes identifying pixel formats.

typealias CMVideoCodecType

Four-character codes identifying the video codec.

typealias CMMetadataFormatType

The types of TimedMetadata.

typealias CMTextDisplayFlags

Display mode flags for text media.

typealias CMTextJustificationValue

Justification modes for text media.

Constants

CMTextFormatDescription Constants

These keys and values are used by text-based format descriptions.

Error Codes

OSStatus errors returned by CMFormatDescription APIs.

MPEG-2-conformant Formats

Constants to access MPEG-2 attributes.

Video Profile Constants

Constants for video profiles. For more information on HDV, see HDV documentation.

Field Detail Extension Constants

Supported values for the Field Detail Extension (kCMFormatDescriptionExtension_FieldDetail).

Clean Aperture Extension Constants

Values supported for kCMFormatDescriptionKey_CleanApertureHeight

See Also

Sample Processing

CMSampleBuffer

An object containing zero or more media samples of a uniform media type.

CMBlockBuffer

An object used to move blocks of memory through a processing system.

CMAttachment

An API for attaching additional metadata to a sample buffer.