---
title: "CMSampleBufferSetDataBufferFromAudioBufferList(_:blockBufferAllocator:blockBufferMemoryAllocator:flags:bufferList:)"
framework: coremedia
role: symbol
role_heading: Function
path: "coremedia/cmsamplebuffersetdatabufferfromaudiobufferlist(_:blockbufferallocator:blockbuffermemoryallocator:flags:bufferlist:)"
---

# CMSampleBufferSetDataBufferFromAudioBufferList(_:blockBufferAllocator:blockBufferMemoryAllocator:flags:bufferList:)

Creates a block buffer that contains a copy of the data from an audio buffer list.

## Declaration

```swift
func CMSampleBufferSetDataBufferFromAudioBufferList(_ sbuf: CMSampleBuffer, blockBufferAllocator blockBufferStructureAllocator: CFAllocator?, blockBufferMemoryAllocator blockBufferBlockAllocator: CFAllocator?, flags: UInt32, bufferList: UnsafePointer<AudioBufferList>) -> OSStatus
```

## Parameters

- `sbuf`: The CMSampleBuffer being modified.
- `blockBufferStructureAllocator`: Allocator to use when creating the CMBlockBuffer structure.
- `blockBufferBlockAllocator`: Allocator to use for memory block held by the CMBlockBuffer.
- `flags`: Flags controlling operation.
- `bufferList`: Buffer list whose data will be copied into the new CMBlockBuffer.

## Return Value

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

## Discussion

Discussion Creates a CMBlockBuffer containing a copy of the data from the AudioBufferList, and sets that as the sample buffer’s data buffer. The resulting buffer(s) in the sample buffer will be 16-byte-aligned if kCMSampleBufferFlag_AudioBufferList_Assure16ByteAlignment is passed in.

## 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)
- [CMSampleBufferCopyPCMDataIntoAudioBufferList(_:at:frameCount:into:)](coremedia/cmsamplebuffercopypcmdataintoaudiobufferlist(_:at:framecount:into:).md)
- [CMSampleBufferGetAudioStreamPacketDescriptions(_:allocatedSize:packetDescriptionsOut:packetDescriptionsSizeNeededOut:)](coremedia/cmsamplebuffergetaudiostreampacketdescriptions(_:allocatedsize:packetdescriptionsout:packetdescriptionssizeneededout:).md)
- [CMSampleBufferGetAudioStreamPacketDescriptionsPtr(_:packetDescriptionsPointerOut:sizeOut:)](coremedia/cmsamplebuffergetaudiostreampacketdescriptionsptr(_:packetdescriptionspointerout:sizeout:).md)
