copyNextSampleBuffer()
Copies the next sample buffer from the output.
Declaration
func copyNextSampleBuffer() -> CMSampleBuffer?Return Value
The output sample buffer, or nil if you’ve read all samples or an error occurs.
Discussion
This method returns nil when you’ve read all available sample buffers, or if there’s an error. Check the value of the asset reader’s status property to determine the reason.
The order of returned sample buffers depends on the output’s configuration. For a track output with a nil outputSettings dictionary, the output skips decoding and returns sample buffers in decode order. Preserve that order when working with the encoded samples directly, such as when passing them to AVAssetWriter. When the output decodes the samples, it returns them in presentation order. Playback and downstream processing operate in presentation order, so decode order no longer matters after decoding.