Function

CMSampleBufferSetDataBuffer

Associates a CMSampleBuffer with its CMBlockBuffer of media data.

Declaration

OSStatus CMSampleBufferSetDataBuffer(CMSampleBufferRef sbuf, CMBlockBufferRef dataBuffer);

Parameters

sbuf

The sample buffer being modified.

dataBuffer

CMBlockBuffer of data being associated with.

Return Value

A result code. See Result 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 will fail 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

CMSampleBufferCallBlockForEachSample

Calls a block for every individual sample in a sample buffer.

CMSampleBufferSetDataFailed

Marks a sample buffer's data as "failed", to indicate that the data will not become ready.

CMSampleBufferSetInvalidateHandler

Sets the sample buffer's invalidation handler block, which is called during CMSampleBufferInvalidate.

CMSampleBufferCallForEachSample

Calls a function for every individual sample in a sample buffer.

CMSampleBufferCopySampleBufferForRange

Creates a CMSampleBuffer containing a range of samples from an existing CMSampleBuffer.

CMSampleBufferInvalidate

Makes the sample buffer invalid, calling any installed invalidation callback.

CMSampleBufferMakeDataReady

Makes a CMSampleBuffer data ready, by calling the client's CMSampleBufferMakeDataReadyCallback.

CMSampleBufferSetDataReady

Marks a CMSampleBuffer's data as "ready".

CMSampleBufferSetInvalidateCallback

Sets the CMSampleBuffer’s invalidation callback, which is called during CMSampleBufferInvalidate.

CMSampleBufferSetOutputPresentationTimeStamp

Sets an output presentation timestamp to be used in place of a calculated value.

CMSampleBufferTrackDataReadiness

Associates a CMSampleBuffer's data readiness with another CMSampleBuffer's data readiness.