Contents

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

Parameters

  • sbuf:

    CMSampleBuffer being 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 retained blockBufferOut. May be NULL.

  • bufferListSize:

    Size of the bufferListOut allocated by the client. If bufferListOut isn’t NULL and bufferListSize is insufficient, kFigSampleBufferError_ArrayTooSmall is returned.

  • blockBufferStructureAllocator:

    Allocator to use when creating the CMBlockBuffer structure.

  • 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