One Logo Pool Ball
CoreMedia · IOS API REFERENCE

CMBlockBuffer

class · iOS 4.0+ · SDK 27.1

class CMBlockBuffer

Members (15)

init · iOS 4.0+

init

TypeScript
static init(object: CMBlockBuffer): CMBlockBuffer
Swift declaration
init(referencing object: CMBlockBuffer)
get · iOS 13.0+

startIndex

TypeScript
get startIndex(): number
Swift declaration
var startIndex: Int { get }

The position of the first element.

get · iOS 13.0+

attachments

TypeScript
get attachments(): CMAttachmentBearerAttachments
Swift declaration
var attachments: CMAttachmentBearerAttachments { get set }

Access attachments.

set · iOS 13.0+

attachments

TypeScript
set attachments(value: CMAttachmentBearerAttachments)
Swift declaration
var attachments: CMAttachmentBearerAttachments { get set }

Access attachments.

method · iOS 13.0+

assureBlockMemory

TypeScript
assureBlockMemory(): void
Swift declaration
func assureBlockMemory() throws

Assures all memory blocks are allocated. Traverses the possibly complex `CMBlockBuffer`, allocating the memory for any constituent memory blocks that are not yet allocated.

method · iOS 13.0+

withUnsafeMutableBytes

TypeScript
withUnsafeMutableBytes(offset: number, body: ((arg0: ArrayBuffer) => unknown)): unknown
Swift declaration
func withUnsafeMutableBytes<R>(atOffset offset: Int = 0, _ body: (UnsafeMutableRawBufferPointer) throws -> R) throws -> R

Gains access to the data represented by a `CMBlockBuffer`. Gains access to the data represented by a `CMBlockBuffer`. A mutable buffer pointer into a memory block is given to the closure which corresponds to the offset within the `CMBlockBuffer`. This buffer may be smaller than the number of bytes actually available starting at the offset if the `dataLength` of the `CMBlockBuffer` is covered by multiple memory blocks (a noncontiguous `CMBlockBuffer`). The buffer pointer will remain valid as long as the original `CMBlockBuffer` is referenced - once the `CMBlockBuffer` is released for the last time, any buffer pointers into it will be invalid. - Parameters: - offset: Offset within the buffer's offset range. - body: A closure with an `UnsafeMutableRawBufferPointer` parameter that points to contiguous storage in the block buffer. - Returns: The return value, if any, of the body closure parameter.

get · iOS 13.0+

owner

TypeScript
get owner(): CMBlockBuffer
Swift declaration
var owner: CMBlockBuffer { get }

`CMBlockBuffer` instance to operate on.

method · iOS 13.0+

append

TypeScript
appendBufferDeallocatorFlags(buffer: ArrayBuffer, deallocator: ((arg0: SDKHandle, arg1: number) => void), flags?: CMBlockBuffer_Flags): void
Swift declaration
func append(buffer: UnsafeMutableRawBufferPointer, deallocator: @escaping CMBlockBuffer.CustomBlockDeallocator, flags: CMBlockBuffer.Flags = []) throws

Adds a memory block, alreay allocated with a custom allocator. Adds a memory block to an existing `CMBlockBuffer`. The `CMBlockBuffer`'s total data length will be increased by the specified `buffer` length. Note that append operations are not thread safe, so care must be taken when appending to `CMBlockBuffer`s that are used by multiple threads. - Parameters: - buffer: Block of memory to hold buffered data. The block will be used and will be deallocated when the new CMBlockBuffer is finalized (i.e. released for the last time). - deallocator: Deallocator to be used for deallocating the buffer. - flags: Feature and control flags.

method · iOS 13.0+

append

TypeScript
appendBufferDeallocatorFlags48509(buffer: SDKHandle, deallocator: ((arg0: SDKHandle, arg1: number) => void), flags?: CMBlockBuffer_Flags): void
Swift declaration
func append(buffer: Slice<UnsafeMutableRawBufferPointer>, deallocator: @escaping CMBlockBuffer.CustomBlockDeallocator, flags: CMBlockBuffer.Flags = []) throws

Adds a sliced memory block, alreay allocated with a custom allocator. Adds a memory block to an existing `CMBlockBuffer`. The `CMBlockBuffer`'s total data length will be increased by the specified `buffer` slice length. Note that append operations are not thread safe, so care must be taken when appending to `CMBlockBuffer`s that are used by multiple threads. - Parameters: - buffer: Slice in a block of memory to hold buffered data. The block will be used and will be deallocated when the new `CMBlockBuffer` is finalized (i.e. released for the last time). The `CMBlockBuffer` will refer to the data in the slice. - deallocator: Deallocator to be used for deallocating the buffer. - flags: Feature and control flags.

