An object used to move blocks of memory through a processing system.


A CMBlockBuffer is a CFType object that represents a contiguous range of data offsets (from zero to CMBlockBufferGetDataLength(_:)) across a possibly noncontiguous memory region. The memory region is composed of memory blocks and buffer references. The buffer references can in turn refer to additional regions. CMBlockBuffer uses CMAttachment protocol to propagate attachments.


Modifying Block Buffers

func CMBlockBufferReplaceDataBytes(with: UnsafeRawPointer, blockBuffer: CMBlockBuffer, offsetIntoDestination: Int, dataLength: Int) -> OSStatus

Copies bytes from a given memory block into a CMBlockBuffer, replacing bytes in the underlying data blocks.

func CMBlockBufferAssureBlockMemory(CMBlockBuffer) -> OSStatus

Assures all memory blocks in a CMBlockBuffer are allocated.

Inspecting Block Buffers

func CMBlockBufferGetDataLength(CMBlockBuffer) -> Int

Obtains the total length of data reachable via a CMBlockBuffer.

func CMBlockBufferIsEmpty(CMBlockBuffer) -> Bool

Determines whether the given CMBlockBuffer is empty.

func CMBlockBufferIsRangeContiguous(CMBlockBuffer, atOffset: Int, length: Int) -> Bool

Determines whether the specified range within the given CMBlockBuffer is contiguous.

func CMBlockBufferGetTypeID() -> CFTypeID

Obtains the CoreFoundation type ID for the CMBlockBuffer type.

Data Types

class CMBlockBuffer

A reference to a CMBlockBuffer object.

typealias CMBlockBufferFlags

Type used for parameters containing CMBlockBuffer feature and control flags.

struct CMBlockBufferCustomBlockSource

Structure to support custom memory allocation and/or deallocation for the block used in a CMBlockBuffer.


CMBlockBuffer Flags

Flags controlling behaviors and features of CMBlockBuffer APIs.

Custom Block Source Version

Provides the custom block source version used in a CMBlockBuffer.

Block Buffer Error Codes

This table lists result codes defined for CMBlockBuffer APIs.

See Also

Sample Processing


An object containing zero or more media samples of a uniform media type.


A media format descriptor that describes the samples in a sample buffer.


An API for attaching additional metadata to a sample buffer.