Contents

CMSampleBufferSetDataBuffer(_:newValue:)

Sets a block buffer of media data on a sample buffer.

Declaration

func CMSampleBufferSetDataBuffer(_ sbuf: CMSampleBuffer, newValue dataBuffer: CMBlockBuffer) -> OSStatus

Parameters

  • sbuf:

    The sample buffer being modified.

  • dataBuffer:

    CMBlockBuffer of data being associated with.

Return Value

A result code. See Sample Buffer Error Codes.

Discussion

If successful, this operation retains the dataBuffer. This allows the caller to release the dataBuffer after calling this API, if it has no further need to reference it. This is a write-once operation; it fails if the CMSampleBuffer already has a dataBuffer. This API allows a CMSampleBuffer to exist, with timing and format information, before the associated data shows up.Example of usage: Some media services may have access to sample size, timing, and format information before the data is read. Such services may create CMSampleBuffers with that information and insert them into queues early, and use this API to attach the CMBlockBuffers later, when the data becomes ready.

See Also

Modifying Sample Buffers