Function

CMSampleBufferSetOutputPresentationTimeStamp

Sets an output presentation timestamp to be used in place of a calculated value.

Declaration

OSStatus CMSampleBufferSetOutputPresentationTimeStamp(CMSampleBufferRef sbuf, CMTime outputPresentationTimeStamp);

Parameters

sbuf

The sample buffer being interrogated

outputPresentationTimeStamp

New value for OutputPresentationTimeStamp. Pass kCMTimeInvalid to go back to the default calculation.

Return Value

A result code. See Result Codes.

Discussion

The output presentation timestamp is the time at which the decoded, trimmed, stretched and possibly reversed samples should commence being presented. By default, this is calculated by calling CMSampleBufferGetOutputPresentationTimeStamp. Call CMSampleBufferSetOutputPresentationTimeStamp to explicitly set the value for CMSampleBufferGetOutputPresentationTimeStamp to return.

For general forward playback in a scaled edit, the OutputPresentationTimeStamp should be set to:

((PresentationTimeStamp + TrimDurationAtStart - EditStartMediaTime) / EditSpeedMultiplier) + EditStartTrackTime.

For general reversed playback OutputPresentationTimeStamp should be set to:

((PresentationTimeStamp + Duration - TrimDurationAtEnd - EditStartMediaTime) / EditSpeedMultiplier) + EditStartTrackTime.

See Also

Modifying Sample Buffers

CMSampleBufferCallBlockForEachSample

Calls a block for every individual sample in a sample buffer.

CMSampleBufferSetDataFailed

Marks a sample buffer's data as "failed", to indicate that the data will not become ready.

CMSampleBufferSetInvalidateHandler

Sets the sample buffer's invalidation handler block, which is called during CMSampleBufferInvalidate.

CMSampleBufferCallForEachSample

Calls a function for every individual sample in a sample buffer.

CMSampleBufferCopySampleBufferForRange

Creates a CMSampleBuffer containing a range of samples from an existing CMSampleBuffer.

CMSampleBufferInvalidate

Makes the sample buffer invalid, calling any installed invalidation callback.

CMSampleBufferMakeDataReady

Makes a CMSampleBuffer data ready, by calling the client's CMSampleBufferMakeDataReadyCallback.

CMSampleBufferSetDataBuffer

Associates a CMSampleBuffer with its CMBlockBuffer of media data.

CMSampleBufferSetDataReady

Marks a CMSampleBuffer's data as "ready".

CMSampleBufferSetInvalidateCallback

Sets the CMSampleBuffer’s invalidation callback, which is called during CMSampleBufferInvalidate.

CMSampleBufferTrackDataReadiness

Associates a CMSampleBuffer's data readiness with another CMSampleBuffer's data readiness.