Contents

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) -> OSStatus

Parameters

  • sourceBytes:

    Memory block from which bytes are copied into the destination CMBlockBuffer.

  • destinationBuffer:

    CMBlockBuffer whose range of bytes will be replaced by the sourceBytes.

  • offsetIntoDestination:

    Offset within the destination CMBlockBuffer at which replacement should begin.

  • dataLength:

    Number of bytes to be replaced, starting at offsetIntoDestination, in the destinationBuffer.

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