CMSampleBufferCreateReady(allocator:dataBuffer:formatDescription:sampleCount:sampleTimingEntryCount:sampleTimingArray:sampleSizeEntryCount:sampleSizeArray:sampleBufferOut:)
Creates a sample buffer with media data.
Declaration
func CMSampleBufferCreateReady(allocator: CFAllocator?, dataBuffer: CMBlockBuffer?, formatDescription: CMFormatDescription?, sampleCount numSamples: CMItemCount, sampleTimingEntryCount numSampleTimingEntries: CMItemCount, sampleTimingArray: UnsafePointer<CMSampleTimingInfo>?, sampleSizeEntryCount numSampleSizeEntries: CMItemCount, sampleSizeArray: UnsafePointer<Int>?, sampleBufferOut: UnsafeMutablePointer<CMSampleBuffer?>) -> OSStatusParameters
- allocator:
The allocator to use for allocating the
CMSampleBufferobject. PasskCFAllocatorDefaultto use the default allocator. - dataBuffer:
CMBlockBufferthat already contains the media data. Must not beNULL. - formatDescription:
A description of the media data’s format. Can be
NULL. - numSamples:
Number of samples in the
CMSampleBuffer. Can be 0. - numSampleTimingEntries:
Number of entries in sampleTimingArray. Must be 0, 1, or
numSamples. - 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. The behavior is undefined if samples in aCMSampleBuffer(or even in multiple buffers in the same stream) have the samepresentationTimeStamp. Can beNULL. - numSampleSizeEntries:
Number of entries in
sampleSizeArray. Must be 0, 1, ornumSamples. - sampleSizeArray:
Array of size entries, one entry per sample. If all samples have the same size, you can pass a single size entry containing the size of one sample. Can be
NULL.Must be
NULLif the samples are non-contiguous in the buffer (eg. non-interleaved audio, where the channel values for a single sample are scattered through the buffer). - sampleBufferOut:
Returned newly created
CMSampleBuffer.
Discussion
This function is identical to CMSampleBufferCreate(allocator:dataBuffer:dataReady:makeDataReadyCallback:refcon:formatDescription:sampleCount:sampleTimingEntryCount:sampleTimingArray:sampleSizeEntryCount:sampleSizeArray:sampleBufferOut:) except that dataReady is always true, and so no makeDataReadyCallback or refcon needs to be passed.
See Also
Creating Sample Buffers
CMSampleBufferCreateReadyWithImageBuffer(allocator:imageBuffer:formatDescription:sampleTiming:sampleBufferOut:)CMAudioSampleBufferCreateReadyWithPacketDescriptions(allocator:dataBuffer:formatDescription:sampleCount:presentationTimeStamp:packetDescriptions:sampleBufferOut:)CMSampleBufferCreateWithMakeDataReadyHandler(_:_:_:_:_:_:_:_:_:_:_:)CMSampleBufferCreateForImageBufferWithMakeDataReadyHandler(_:_:_:_:_:_:_:)CMAudioSampleBufferCreateWithPacketDescriptionsAndMakeDataReadyHandler(_:_:_:_:_:_:_:_:_:)CMSampleBufferCreate(allocator:dataBuffer:dataReady:makeDataReadyCallback:refcon:formatDescription:sampleCount:sampleTimingEntryCount:sampleTimingArray:sampleSizeEntryCount:sampleSizeArray:sampleBufferOut:)CMSampleBufferCreateForImageBuffer(allocator:imageBuffer:dataReady:makeDataReadyCallback:refcon:formatDescription:sampleTiming:sampleBufferOut:)CMAudioSampleBufferCreateWithPacketDescriptions(allocator:dataBuffer:dataReady:makeDataReadyCallback:refcon:formatDescription:sampleCount:presentationTimeStamp:packetDescriptions:sampleBufferOut:)