Function

CMSampleBufferGetSampleSizeArray

Retrieves an array of sample sizes, one for each sample in a CMSampleBuffer.

Declaration

OSStatus CMSampleBufferGetSampleSizeArray(CMSampleBufferRef sbuf, CMItemCount sizeArrayEntries, size_t *sizeArrayOut, CMItemCount *sizeArrayEntriesNeededOut);

Parameters

sbuf

The CMSampleBuffer being interrogated.

sizeArrayEntries

Number of entries in sizeArray.

sizeArrayOut

Reference to an array of size_t values to receive the sample sizes.

sizeArrayEntriesNeededOut

Number of entries needed for the result.

Return Value

A result code. See Result Codes.

Discussion

If only one size entry is returned, all samples in the buffer are of this size. The sizeArrayOut must be allocated by the caller, and the number of entries allocated must be passed in sizeArrayEntries. If sizeArrayOut is NULL, sizeArrayEntriesNeededOut will return the required number of entries. Similarly, if sizeArrayEntries is too small, CMSampleBuffer will be returned, and sizeArrayEntriesNeededOut will return the required number of entries. The caller can then make an appropriately-sized sizeArrayOut and call again. For example, the caller might pass the address of a size_t variable on the stack (as sizeArrayOut), and 1 as sizeArrayEntries. If all samples are the same size (or there is only one sample in the CMSampleBuffer), this call would succeed. If not, it will fail, and will return the number of entries required in sizeArrayEntriesNeededOut. Only in this case (multiple samples of different sizes) will the caller need to allocate an array. 0 entries will be returned if the samples in the buffer are non-contiguous (eg. non-interleaved audio, where the channel values for a single sample are scattered through the buffer). If there are no sample sizes in this CMSampleBuffer, CMSampleBuffer will be returned, and *sizeArrayEntriesNeededOut will be set to 0. This will be true, for example, if the samples in the buffer are non-contiguous (eg. non-interleaved audio, where the channel values for a single sample are scattered through the buffer), or if this CMSampleBuffer contains a CVImageBuffer.

See Also

Inspecting Sample Buffers

CMSampleBufferGetDataBuffer

Returns a CMSampleBuffer's CMBlockBuffer of media data.

CMSampleBufferGetDecodeTimeStamp

Returns the numerically earliest decode timestamp of all the samples in a CMSampleBuffer.

CMSampleBufferGetDuration

Returns the total duration of a CMSampleBuffer.

CMSampleBufferGetFormatDescription

Returns the format description of the samples in a CMSampleBuffer.

CMSampleBufferGetImageBuffer

Returns a sample buffer's CVImageBuffer of media data.

CMSampleBufferGetNumSamples

Returns the number of media samples in a CMSampleBuffer.

CMSampleBufferGetOutputDecodeTimeStamp

Returns the output decode timestamp of the CMSampleBuffer.

CMSampleBufferGetOutputDuration

Returns the output duration of a CMSampleBuffer.

CMSampleBufferGetOutputPresentationTimeStamp

Returns the output presentation timestamp of the CMSampleBuffer.

CMSampleBufferGetOutputSampleTimingInfoArray

Retrieves an array of output CMSampleTimingInfo structs, one for each sample in a CMSampleBuffer.

CMSampleBufferGetPresentationTimeStamp

Returns the numerically earliest presentation timestamp of all the samples in a CMSampleBuffer.

CMSampleBufferGetSampleAttachmentsArray

Returns a reference to a CMSampleBuffer's immutable array of mutable sample attachments dictionaries (one dictionary per sample in the CMSampleBuffer).

CMSampleBufferGetSampleSize

Returns the size in bytes of a specified sample in a CMSampleBuffer.

CMSampleBufferGetSampleTimingInfo

Retrieves a CMSampleTimingInfo struct describing a specified sample in a CMSampleBuffer.

CMSampleBufferGetSampleTimingInfoArray

Retrieves an array of CMSampleTimingInfo structs, one for each sample in a CMSampleBuffer.

CMSampleBufferGetTotalSampleSize

Returns the total size in bytes of sample data in a CMSampleBuffer.

CMSampleBufferHasDataFailed

Indicates if the sample buffer's data loading request has failed.

CMSampleBufferDataIsReady

Determines if the sample buffer's data is ready.

CMSampleBufferIsValid

Queries whether a sample buffer is still valid.

CMSampleBufferGetTypeID

Returns the CFTypeID of CMSampleBuffer objects.