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(CFAllocator?, CMMediaType, FourCharCode, CFDictionary?, UnsafeMutablePointer<CMFormatDescription?>)

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 CMFormatDescriptionEqual(CMFormatDescription?, CMFormatDescription?)

Compares two CMFormatDescription objects for equality.

func CMFormatDescriptionEqualIgnoringExtensionKeys(CMFormatDescription?, CMFormatDescription?, CFTypeRef?, CFTypeRef?)

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

func CMFormatDescriptionGetExtension(CMFormatDescription, CFString)

Returns the specified extension of a CMFormatDescription.

func CMFormatDescriptionGetExtensions(CMFormatDescription)

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

func CMFormatDescriptionGetMediaSubType(CMFormatDescription)

Returns the media subtype of a CMFormatDescription.

func CMFormatDescriptionGetMediaType(CMFormatDescription)

Returns the media type of a CMFormatDescription.

func CMFormatDescriptionGetTypeID()

Returns the CFTypeID of CMFormatDescription objects.

Audio-Specific Functions

func CMAudioFormatDescriptionCreateSummary(CFAllocator?, CFArray, UInt32, UnsafeMutablePointer<CMAudioFormatDescription?>)

Creates a summary audio format description from an array of audio format descriptions.

func CMAudioFormatDescriptionGetChannelLayout(CMAudioFormatDescription, UnsafeMutablePointer<Int>?)

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

func CMAudioFormatDescriptionGetFormatList(CMAudioFormatDescription, UnsafeMutablePointer<Int>?)

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

func CMAudioFormatDescriptionGetMagicCookie(CMAudioFormatDescription, UnsafeMutablePointer<Int>?)

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

func CMAudioFormatDescriptionGetMostCompatibleFormat(CMAudioFormatDescription)

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

func CMAudioFormatDescriptionGetRichestDecodableFormat(CMAudioFormatDescription)

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

func CMAudioFormatDescriptionGetStreamBasicDescription(CMAudioFormatDescription)

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

func CMDoesBigEndianSoundDescriptionRequireLegacyCBRSampleTableLayout(CMBlockBuffer, CFString?)

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)

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

func CMSwapHostEndianSoundDescriptionToBig(UnsafeMutablePointer<UInt8>, Int)

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

Video-Specific Functions

func CMVideoFormatDescriptionCreateForImageBuffer(CFAllocator?, CVImageBuffer, UnsafeMutablePointer<CMVideoFormatDescription?>)

Creates a format description for a video media stream contained in CVImageBuffers of the type provided.

func CMVideoFormatDescriptionGetDimensions(CMVideoFormatDescription)

Returns the video dimensions (in encoded pixels).

func CMVideoFormatDescriptionGetExtensionKeysCommonWithImageBuffers()

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

func CMVideoFormatDescriptionGetPresentationDimensions(CMVideoFormatDescription, Bool, Bool)

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

func CMVideoFormatDescriptionMatchesImageBuffer(CMVideoFormatDescription, CVImageBuffer)

Checks to see if a given format description matches an image buffer.

func CMSwapBigEndianImageDescriptionToHost(UnsafeMutablePointer<UInt8>, Int)

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

func CMSwapHostEndianImageDescriptionToBig(UnsafeMutablePointer<UInt8>, Int)

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

Metadata-Specific Functions

func CMMetadataFormatDescriptionGetKeyWithLocalID(CMMetadataFormatDescription, OSType)

Returns the key associated with the metadata for the given local id.

func CMSwapBigEndianMetadataDescriptionToHost(UnsafeMutablePointer<UInt8>, Int)

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

func CMSwapHostEndianMetadataDescriptionToBig(UnsafeMutablePointer<UInt8>, Int)

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

func CMMetadataFormatDescriptionGetIdentifiers(CMMetadataFormatDescription)

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

Text-Specific Functions

func CMSwapBigEndianTextDescriptionToHost(UnsafeMutablePointer<UInt8>, Int)

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

func CMSwapHostEndianTextDescriptionToBig(UnsafeMutablePointer<UInt8>, Int)

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

TimeCode-Specific Functions

func CMTimeCodeFormatDescriptionGetFrameQuanta(CMTimeCodeFormatDescription)

Returns the frames/sec for timecode (e.g. 30) OR frames/tick for counter mode.

func CMTimeCodeFormatDescriptionGetTimeCodeFlags(CMTimeCodeFormatDescription)

Returns the flags for kCMTimeCodeFlag_DropFrame, kCMTimeCodeFlag_24HourMax, kCMTimeCodeFlag_NegTimesOK

func CMSwapBigEndianTimeCodeDescriptionToHost(UnsafeMutablePointer<UInt8>, Int)

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

func CMSwapHostEndianTimeCodeDescriptionToBig(UnsafeMutablePointer<UInt8>, Int)

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

Closed Captioning-Functions

func CMSwapHostEndianClosedCaptionDescriptionToBig(UnsafeMutablePointer<UInt8>, Int)

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

func CMSwapBigEndianClosedCaptionDescriptionToHost(UnsafeMutablePointer<UInt8>, Int)

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.

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.