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 CMBlockBufferFillDataBytes(Int8, CMBlockBuffer, Int, Int)

Fills the destination buffer with the specified data byte.

func CMBlockBufferReplaceDataBytes(UnsafeRawPointer, CMBlockBuffer, Int, Int)

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

func CMBlockBufferAssureBlockMemory(CMBlockBuffer)

Assures all memory blocks in a CMBlockBuffer are allocated.

func CMBlockBufferCopyDataBytes(CMBlockBuffer, Int, Int, UnsafeMutableRawPointer)

Copies bytes from a CMBlockBuffer into a provided memory area.

Inspecting Block Buffers

func CMBlockBufferGetDataLength(CMBlockBuffer)

Obtains the total length of data reachable via a CMBlockBuffer.

func CMBlockBufferIsEmpty(CMBlockBuffer)

Determines whether the given CMBlockBuffer is empty.

func CMBlockBufferIsRangeContiguous(CMBlockBuffer, Int, Int)

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

func CMBlockBufferGetTypeID()

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.