CMTimebase

A model of a timeline under application control.

Overview

A timebase represents a timeline that clients can control by setting the rate and time. Each timebase has either a master clock or a master timebase and its rate is expressed relative to its master:

  • When a timebase has rate 0.0, its time is fixed and does not change as its master's time changes.

  • When a timebase has rate 1.0, its time increases one second as its master's time increases by one second.

  • When a timebase has rate 2.0, its time increases two seconds as its master's time increases by one second.

  • When a timebase has rate -1.0, its time decreases one second as its master's time increases by one second.

If a timebase has a master timebase, the master timebase's rate is a factor in determining the timebase's effective rate. In fact, a timebase's effective rate is defined as the product of its rate, its master timebase's rate, its master timebase's master timebase's rate, and so on up to the ultimate master clock. This is the rate at which the timebase's time changes relative to the ultimate master clock.

Topics

Functions

func CMTimebaseNotificationBarrier(CMTimebase) -> OSStatus

Requests that the timebase wait until it is not posting any notifications.

func CMTimebaseGetTypeID() -> CFTypeID

Returns the CFTypeID for CMTimebase.

func CMTimebaseGetMasterTimebase(CMTimebase) -> CMTimebase?

Returns the immediate master timebase of a timebase.

Deprecated
func CMTimebaseGetMasterClock(CMTimebase) -> CMClock?

Returns the immediate master clock of a timebase.

Deprecated
func CMTimebaseGetMaster(CMTimebase) -> CMClockOrTimebase?

Returns the immediate master (either timebase or clock) of a timebase.

Deprecated
func CMTimebaseGetUltimateMasterClock(CMTimebase) -> CMClock?

Returns the master clock that is the master of all of a timebase's master timebases.

Deprecated
func CMTimebaseGetTime(CMTimebase) -> CMTime

Retrieves the current time from a timebase.

func CMTimebaseGetRate(CMTimebase) -> Float64

Retrieves the current rate of a timebase.

func CMTimebaseSetRateAndAnchorTime(CMTimebase, rate: Float64, anchorTime: CMTime, immediateMasterTime: CMTime) -> OSStatus

Sets the time of a timebase at a particular master time, and changes the rate at exactly that time.

func CMTimebaseGetEffectiveRate(CMTimebase) -> Float64

Gets the effective rate of a timebase (which combines its rate with the rates of all its master timebases).

func CMTimebaseAddTimer(CMTimebase, timer: CFRunLoopTimer, runloop: CFRunLoop) -> OSStatus

Adds the timer to the list of timers managed by the timebase.

func CMTimebaseRemoveTimer(CMTimebase, timer: CFRunLoopTimer) -> OSStatus

Removes the timer from the list of timers managed by the timebase.

func CMTimebaseSetTimerNextFireTime(CMTimebase, timer: CFRunLoopTimer, fireTime: CMTime, flags: UInt32) -> OSStatus

Sets the CMTime on the timebase's timeline at which the timer should next be fired.

func CMTimebaseSetTimerToFireImmediately(CMTimebase, timer: CFRunLoopTimer) -> OSStatus

Sets the timer to fire immediately once, overriding any previous CMTimebaseSetTimerNextFireTime call.

func CMTimebaseAddTimerDispatchSource(CMTimebase, timerSource: DispatchSource) -> OSStatus

Adds the timer dispatch source to the list of timers managed by the timebase.

func CMTimebaseRemoveTimerDispatchSource(CMTimebase, timerSource: DispatchSource) -> OSStatus

Removes the timer dispatch source from the list of timers managed by the timebase.

func CMTimebaseSetTimerDispatchSourceNextFireTime(CMTimebase, timerSource: DispatchSource, fireTime: CMTime, flags: UInt32) -> OSStatus

Sets the CMTime on the timebase's timeline at which the timer dispatch source should be fired next.

func CMTimebaseCopyMaster(CMTimebase) -> CMClockOrTimebase

Returns the immediate master timebase of a timebase.

func CMTimebaseCopyMasterClock(CMTimebase) -> CMClock?

Returns the immediate master clock of a timebase.

func CMTimebaseCopyMasterTimebase(CMTimebase) -> CMTimebase?

Returns the immediate master timebase of a timebase.

func CMTimebaseCopyUltimateMasterClock(CMTimebase) -> CMClock

Returns the master clock that is the master of all of a timebase's master timebases.

Constants

var kCMTimebaseError_MissingRequiredParameter: OSStatus

Indicates that a required parameter is missing.

var kCMTimebaseError_InvalidParameter: OSStatus

Indicates a NULL or 0 was passed for a required parameter.

var kCMTimebaseError_AllocationFailed: OSStatus

Indicates a failed memory allocation.

var kCMTimebaseError_TimerIntervalTooShort: OSStatus

Indicates that the supplied time interval is too short.

var kCMTimebaseError_ReadOnly: OSStatus

Indicates that an attempt was made to modify a read-only timebase.

See Also

Media Synchronization

CMClock

A reference clock used to synchronize applications and devices.

CMAudioClock

A specialized reference clock used to synchronize with audio sources.