Contents

setDataBuffer(_:)

Associates a block buffer of media data with a sample buffer.

Declaration

func setDataBuffer(_ dataBuffer: CMBlockBuffer) throws

Parameters

  • dataBuffer:

    A buffer that contains the media data.

Discussion

Calling this method is a write-once operation; it fails if the sample buffer already has a data buffer.

The purpose of this API is to allow you to create a sample buffer with timing and format information, before associating it with media data. For example, some media services may have access to sample size, timing, and format information, but only load the media data when accessed. Such services may create sample buffers with that information and insert them into queues early, and use this API to attach the media data when it’s ready.

See Also

Modifying Sample Buffers