---
title: "CMSampleBufferGetAudioStreamPacketDescriptionsPtr(_:packetDescriptionsPointerOut:sizeOut:)"
framework: coremedia
role: symbol
role_heading: Function
path: "coremedia/cmsamplebuffergetaudiostreampacketdescriptionsptr(_:packetdescriptionspointerout:sizeout:)"
---

# CMSampleBufferGetAudioStreamPacketDescriptionsPtr(_:packetDescriptionsPointerOut:sizeOut:)

Returns a pointer to a constant array of audio stream packet descriptions.

## Declaration

```swift
func CMSampleBufferGetAudioStreamPacketDescriptionsPtr(_ sbuf: CMSampleBuffer, packetDescriptionsPointerOut: UnsafeMutablePointer<UnsafePointer<AudioStreamPacketDescription>?>?, sizeOut packetDescriptionsSizeOut: UnsafeMutablePointer<Int>?) -> OSStatus
```

## Parameters

- `sbuf`: The CMSampleBuffer being modified.
- `packetDescriptionsPointerOut`: On output, contains pointer to a constant array of AudioStreamPacketDescriptions. May be NULL.
- `packetDescriptionsSizeOut`: Size in bytes of constant array of AudioStreamPacketDescriptions. May be NULL.

## Return Value

Return Value A result code. See Sample Buffer Error Codes.

## Discussion

Discussion Returns a pointer to (and size of) a constant array of AudioStreamPacketDescriptions for the variable bytes per packet or variable frames per packet audio data in the provided CMSampleBuffer. The pointer will remain valid as long as the buffer continues to be retained. Constant bit rate, constant frames-per-packet audio yields a return value of noErr and no packet descriptions. This API is specific to audio format sample buffers, and will return kCMSampleBufferError_InvalidMediaTypeForOperation if called with a non-audio sample buffer.

## See Also

### Modifying Sample Buffers

- [CMSampleBufferGetDataBuffer(_:)](coremedia/cmsamplebuffergetdatabuffer(_:).md)
- [CMSampleBufferSetDataBuffer(_:newValue:)](coremedia/cmsamplebuffersetdatabuffer(_:newvalue:).md)
- [CMSampleBufferGetImageBuffer(_:)](coremedia/cmsamplebuffergetimagebuffer(_:).md)
- [CMSampleBufferGetAudioBufferListWithRetainedBlockBuffer(_:bufferListSizeNeededOut:bufferListOut:bufferListSize:blockBufferAllocator:blockBufferMemoryAllocator:flags:blockBufferOut:)](coremedia/cmsamplebuffergetaudiobufferlistwithretainedblockbuffer(_:bufferlistsizeneededout:bufferlistout:bufferlistsize:blockbufferallocator:blockbuffermemoryallocator:flags:blockbufferout:).md)
- [CMSampleBufferSetDataBufferFromAudioBufferList(_:blockBufferAllocator:blockBufferMemoryAllocator:flags:bufferList:)](coremedia/cmsamplebuffersetdatabufferfromaudiobufferlist(_:blockbufferallocator:blockbuffermemoryallocator:flags:bufferlist:).md)
- [CMSampleBufferCopyPCMDataIntoAudioBufferList(_:at:frameCount:into:)](coremedia/cmsamplebuffercopypcmdataintoaudiobufferlist(_:at:framecount:into:).md)
- [CMSampleBufferGetAudioStreamPacketDescriptions(_:allocatedSize:packetDescriptionsOut:packetDescriptionsSizeNeededOut:)](coremedia/cmsamplebuffergetaudiostreampacketdescriptions(_:allocatedsize:packetdescriptionsout:packetdescriptionssizeneededout:).md)
