CMSampleBufferCreateCopyWithNewTiming(allocator:sampleBuffer:sampleTimingEntryCount:sampleTimingArray:sampleBufferOut:)
Creates a copy of a sample buffer with new timing information.
Declaration
func CMSampleBufferCreateCopyWithNewTiming(allocator: CFAllocator?, sampleBuffer originalSBuf: CMSampleBuffer, sampleTimingEntryCount numSampleTimingEntries: CMItemCount, sampleTimingArray: UnsafePointer<CMSampleTimingInfo>?, sampleBufferOut: UnsafeMutablePointer<CMSampleBuffer?>) -> OSStatusParameters
- allocator:
The allocator to use for allocating the
CMSampleBufferobject. PasskCFAllocatorDefaultto use the default allocator. - originalSBuf:
CMSampleBuffercontaining the original samples. - numSampleTimingEntries:
Number of entries in
sampleTimingArray. Must be 0, 1, or the number of samples inoriginalSBuf. - sampleTimingArray:
Array of
CMSampleTimingInfostructs, one struct per sample. If all samples have the same duration and are in presentation order, you can pass a singleCMSampleTimingInfostruct with duration set to the duration of one sample,presentationTimeStampset to the presentation time of the numerically earliest sample, anddecodeTimeStampset tokCMTimeInvalid. Behavior is undefined if samples in aCMSampleBuffer(or even in multiple buffers in the same stream) have the samepresentationTimeStamp. Can beNULL. - sampleBufferOut:
On output, points to the newly created copy of
CMSampleBuffer.
Return Value
A result code. See Sample Buffer Error Codes.
Discussion
This emulates CMSampleBufferCreateCopy, but changes the timing. The array parameters, sampleTimingArray, should have only one element if that same element applies to all samples.
All parameters are copied; on return, the caller can release them, free them, or reuse them. Any outputPresentationTimestamp that has been set on the original buffer isn’t copied because it’s no longer relevant. On return, the caller owns the returned CMSampleBuffer, and must release it when done with it.