Contents

loadSampleBufferContainingSamples(to:completionHandler:)

Builds a sample buffer that contains the samples at the cursor that you specify.

Declaration

optional func loadSampleBufferContainingSamples(to endSampleCursor: (any MESampleCursor)?, completionHandler: @escaping  @Sendable (CMSampleBuffer?, (any Error)?) -> Void)
optional func loadSampleBufferContainingSamples(to endSampleCursor: (any MESampleCursor)?) async throws -> CMSampleBuffer

Parameters

  • endSampleCursor:

    If not nil, this cursor indicates the last sample that the new sample buffer should contain.

  • completionHandler:

    The completion block to execute when the load operation finishes.

Discussion

Plugin format readers that don’t implement sampleLocation() or that always load sample data to answer cursor queries need to implement this method. If a plug-in format reader implements sampleLocation(), implementing loadSampleBufferContainingSamples(to:completionHandler:) is optional.

If there’s no sample data between the sample cursor and endSampleCursor, the sample buffer is empty. If an error occurs, the sample buffer is nil.

See Also

Sending samples to a pipeline