CMAudioFormatDescriptionCreate(allocator:asbd:layoutSize:layout:magicCookieSize:magicCookie:extensions:formatDescriptionOut:)
Creates a format description for an audio media stream.
Declaration
func CMAudioFormatDescriptionCreate(allocator: CFAllocator?, asbd: UnsafePointer<AudioStreamBasicDescription>, layoutSize: Int, layout: UnsafePointer<AudioChannelLayout>?, magicCookieSize: Int, magicCookie: UnsafeRawPointer?, extensions: CFDictionary?, formatDescriptionOut: UnsafeMutablePointer<CMAudioFormatDescription?>) -> OSStatusParameters
- allocator:
CFAllocatorto be used. PasskCFAllocatorDefaultorNULLto use the default allocator. - asbd:
Audio format description (see
CoreAudioTypes.h). This information is required. - layoutSize:
Size, in bytes, of audio channel layout. 0 if layout is
NULL. - layout:
Audio channel layout (see CoreAudioTypes.h). Can be
NULL. - magicCookieSize:
Size, in bytes, of magic cookie. 0 if
magicCookieisNULL. - magicCookie:
Magic cookie. This information is required for some formats, and must be
NULLfor all others. - extensions:
Dictionary of extension key/value pairs. Keys are always
CFStrings. Values are always property list objects (ie.CFData,CFString,CFArray,CFDictionary,CFDate,CFBoolean, orCFNumber). Can beNULL. - formatDescriptionOut:
On output, returns the newly created audio
CMFormatDescription.
Return Value
A result code.
Discussion
The absd is required, the channel layout is optional, and the magic cookie is required for some compression formats (and must be NULL for all others). The caller owns the returned CMFormatDescription, and must release it when done with it. The ASBD, magic cookie, channel layout, and extensions are all copied (the extensions are deep-copied). The caller can deallocate them or re-use them after making this call.
See Also
Working with Audio Descriptions
CMSoundDescriptionFlavorCMAudioFormatDescriptionCreateSummary(allocator:formatDescriptionArray:flags:formatDescriptionOut:)CMAudioFormatDescriptionEqual(_:otherFormatDescription:equalityMask:equalityMaskOut:)CMAudioFormatDescriptionGetChannelLayout(_:sizeOut:)CMAudioFormatDescriptionGetFormatList(_:sizeOut:)CMAudioFormatDescriptionGetMagicCookie(_:sizeOut:)CMAudioFormatDescriptionGetMostCompatibleFormat(_:)CMAudioFormatDescriptionGetRichestDecodableFormat(_:)CMAudioFormatDescriptionGetStreamBasicDescription(_:)CMDoesBigEndianSoundDescriptionRequireLegacyCBRSampleTableLayout(_:flavor:)CMSwapBigEndianSoundDescriptionToHost(_:_:)CMSwapHostEndianSoundDescriptionToBig(_:_:)CMAudioFormatDescriptionCreateFromBigEndianSoundDescriptionData(allocator:bigEndianSoundDescriptionData:size:flavor:formatDescriptionOut:)CMAudioFormatDescriptionCreateFromBigEndianSoundDescriptionBlockBuffer(allocator:bigEndianSoundDescriptionBlockBuffer:flavor:formatDescriptionOut:)CMAudioFormatDescriptionCopyAsBigEndianSoundDescriptionBlockBuffer(allocator:audioFormatDescription:flavor:blockBufferOut:)