Contents

makeSampleBuffer(for:addTo:)

Creates a sample buffer and attempts to defer I/O for its data.

Declaration

func makeSampleBuffer(for request: AVSampleBufferRequest, addTo batch: AVSampleBufferGeneratorBatch) throws -> CMSampleBuffer

Parameters

  • request:

    A sample buffer creation request.

  • batch:

    A batch object to contain the output sample buffer. You must create this object by calling Makebatch() on the same instance of Avsamplebuffergenerator or an error occurs.

Return Value

A sample buffer.

Discussion

Call the makeDataReady(completionHandler:) on AVSampleBufferGeneratorBatch once to commence I/O and load sample data for all CMSampleBuffer objects in a batch. After loading commences, any subsequent calls to makeSampleBuffer(for:addTo:) throw an exception.

The generator may defer I/O to fetch sample data depending on the source of the sample data and the generator’s timebase

The request may fail based on generator configuration or file format.

See Also

Creating a sample buffer