method · iOS 13.0+

append

TypeScript
appendBufferAllocatorFlags(buffer: ArrayBuffer, allocator?: (_CoreFoundation_CFAllocator) | null, flags?: CMBlockBuffer_Flags): void
Swift declaration
func append(buffer: UnsafeMutableRawBufferPointer, allocator: CFAllocator? = kCFAllocatorDefault, flags: CMBlockBuffer.Flags = []) throws

Adds a memory block, alreay allocated with a `CFAllocator`. Adds a memory block to an existing `CMBlockBuffer`. The `CMBlockBuffer`'s total data length will be increased by the specified `buffer` length. Note that append operations are not thread safe, so care must be taken when appending to `CMBlockBuffer`s that are used by multiple threads. - Parameters: - buffer: Block of memory to hold buffered data. The block will be used and will be deallocated when the `CMBlockBuffer` is finalized (i.e. released for the last time). - allocator: Allocator to be used for deallocating the `buffer`. Pass `kCFAllocatorNull` if no deallocation is desired. - flags: Feature and control flags.

method · iOS 13.0+

append

TypeScript
appendBufferAllocatorFlags16471(buffer: SDKHandle, allocator?: (_CoreFoundation_CFAllocator) | null, flags?: CMBlockBuffer_Flags): void
Swift declaration
func append(buffer: Slice<UnsafeMutableRawBufferPointer>, allocator: CFAllocator? = kCFAllocatorDefault, flags: CMBlockBuffer.Flags = []) throws

Adds a sliced memory block, alreay allocated with a `CFAllocator`. Adds a memory block to an existing `CMBlockBuffer`. The `CMBlockBuffer`'s total data length will be increased by the specified `buffer` slice length. Note that append operations are not thread safe, so care must be taken when appending to `CMBlockBuffer`s that are used by multiple threads. - Parameters: - buffer: Slice in a block of memory to hold buffered data. The block will be used and will be deallocated when the `CMBlockBuffer` is finalized (i.e. released for the last time). The `CMBlockBuffer` will refer to the data in the `buffer` slice. - allocator: Allocator to be used for deallocating the `buffer`. Pass `kCFAllocatorNull` if no deallocation is desired. - flags: Feature and control flags.

method · iOS 13.0+

append

TypeScript
appendLengthAllocatorRangeFlags(length: number, allocator?: (_CoreFoundation_CFAllocator) | null, range?: (SDKHandle) | null, flags?: CMBlockBuffer_Flags): void
Swift declaration
func append(length: Int, allocator: CFAllocator? = kCFAllocatorDefault, range: Range<Int>? = nil, flags: CMBlockBuffer.Flags = []) throws

Adds a memory block, to allocate with a `CFAllocator`. Adds a memory block to an existing `CMBlockBuffer`. The `CMBlockBuffer`'s total data length will be increased by the specified `range` length. If `.assureMemoryNow` is set in the `flags` parameter, the memory block is allocated immediately using the `allocator`. Note that append operations are not thread safe, so care must be taken when appending to `CMBlockBuffer`s that are used by multiple threads. - Parameters: - length: Overall length of the memory block in bytes. Must not be zero. This is the size to allocate when `assureBlockMemory()` is called. - allocator: Allocator to be used for allocating the memory block. - range: Range within the memory block to which the `CMBlockBuffer` should refer to data. If `nil`, the whole memory block is used. - flags: Feature and control flags.

get · iOS 13.0+

typeID

TypeScript
static get typeID(): number
Swift declaration
class var typeID: CFTypeID { get }

The `CFTypeID` corresponding to `CMBlockBuffer`.

get · iOS 13.0+

isEmpty

TypeScript
get isEmpty(): boolean
Swift declaration
var isEmpty: Bool { get }

Indicates whether the `CMBlockBuffer` is empty. Indicates whether the `CMBlockBuffer` is empty, i.e., devoid of any memory blocks or `CMBlockBuffer` references. Note that a `CMBlockBuffer` containing a not-yet allocated memory block is not considered empty.

get · iOS 13.0+

endIndex

TypeScript
get endIndex(): number
Swift declaration
var endIndex: Int { get }

The "past the end" position.

Skipped declarations

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

CMBlockBuffer.append(length:allocator:deallocator:range:flags:)

callback cannot propagate synchronous failure

CMBlockBuffer.append(bufferReference:flags:)

This declaration needs Swift generic type arguments. (no canonical witness for T)

CMBlockBuffer.propagateAttachments(to:)

This declaration needs Swift generic type arguments. (no canonical witness for T)

All CoreMedia types →