Contents

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?>) -> OSStatus

Parameters

  • allocator:

    CFAllocator to be used. Pass kCFAllocatorDefault or NULL to 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 magicCookie is NULL.

  • magicCookie:

    Magic cookie. This information is required for some formats, and must be NULL for 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, or CFNumber). Can be NULL.

  • 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