CMSampleBufferGetAudioBufferListWithRetainedBlockBuffer(_:bufferListSizeNeededOut:bufferListOut:bufferListSize:blockBufferAllocator:blockBufferMemoryAllocator:flags:blockBufferOut:)
Returns an audio buffer list that contains the media data.
Declaration
func CMSampleBufferGetAudioBufferListWithRetainedBlockBuffer(_ sbuf: CMSampleBuffer, bufferListSizeNeededOut: UnsafeMutablePointer<Int>?, bufferListOut: UnsafeMutablePointer<AudioBufferList>?, bufferListSize: Int, blockBufferAllocator blockBufferStructureAllocator: CFAllocator?, blockBufferMemoryAllocator blockBufferBlockAllocator: CFAllocator?, flags: UInt32, blockBufferOut: UnsafeMutablePointer<CMBlockBuffer?>?) -> OSStatusParameters
- sbuf:
CMSampleBufferbeing accessed. - bufferListSizeNeededOut:
Receives the size of the AudioBufferList required to accommodate the data. May be
NULL. - bufferListOut:
Allocated by the caller, sized as specified by
bufferListSizeNeededOut. It’s filled in with pointers into the retainedblockBufferOut. May beNULL. - bufferListSize:
Size of the
bufferListOutallocated by the client. IfbufferListOutisn’tNULLandbufferListSizeis insufficient,kFigSampleBufferError_ArrayTooSmallis returned. - blockBufferStructureAllocator:
Allocator to use when creating the
CMBlockBufferstructure. - blockBufferBlockAllocator:
Allocator to use for memory block held by the
CMBlockBuffer. - flags:
Flags controlling operation.
- blockBufferOut:
The retained
CMBlockBuffer.
Return Value
A result code. See Sample Buffer Error Codes.
Discussion
Creates an AudioBufferList containing the data from the CMSampleBuffer, and a CMBlockBuffer which references (and manages the lifetime of) the data in that AudioBufferList. The data may or may not be copied, depending on the contiguity and 16-byte alignment of the sample buffer’s data.
The buffers placed in the AudioBufferList are guaranteed to be contiguous.
The buffers in the AudioBufferList will be 16-byte-aligned if kCMSampleBufferFlag_AudioBufferList_Assure16ByteAlignment is passed in.
See Also
Modifying Sample Buffers
CMSampleBufferGetDataBuffer(_:)CMSampleBufferSetDataBuffer(_:newValue:)CMSampleBufferGetImageBuffer(_:)CMSampleBufferSetDataBufferFromAudioBufferList(_:blockBufferAllocator:blockBufferMemoryAllocator:flags:bufferList:)CMSampleBufferCopyPCMDataIntoAudioBufferList(_:at:frameCount:into:)CMSampleBufferGetAudioStreamPacketDescriptions(_:allocatedSize:packetDescriptionsOut:packetDescriptionsSizeNeededOut:)CMSampleBufferGetAudioStreamPacketDescriptionsPtr(_:packetDescriptionsPointerOut:sizeOut:)