Contents

CMAudioSampleBufferCreateReadyWithPacketDescriptions(allocator:dataBuffer:formatDescription:sampleCount:presentationTimeStamp:packetDescriptions:sampleBufferOut:)

Creates a sample buffer with packet descriptions.

Declaration

func CMAudioSampleBufferCreateReadyWithPacketDescriptions(allocator: CFAllocator?, dataBuffer: CMBlockBuffer, formatDescription: CMFormatDescription, sampleCount numSamples: CMItemCount, presentationTimeStamp: CMTime, packetDescriptions: UnsafePointer<AudioStreamPacketDescription>?, sampleBufferOut: UnsafeMutablePointer<CMSampleBuffer?>) -> OSStatus

Parameters

  • allocator:

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

  • dataBuffer:

    CMBlockBuffer already containing the media data. Must not be NULL.

  • formatDescription:

    A description of the media data’s format. Can’t be NULL.

  • numSamples:

    Number of samples in the CMSampleBuffer. Must not be 0.

  • presentationTimeStamp:

    Timestamp of the first sample in the buffer. Must be a numeric CMTime.

  • packetDescriptions:

    Array of packet descriptions, one for each of numSamples. May be NULL if the samples are known to have a constant number of frames per packet and a constant size.

  • sampleBufferOut:

    Returned newly created CMSampleBuffer.

Discussion

Provides an optimization over CMSampleBufferCreate(allocator:dataBuffer:dataReady:makeDataReadyCallback:refcon:formatDescription:sampleCount:sampleTimingEntryCount:sampleTimingArray:sampleSizeEntryCount:sampleSizeArray:sampleBufferOut:) when the caller already has packetDescriptions for the audio data. This routine will use the packetDescriptions to create the sizing and timing arrays required to make the sample buffer if necessary.

This function is identical to CMAudioSampleBufferCreateWithPacketDescriptions(allocator:dataBuffer:dataReady:makeDataReadyCallback:refcon:formatDescription:sampleCount:presentationTimeStamp:packetDescriptions:sampleBufferOut:) except that dataReady is always true, and so no makeDataReadyCallback or refcon needs to be passed.

See Also

Creating Sample Buffers