CMBlockBufferReplaceDataBytes(with:blockBuffer:offsetIntoDestination:dataLength:)
Copies bytes from a given memory block into a block buffer replacing bytes in the underlying data blocks.
Declaration
func CMBlockBufferReplaceDataBytes(with sourceBytes: UnsafeRawPointer, blockBuffer destinationBuffer: CMBlockBuffer, offsetIntoDestination: Int, dataLength: Int) -> OSStatusParameters
- sourceBytes:
Memory block from which bytes are copied into the destination
CMBlockBuffer. - destinationBuffer:
CMBlockBufferwhose range of bytes will be replaced by thesourceBytes. - offsetIntoDestination:
Offset within the destination
CMBlockBufferat which replacement should begin. - dataLength:
Number of bytes to be replaced, starting at
offsetIntoDestination, in thedestinationBuffer.
Return Value
Returns kCMBlockBufferNoErr if the replacement succeeded, returns an error otherwise.
Discussion
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. CMBlockBufferAssureBlockMemory() is called on the given CMBlockBuffer. If desired range is subsequently not accessible in the CMBlockBuffer, an error is returned and the contents of the CMBlockBuffer are untouched.
See Also
Modifying a Block Buffer
CMBlockBufferAppendMemoryBlock(_:memoryBlock:length:blockAllocator:customBlockSource:offsetToData:dataLength:flags:)CMBlockBufferAppendBufferReference(_:targetBBuf:offsetToData:dataLength:flags:)CMBlockBufferAssureBlockMemory(_:)CMBlockBufferAccessDataBytes(_:atOffset:length:temporaryBlock:returnedPointerOut:)CMBlockBufferCopyDataBytes(_:atOffset:dataLength:destination:)CMBlockBufferFillDataBytes(with:blockBuffer:offsetIntoDestination:dataLength:)