Contents

CMSampleBufferSetOutputPresentationTimeStamp(_:newValue:)

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

Declaration

func CMSampleBufferSetOutputPresentationTimeStamp(_ sbuf: CMSampleBuffer, newValue outputPresentationTimeStamp: CMTime) -> OSStatus

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 Sample Buffer Error 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

Inspecting Duration and Timing