One Logo Pool Ball
CoreMedia · IOS API REFERENCE

CMBlockBufferProtocol

protocol · iOS 13.0+ · SDK 27.1

protocol CMBlockBufferProtocol

Methods that operate on a range of a `CMBlockBuffer` uses `CMBlockBufferProtocol`.

Members (14)

get · iOS 13.0+

dataLength

Swift declaration
var dataLength: Int { get }

Obtains the total data length. Obtains the total data length. This total is the sum of the `dataLength`s of the `CMBlockBuffer`'s memory blocks and buffer references. Note that the `dataLength`s are the _portions_ of those constituents that this `CMBlockBuffer` subscribes to. This `CMBlockBuffer` presents a contiguous range of offsets from zero to its total `dataLength`.

get · iOS 13.0+

isContiguous

Swift declaration
var isContiguous: Bool { get }

Determines whether the `CMBlockBuffer` is contiguous. If withUnsafeMutableBytes(atOffset:_:) were to be called with the same parameters, the returned buffer pointer would address the desired number of bytes. `true` if the slice is contiguous within the `CMBlockBuffer`, `false` otherwise. Also returns `false` if the `CMBlockBuffer` is empty.

method · iOS 13.0+

copyDataBytes

Swift declaration
func copyDataBytes(to destination: UnsafeMutableRawBufferPointer) throws

Copies bytes into a provided memory area. This function is used to copy bytes out of a `CMBlockBuffer` into a provided piece of memory. It deals with the possibility of the desired range of data being noncontiguous. - Parameters: - destination: Memory into which the data should be copied. Must be large enough to contain `dataLength` bytes.

method · iOS 13.0+

fillDataBytes

Swift declaration
func fillDataBytes(with fillByte: UInt8) throws

Fills the `CMBlockBuffer` with a given byte value, replacing bytes in the underlying data blocks This function is used to fill bytes in a `CMBlockBuffer`'s memory blocks with a given byte value. It deals with the possibility of the destination range of data being noncontiguous. `assureBlockMemory()` is called. If desired range is subsequently not accessible in the `CMBlockBuffer`, an error is thrown and the contents of the `CMBlockBuffer` are untouched. - Parameters: - fillByte: The value with which to fill the specified data range.

method · iOS 13.0+

makeContiguous

Swift declaration
func makeContiguous(allocator: CFAllocator? = kCFAllocatorDefault, flags: CMBlockBuffer.Flags = []) throws -> CMBlockBuffer

Produces a `CMBlockBuffer` containing a contiguous copy of or reference to the data specified by the parameters. Produces a `CMBlockBuffer` containing a contiguous copy of or reference to the data specified by the parameters. The resulting new `CMBlockBuffer` may contain an allocated copy of the data, or may contain a contiguous `CMBlockBuffer` reference. If `.alwaysCopyData` is set in the flags parameter, the resulting `CMBlockBuffer` will contain an allocated copy of the data rather than a reference to the source buffer. - Parameters: - allocator: Allocator to be used for allocating the memory block if a contiguous copy of the data is to be made. - flags: Feature and control flags. - Returns: Newly-created `CMBlockBuffer` object with contiguous memory backing.

method · iOS 13.0+

replaceDataBytes

Swift declaration
func replaceDataBytes(with sourceBytes: UnsafeRawBufferPointer) throws

Copies bytes from a given memory block, replacing bytes in the underlying data blocks This function is used to replace bytes in a `CMBlockBuffer`'s memory blocks with those from a provided piece of memory. It deals with the possibility of the destination range of data being noncontiguous. `assureBlockMemory()` is called. If desired range is subsequently not accessible in the `CMBlockBuffer`, an error is thrown and the contents of the `CMBlockBuffer` are untouched. - Parameters: - sourceBytes: Memory block from which bytes are copied into the `CMBlockBuffer`.

method · iOS 13.0+

withContiguousStorage

Swift declaration
func withContiguousStorage<R>(_ body: (UnsafeRawBufferPointer) throws -> R) throws -> R

Accesses potentially noncontiguous data. Used for accessing potentially noncontiguous data, this routine will call `body` with a buffer pointer directly into the given `CMBlockBuffer` if possible, otherwise the data will be assembled and copied into a temporary block and `body` will be called with its buffer pointer. - Parameter body: A closure with an `UnsafeRawBufferPointer` parameter that points to contiguous storage for the block buffer. - Returns: The return value, if any, of the body closure parameter.

method · iOS 13.0+

dataBytes

Swift declaration
func dataBytes() throws -> Data

Copies bytes to a `Data`. This function is used to copy bytes out of a `CMBlockBuffer`. It deals with the possibility of the desired range of data being noncontiguous. - Returns: `Data` containing the bytes requested.

subscript · iOS 13.0+

subscript

Swift declaration
subscript(bounds: ClosedRange<Int>) -> CMBlockBuffer.Slice { get }

Creates a slice from a `ClosedRange`.

subscript · iOS 13.0+

subscript

Swift declaration
subscript(bounds: Range<Int>) -> CMBlockBuffer.Slice { get }

Creates a slice from a `Range`.

subscript · iOS 13.0+

subscript

Swift declaration
subscript(bounds: PartialRangeFrom<Int>) -> CMBlockBuffer.Slice { get }

Creates a slice from a `PartialRangeFrom`. The endIndex is set to the current "past the end" position.

subscript · iOS 13.0+

subscript

Swift declaration
subscript(bounds: PartialRangeUpTo<Int>) -> CMBlockBuffer.Slice { get }

Creates a slice from a `PartialRangeUpTo`.

subscript · iOS 13.0+

subscript

Swift declaration
subscript(bounds: PartialRangeThrough<Int>) -> CMBlockBuffer.Slice { get }

Creates a slice from a `PartialRangeThrough`.

subscript · iOS 13.0+

subscript

Swift declaration
subscript(bounds: UnboundedRange) -> CMBlockBuffer.Slice { get }

Creates a slice from an `UnboundedRange`. The endIndex is set to the current "past the end" position.

Skipped declarations

1 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.

CMBlockBufferProtocol.makeContiguous(allocator:deallocator:flags:)

callback cannot propagate synchronous failure

All CoreMedia types →