Contents

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?>) -> OSStatus

Parameters

  • allocator:

    The allocator to use for allocating the CMSampleBuffer object. Pass kCFAllocatorDefault to use the default allocator.

  • dataBuffer:

    CMBlockBuffer that already contains the media data. Must not be NULL.

  • 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 CMSampleTimingInfo structs, one struct per sample. If all samples have the same duration and are in presentation order, you can pass a single CMSampleTimingInfo struct with duration set to the duration of one sample, presentationTimeStamp set to the presentation time of the numerically earliest sample, and decodeTimeStamp set to kCMTimeInvalid. The behavior is undefined if samples in a CMSampleBuffer (or even in multiple buffers in the same stream) have the same presentationTimeStamp. Can be NULL.

  • numSampleSizeEntries:

    Number of entries in sampleSizeArray. Must be 0, 1, or numSamples.

  • 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 NULL if 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