---
title: "CMAudioFormatDescriptionGetMagicCookie(_:sizeOut:)"
framework: coremedia
role: symbol
role_heading: Function
path: "coremedia/cmaudioformatdescriptiongetmagiccookie(_:sizeout:)"
---

# CMAudioFormatDescriptionGetMagicCookie(_:sizeOut:)

Returns a read-only pointer to, and size of, the magic cookie in an audio format description.

## Declaration

```swift
func CMAudioFormatDescriptionGetMagicCookie(_ desc: CMAudioFormatDescription, sizeOut: UnsafeMutablePointer<Int>?) -> UnsafeRawPointer?
```

## Parameters

- `desc`: CMFormatDescription being interrogated.
- `sizeOut`: Pointer to variable that will be written with the size of the cookie. Can be NULL.

## Return Value

Return Value A read-only pointer to the magic cookie inside the audio format description.

## Discussion

Discussion The magic cookie is a completely opaque piece of data, written and read only by the codec itself. A magic cookie is only present for codecs that require it;  this API will return NULL if one does not exist. This API is specific to audio format descriptions, and will return NULL if called with a non-audio format description.

## See Also

### Working with Audio Descriptions

- [CMSoundDescriptionFlavor](coremedia/cmsounddescriptionflavor.md)
- [CMAudioFormatDescriptionCreateSummary(allocator:formatDescriptionArray:flags:formatDescriptionOut:)](coremedia/cmaudioformatdescriptioncreatesummary(allocator:formatdescriptionarray:flags:formatdescriptionout:).md)
- [CMAudioFormatDescriptionCreate(allocator:asbd:layoutSize:layout:magicCookieSize:magicCookie:extensions:formatDescriptionOut:)](coremedia/cmaudioformatdescriptioncreate(allocator:asbd:layoutsize:layout:magiccookiesize:magiccookie:extensions:formatdescriptionout:).md)
- [CMAudioFormatDescriptionEqual(_:otherFormatDescription:equalityMask:equalityMaskOut:)](coremedia/cmaudioformatdescriptionequal(_:otherformatdescription:equalitymask:equalitymaskout:).md)
- [CMAudioFormatDescriptionGetChannelLayout(_:sizeOut:)](coremedia/cmaudioformatdescriptiongetchannellayout(_:sizeout:).md)
- [CMAudioFormatDescriptionGetFormatList(_:sizeOut:)](coremedia/cmaudioformatdescriptiongetformatlist(_:sizeout:).md)
- [CMAudioFormatDescriptionGetMostCompatibleFormat(_:)](coremedia/cmaudioformatdescriptiongetmostcompatibleformat(_:).md)
- [CMAudioFormatDescriptionGetRichestDecodableFormat(_:)](coremedia/cmaudioformatdescriptiongetrichestdecodableformat(_:).md)
- [CMAudioFormatDescriptionGetStreamBasicDescription(_:)](coremedia/cmaudioformatdescriptiongetstreambasicdescription(_:).md)
- [CMDoesBigEndianSoundDescriptionRequireLegacyCBRSampleTableLayout(_:flavor:)](coremedia/cmdoesbigendiansounddescriptionrequirelegacycbrsampletablelayout(_:flavor:).md)
- [CMSwapBigEndianSoundDescriptionToHost(_:_:)](coremedia/cmswapbigendiansounddescriptiontohost(_:_:).md)
- [CMSwapHostEndianSoundDescriptionToBig(_:_:)](coremedia/cmswaphostendiansounddescriptiontobig(_:_:).md)
- [CMAudioFormatDescriptionCreateFromBigEndianSoundDescriptionData(allocator:bigEndianSoundDescriptionData:size:flavor:formatDescriptionOut:)](coremedia/cmaudioformatdescriptioncreatefrombigendiansounddescriptiondata(allocator:bigendiansounddescriptiondata:size:flavor:formatdescriptionout:).md)
- [CMAudioFormatDescriptionCreateFromBigEndianSoundDescriptionBlockBuffer(allocator:bigEndianSoundDescriptionBlockBuffer:flavor:formatDescriptionOut:)](coremedia/cmaudioformatdescriptioncreatefrombigendiansounddescriptionblockbuffer(allocator:bigendiansounddescriptionblockbuffer:flavor:formatdescriptionout:).md)
- [CMAudioFormatDescriptionCopyAsBigEndianSoundDescriptionBlockBuffer(allocator:audioFormatDescription:flavor:blockBufferOut:)](coremedia/cmaudioformatdescriptioncopyasbigendiansounddescriptionblockbuffer(allocator:audioformatdescription:flavor:blockbufferout:).md)
