# GstClock

GStreamer uses a global clock to synchronize the plugins in a pipeline. Different clock implementations are possible by implementing this abstract base class or, more conveniently, by subclassing GstSystemClock.

The GstClock returns a monotonically increasing time with the method gst_clock_get_time. Its accuracy and base time depend on the specific clock implementation but time is always expressed in nanoseconds. Since the baseline of the clock is undefined, the clock time returned is not meaningful in itself, what matters are the deltas between two clock times. The time returned by a clock is called the absolute time.

The pipeline uses the clock to calculate the running time. Usually all renderers synchronize to the global clock using the buffer timestamps, the GST_EVENT_SEGMENT events and the element's base time, see GstPipeline.

A clock implementation can support periodic and single shot clock notifications both synchronous and asynchronous.

One first needs to create a GstClockID for the periodic or single shot notification using gst_clock_new_single_shot_id or gst_clock_new_periodic_id.

To perform a blocking wait for the specific time of the GstClockID use gst_clock_id_wait. To receive a callback when the specific time is reached in the clock use gst_clock_id_wait_async. Both these calls can be interrupted with the gst_clock_id_unschedule call. If the blocking wait is unscheduled a return value of GST_CLOCK_UNSCHEDULED is returned.

Periodic callbacks scheduled async will be repeatedly called automatically until they are unscheduled. To schedule a sync periodic callback, gst_clock_id_wait should be called repeatedly.

The async callbacks can happen from any thread, either provided by the core or from a streaming thread. The application should be prepared for this.

A GstClockID that has been unscheduled cannot be used again for any wait operation, a new GstClockID should be created and the old unscheduled one should be destroyed with gst_clock_id_unref.

It is possible to perform a blocking wait on the same GstClockID from multiple threads. However, registering the same GstClockID for multiple async notifications is not possible, the callback will only be called for the thread registering the entry last.

None of the wait operations unref the GstClockID, the owner is responsible for unreffing the ids itself. This holds for both periodic and single shot notifications. The reason being that the owner of the GstClockID has to keep a handle to the GstClockID to unblock the wait on FLUSHING events or state changes and if the entry would be unreffed automatically, the handle might become invalid without any notification.

These clock operations do not operate on the running time, so the callbacks will also occur when not in PLAYING state as if the clock just keeps on running. Some clocks however do not progress when the element that provided the clock is not PLAYING.

When a clock has the GST_CLOCK_FLAG_CAN_SET_MASTER flag set, it can be slaved to another GstClock with gst_clock_set_master. The clock will then automatically be synchronized to this master clock by repeatedly sampling the master clock and the slave clock and recalibrating the slave clock with gst_clock_set_calibration. This feature is mostly useful for plugins that have an internal clock but must operate with another clock selected by the GstPipeline. They can track the offset and rate difference of their internal clock relative to the master clock by using the gst_clock_get_calibration function.

The master/slave synchronisation can be tuned with the timeout, window-size and window-threshold properties. The timeout property defines the interval to sample the master clock and run the calibration functions. window-size defines the number of samples to use when calibrating and window-threshold defines the minimum number of samples before the calibration is performed.

## GstClock

    GObject
        ╰──GInitiallyUnowned
            ╰──GstObject
                ╰──GstClock
                    ╰──GstSystemClock

GstClock base structure.

### Members

`object` (GstObject) –

the parent structure

### Class structure

#### GstClockClass

GStreamer clock class. Override the vmethods to implement the clock functionality.

##### Fields

`parent_class` (GstObjectClass) –

the parent class structure

### Gst.ClockClass

GStreamer clock class. Override the vmethods to implement the clock functionality.

##### Attributes

`parent_class` (Gst.ObjectClass) –

the parent class structure

### Gst.ClockClass

GStreamer clock class. Override the vmethods to implement the clock functionality.

##### Attributes

`parent_class` (Gst.ObjectClass) –

the parent class structure

## Gst.Clock

    GObject.Object
        ╰──GObject.InitiallyUnowned
            ╰──Gst.Object
                ╰──Gst.Clock
                    ╰──Gst.SystemClock

Gst.Clock base structure.

### Members

`object` (Gst.Object) –

the parent structure

## Gst.Clock

    GObject.Object
        ╰──GObject.InitiallyUnowned
            ╰──Gst.Object
                ╰──Gst.Clock
                    ╰──Gst.SystemClock

Gst.Clock base structure.

### Members

`object` (Gst.Object) –

the parent structure

### Methods

#### gst_clock_add_observation

    gboolean
    gst_clock_add_observation (GstClock * clock,
                               GstClockTime observation_internal,
                               GstClockTime observation_external,
                               gdouble * r_squared)

The time observation_external of the external or master clock and the time observation_internal of the internal or slave clock are added to the list of observations. If enough observations are available, a linear regression algorithm is run on the observations and clock is recalibrated.

If this functions returns TRUE, r_squared will contain the correlation coefficient of the interpolation. A value of 1.0 means a perfect regression was performed. This value can be used to control the sampling frequency of the master and slave clocks.

Parameters:

`clock` –

a GstClock

`observation_internal` –

a time on the internal clock

`observation_external` –

a time on the external clock

`r_squared` ( [out]) –

a pointer to hold the result

Returns –

TRUE if enough observations were added to run the regression algorithm.

#### Gst.Clock.prototype.add_observation

    function Gst.Clock.prototype.add_observation(observation_internal: Number, observation_external: Number): {
        // javascript wrapper for 'gst_clock_add_observation'
    }

The time observation_external of the external or master clock and the time observation_internal of the internal or slave clock are added to the list of observations. If enough observations are available, a linear regression algorithm is run on the observations and clock is recalibrated.

If this functions returns true, r_squared will contain the correlation coefficient of the interpolation. A value of 1.0 means a perfect regression was performed. This value can be used to control the sampling frequency of the master and slave clocks.

Parameters:

`clock` (Gst.Clock) –

a Gst.Clock

`observation_internal` (Number) –

a time on the internal clock

`observation_external` (Number) –

a time on the external clock

Returns a tuple made of:

(Number ) –

true if enough observations were added to run the regression algorithm.

`r_squared` (Number ) –

true if enough observations were added to run the regression algorithm.

#### Gst.Clock.add_observation

    def Gst.Clock.add_observation (self, observation_internal, observation_external):
        #python wrapper for 'gst_clock_add_observation'

The time observation_external of the external or master clock and the time observation_internal of the internal or slave clock are added to the list of observations. If enough observations are available, a linear regression algorithm is run on the observations and clock is recalibrated.

If this functions returns True, r_squared will contain the correlation coefficient of the interpolation. A value of 1.0 means a perfect regression was performed. This value can be used to control the sampling frequency of the master and slave clocks.

Parameters:

`clock` (Gst.Clock) –

a Gst.Clock

`observation_internal` (int) –

a time on the internal clock

`observation_external` (int) –

a time on the external clock

Returns a tuple made of:

(bool ) –

True if enough observations were added to run the regression algorithm.

`r_squared` (float ) –

True if enough observations were added to run the regression algorithm.

#### gst_clock_add_observation_unapplied

    gboolean
    gst_clock_add_observation_unapplied (GstClock * clock,
                                         GstClockTime observation_internal,
                                         GstClockTime observation_external,
                                         gdouble * r_squared,
                                         GstClockTime * internal,
                                         GstClockTime * external,
                                         GstClockTime * rate_num,
                                         GstClockTime * rate_denom)

Add a clock observation to the internal slaving algorithm the same as gst_clock_add_observation, and return the result of the external or master clock estimation, without updating the internal calibration.

The caller can then take the results and call gst_clock_set_calibration with the values, or some modified version of them.

Parameters:

`clock` –

a GstClock

`observation_internal` –

a time on the internal clock

`observation_external` –

a time on the external clock

`r_squared` ( [out]) –

a pointer to hold the result

`internal` ( [out][optional]) –

a location to store the internal time

`external` ( [out][optional]) –

a location to store the external time

`rate_num` ( [out][optional]) –

a location to store the rate numerator

`rate_denom` ( [out][optional]) –

a location to store the rate denominator

Returns –

TRUE if enough observations were added to run the regression algorithm.

Since : 1.6

#### Gst.Clock.prototype.add_observation_unapplied

    function Gst.Clock.prototype.add_observation_unapplied(observation_internal: Number, observation_external: Number): {
        // javascript wrapper for 'gst_clock_add_observation_unapplied'
    }

Add a clock observation to the internal slaving algorithm the same as Gst.Clock.prototype.add_observation, and return the result of the external or master clock estimation, without updating the internal calibration.

The caller can then take the results and call Gst.Clock.prototype.set_calibration with the values, or some modified version of them.

Parameters:

`clock` (Gst.Clock) –

a Gst.Clock

`observation_internal` (Number) –

a time on the internal clock

`observation_external` (Number) –

a time on the external clock

Returns a tuple made of:

(Number ) –

true if enough observations were added to run the regression algorithm.

`r_squared` (Number ) –

true if enough observations were added to run the regression algorithm.

`internal` (Number ) –

true if enough observations were added to run the regression algorithm.

`external` (Number ) –

true if enough observations were added to run the regression algorithm.

`rate_num` (Number ) –

true if enough observations were added to run the regression algorithm.

`rate_denom` (Number ) –

true if enough observations were added to run the regression algorithm.

Since : 1.6

#### Gst.Clock.add_observation_unapplied

    def Gst.Clock.add_observation_unapplied (self, observation_internal, observation_external):
        #python wrapper for 'gst_clock_add_observation_unapplied'

Add a clock observation to the internal slaving algorithm the same as Gst.Clock.add_observation, and return the result of the external or master clock estimation, without updating the internal calibration.

The caller can then take the results and call Gst.Clock.set_calibration with the values, or some modified version of them.

Parameters:

`clock` (Gst.Clock) –

a Gst.Clock

`observation_internal` (int) –

a time on the internal clock

`observation_external` (int) –

a time on the external clock

Returns a tuple made of:

(bool ) –

True if enough observations were added to run the regression algorithm.

`r_squared` (float ) –

True if enough observations were added to run the regression algorithm.

`internal` (int ) –

True if enough observations were added to run the regression algorithm.

`external` (int ) –

True if enough observations were added to run the regression algorithm.

`rate_num` (int ) –

True if enough observations were added to run the regression algorithm.

`rate_denom` (int ) –

True if enough observations were added to run the regression algorithm.

Since : 1.6

#### gst_clock_adjust_unlocked

    GstClockTime
    gst_clock_adjust_unlocked (GstClock * clock,
                               GstClockTime internal)

Converts the given internal clock time to the external time, adjusting for the rate and reference time set with gst_clock_set_calibration and making sure that the returned time is increasing. This function should be called with the clock's OBJECT_LOCK held and is mainly used by clock subclasses.

This function is the reverse of gst_clock_unadjust_unlocked.

Parameters:

`clock` –

a GstClock to use

`internal` –

a clock time

Returns –

the converted time of the clock.

#### Gst.Clock.prototype.adjust_unlocked

    function Gst.Clock.prototype.adjust_unlocked(internal: Number): {
        // javascript wrapper for 'gst_clock_adjust_unlocked'
    }

Converts the given internal clock time to the external time, adjusting for the rate and reference time set with Gst.Clock.prototype.set_calibration and making sure that the returned time is increasing. This function should be called with the clock's OBJECT_LOCK held and is mainly used by clock subclasses.

This function is the reverse of Gst.Clock.prototype.unadjust_unlocked.

Parameters:

`clock` (Gst.Clock) –

a Gst.Clock to use

`internal` (Number) –

a clock time

Returns (Number) –

the converted time of the clock.

#### Gst.Clock.adjust_unlocked

    def Gst.Clock.adjust_unlocked (self, internal):
        #python wrapper for 'gst_clock_adjust_unlocked'

Converts the given internal clock time to the external time, adjusting for the rate and reference time set with Gst.Clock.set_calibration and making sure that the returned time is increasing. This function should be called with the clock's OBJECT_LOCK held and is mainly used by clock subclasses.

This function is the reverse of Gst.Clock.unadjust_unlocked.

Parameters:

`clock` (Gst.Clock) –

a Gst.Clock to use

`internal` (int) –

a clock time

Returns (int) –

the converted time of the clock.

#### gst_clock_adjust_with_calibration

    GstClockTime
    gst_clock_adjust_with_calibration (GstClock * clock,
                                       GstClockTime internal_target,
                                       GstClockTime cinternal,
                                       GstClockTime cexternal,
                                       GstClockTime cnum,
                                       GstClockTime cdenom)

Converts the given internal_target clock time to the external time, using the passed calibration parameters. This function performs the same calculation as gst_clock_adjust_unlocked when called using the current calibration parameters, but doesn't ensure a monotonically increasing result as gst_clock_adjust_unlocked does.

Note: The clock parameter is unused and can be NULL

Parameters:

`clock` ( [nullable]) –

a GstClock to use

`internal_target` –

a clock time

`cinternal` –

a reference internal time

`cexternal` –

a reference external time

`cnum` –

the numerator of the rate of the clock relative to its internal time

`cdenom` –

the denominator of the rate of the clock

Returns –

the converted time of the clock.

Since : 1.6

#### Gst.Clock.prototype.adjust_with_calibration

    function Gst.Clock.prototype.adjust_with_calibration(internal_target: Number, cinternal: Number, cexternal: Number, cnum: Number, cdenom: Number): {
        // javascript wrapper for 'gst_clock_adjust_with_calibration'
    }

Converts the given internal_target clock time to the external time, using the passed calibration parameters. This function performs the same calculation as Gst.Clock.prototype.adjust_unlocked when called using the current calibration parameters, but doesn't ensure a monotonically increasing result as Gst.Clock.prototype.adjust_unlocked does.

Note: The clock parameter is unused and can be NULL

Parameters:

`clock` (Gst.Clock) –

a Gst.Clock to use

`internal_target` (Number) –

a clock time

`cinternal` (Number) –

a reference internal time

`cexternal` (Number) –

a reference external time

`cnum` (Number) –

the numerator of the rate of the clock relative to its internal time

`cdenom` (Number) –

the denominator of the rate of the clock

Returns (Number) –

the converted time of the clock.

Since : 1.6

#### Gst.Clock.adjust_with_calibration

    def Gst.Clock.adjust_with_calibration (self, internal_target, cinternal, cexternal, cnum, cdenom):
        #python wrapper for 'gst_clock_adjust_with_calibration'

Converts the given internal_target clock time to the external time, using the passed calibration parameters. This function performs the same calculation as Gst.Clock.adjust_unlocked when called using the current calibration parameters, but doesn't ensure a monotonically increasing result as Gst.Clock.adjust_unlocked does.

Note: The clock parameter is unused and can be NULL

Parameters:

`clock` (Gst.Clock) –

a Gst.Clock to use

`internal_target` (int) –

a clock time

`cinternal` (int) –

a reference internal time

`cexternal` (int) –

a reference external time

`cnum` (int) –

the numerator of the rate of the clock relative to its internal time

`cdenom` (int) –

the denominator of the rate of the clock

Returns (int) –

the converted time of the clock.

Since : 1.6

#### gst_clock_get_calibration

    gst_clock_get_calibration (GstClock * clock,
                               GstClockTime * internal,
                               GstClockTime * external,
                               GstClockTime * rate_num,
                               GstClockTime * rate_denom)

Gets the internal rate and reference time of clock. See gst_clock_set_calibration for more information.

internal, external, rate_num, and rate_denom can be left NULL if the caller is not interested in the values.

Parameters:

`clock` –

a GstClock

`internal` ( [out][optional]) –

a location to store the internal time

`external` ( [out][optional]) –

a location to store the external time

`rate_num` ( [out][optional]) –

a location to store the rate numerator

`rate_denom` ( [out][optional]) –

a location to store the rate denominator

#### Gst.Clock.prototype.get_calibration

    function Gst.Clock.prototype.get_calibration(): {
        // javascript wrapper for 'gst_clock_get_calibration'
    }

Gets the internal rate and reference time of clock. See Gst.Clock.prototype.set_calibration for more information.

internal, external, rate_num, and rate_denom can be left null if the caller is not interested in the values.

Parameters:

`clock` (Gst.Clock) –

a Gst.Clock

#### Gst.Clock.get_calibration

    def Gst.Clock.get_calibration (self):
        #python wrapper for 'gst_clock_get_calibration'

Gets the internal rate and reference time of clock. See Gst.Clock.set_calibration for more information.

internal, external, rate_num, and rate_denom can be left None if the caller is not interested in the values.

Parameters:

`clock` (Gst.Clock) –

a Gst.Clock

#### gst_clock_get_internal_time

    GstClockTime
    gst_clock_get_internal_time (GstClock * clock)

Gets the current internal time of the given clock. The time is returned unadjusted for the offset and the rate.

Parameters:

`clock` –

a GstClock to query

Returns –

the internal time of the clock. Or GST_CLOCK_TIME_NONE when given invalid input.

#### Gst.Clock.prototype.get_internal_time

    function Gst.Clock.prototype.get_internal_time(): {
        // javascript wrapper for 'gst_clock_get_internal_time'
    }

Gets the current internal time of the given clock. The time is returned unadjusted for the offset and the rate.

Parameters:

`clock` (Gst.Clock) –

a Gst.Clock to query

Returns (Number) –

the internal time of the clock. Or Gst.CLOCK_TIME_NONE when given invalid input.

#### Gst.Clock.get_internal_time

    def Gst.Clock.get_internal_time (self):
        #python wrapper for 'gst_clock_get_internal_time'

Gets the current internal time of the given clock. The time is returned unadjusted for the offset and the rate.

Parameters:

`clock` (Gst.Clock) –

a Gst.Clock to query

Returns (int) –

the internal time of the clock. Or Gst.CLOCK_TIME_NONE when given invalid input.

#### gst_clock_get_master

    GstClock *
    gst_clock_get_master (GstClock * clock)

Gets the master clock that clock is slaved to or NULL when the clock is not slaved to any master clock.

Parameters:

`clock` –

a GstClock

Returns ( [transfer: full][nullable]) –

a master GstClock or NULL when this clock is not slaved to a master clock.

#### Gst.Clock.prototype.get_master

    function Gst.Clock.prototype.get_master(): {
        // javascript wrapper for 'gst_clock_get_master'
    }

Gets the master clock that clock is slaved to or null when the clock is not slaved to any master clock.

Parameters:

`clock` (Gst.Clock) –

a Gst.Clock

Returns (Gst.Clock) –

a master Gst.Clock or null when this clock is not slaved to a master clock.

#### Gst.Clock.get_master

    def Gst.Clock.get_master (self):
        #python wrapper for 'gst_clock_get_master'

Gets the master clock that clock is slaved to or None when the clock is not slaved to any master clock.

Parameters:

`clock` (Gst.Clock) –

a Gst.Clock

Returns (Gst.Clock) –

a master Gst.Clock or None when this clock is not slaved to a master clock.

#### gst_clock_get_resolution

    GstClockTime
    gst_clock_get_resolution (GstClock * clock)

Gets the accuracy of the clock. The accuracy of the clock is the granularity of the values returned by gst_clock_get_time.

Parameters:

`clock` –

a GstClock

Returns –

the resolution of the clock in units of GstClockTime.

#### Gst.Clock.prototype.get_resolution

    function Gst.Clock.prototype.get_resolution(): {
        // javascript wrapper for 'gst_clock_get_resolution'
    }

Gets the accuracy of the clock. The accuracy of the clock is the granularity of the values returned by Gst.Clock.prototype.get_time.

Parameters:

`clock` (Gst.Clock) –

a Gst.Clock

Returns (Number) –

the resolution of the clock in units of Number.

#### Gst.Clock.get_resolution

    def Gst.Clock.get_resolution (self):
        #python wrapper for 'gst_clock_get_resolution'

Gets the accuracy of the clock. The accuracy of the clock is the granularity of the values returned by Gst.Clock.get_time.

Parameters:

`clock` (Gst.Clock) –

a Gst.Clock

Returns (int) –

the resolution of the clock in units of int.

#### gst_clock_get_time

    GstClockTime
    gst_clock_get_time (GstClock * clock)

Gets the current time of the given clock. The time is always monotonically increasing and adjusted according to the current offset and rate.

Parameters:

`clock` –

a GstClock to query

Returns –

the time of the clock. Or GST_CLOCK_TIME_NONE when given invalid input.

#### Gst.Clock.prototype.get_time

    function Gst.Clock.prototype.get_time(): {
        // javascript wrapper for 'gst_clock_get_time'
    }

Gets the current time of the given clock. The time is always monotonically increasing and adjusted according to the current offset and rate.

Parameters:

`clock` (Gst.Clock) –

a Gst.Clock to query

Returns (Number) –

the time of the clock. Or Gst.CLOCK_TIME_NONE when given invalid input.

#### Gst.Clock.get_time

    def Gst.Clock.get_time (self):
        #python wrapper for 'gst_clock_get_time'

Gets the current time of the given clock. The time is always monotonically increasing and adjusted according to the current offset and rate.

Parameters:

`clock` (Gst.Clock) –

a Gst.Clock to query

Returns (int) –

the time of the clock. Or Gst.CLOCK_TIME_NONE when given invalid input.

#### gst_clock_get_timeout

    GstClockTime
    gst_clock_get_timeout (GstClock * clock)

Gets the amount of time that master and slave clocks are sampled.

Parameters:

`clock` –

a GstClock

Returns –

the interval between samples.

#### Gst.Clock.prototype.get_timeout

    function Gst.Clock.prototype.get_timeout(): {
        // javascript wrapper for 'gst_clock_get_timeout'
    }

Gets the amount of time that master and slave clocks are sampled.

Parameters:

`clock` (Gst.Clock) –

a Gst.Clock

Returns (Number) –

the interval between samples.

#### Gst.Clock.get_timeout

    def Gst.Clock.get_timeout (self):
        #python wrapper for 'gst_clock_get_timeout'

Gets the amount of time that master and slave clocks are sampled.

Parameters:

`clock` (Gst.Clock) –

a Gst.Clock

Returns (int) –

the interval between samples.

#### gst_clock_is_synced

    gboolean
    gst_clock_is_synced (GstClock * clock)

Checks if the clock is currently synced, by looking at whether GST_CLOCK_FLAG_NEEDS_STARTUP_SYNC is set.

Parameters:

`clock` –

a GstClock

Returns –

TRUE if the clock is currently synced

Since : 1.6

#### Gst.Clock.prototype.is_synced

    function Gst.Clock.prototype.is_synced(): {
        // javascript wrapper for 'gst_clock_is_synced'
    }

Checks if the clock is currently synced, by looking at whether Gst.ClockFlags.NEEDS_STARTUP_SYNC is set.

Parameters:

`clock` (Gst.Clock) –

a GstClock

Returns (Number) –

true if the clock is currently synced

Since : 1.6

#### Gst.Clock.is_synced

    def Gst.Clock.is_synced (self):
        #python wrapper for 'gst_clock_is_synced'

Checks if the clock is currently synced, by looking at whether Gst.ClockFlags.NEEDS_STARTUP_SYNC is set.

Parameters:

`clock` (Gst.Clock) –

a GstClock

Returns (bool) –

True if the clock is currently synced

Since : 1.6

#### gst_clock_is_system_monotonic

    gboolean
    gst_clock_is_system_monotonic (GstClock * clock)

Checks that clock is the default system clock, as returned by gst_system_clock_obtain, and is of type GST_CLOCK_TYPE_MONOTONIC.

Parameters:

`clock` –

a GstClock

Returns –

TRUE if clock is the default system monotonic clock, FALSE otherwise.

Since : 1.28

#### Gst.Clock.prototype.is_system_monotonic

    function Gst.Clock.prototype.is_system_monotonic(): {
        // javascript wrapper for 'gst_clock_is_system_monotonic'
    }

Checks that clock is the default system clock, as returned by Gst.SystemClock.prototype.obtain, and is of type Gst.ClockType.MONOTONIC.

Parameters:

`clock` (Gst.Clock) –

a Gst.Clock

Returns (Number) –

true if clock is the default system monotonic clock, false otherwise.

Since : 1.28

#### Gst.Clock.is_system_monotonic

    def Gst.Clock.is_system_monotonic (self):
        #python wrapper for 'gst_clock_is_system_monotonic'

Checks that clock is the default system clock, as returned by Gst.SystemClock.obtain, and is of type Gst.ClockType.MONOTONIC.

Parameters:

`clock` (Gst.Clock) –

a Gst.Clock

Returns (bool) –

True if clock is the default system monotonic clock, False otherwise.

Since : 1.28

#### gst_clock_new_periodic_id

    GstClockID
    gst_clock_new_periodic_id (GstClock * clock,
                               GstClockTime start_time,
                               GstClockTime interval)

Gets an ID from clock to trigger a periodic notification. The periodic notifications will start at time start_time and will then be fired with the given interval.

Parameters:

`clock` –

The GstClockID to get a periodic notification id from

`start_time` –

the requested start time

`interval` –

the requested interval

Returns ( [transfer: full]) –

a GstClockID that can be used to request the time notification.

#### Gst.Clock.prototype.new_periodic_id

    function Gst.Clock.prototype.new_periodic_id(start_time: Number, interval: Number): {
        // javascript wrapper for 'gst_clock_new_periodic_id'
    }

Gets an ID from clock to trigger a periodic notification. The periodic notifications will start at time start_time and will then be fired with the given interval.

Parameters:

`clock` (Gst.Clock) –

The Object to get a periodic notification id from

`start_time` (Number) –

the requested start time

`interval` (Number) –

the requested interval

Returns (Object) –

a Object that can be used to request the time notification.

#### Gst.Clock.new_periodic_id

    def Gst.Clock.new_periodic_id (self, start_time, interval):
        #python wrapper for 'gst_clock_new_periodic_id'

Gets an ID from clock to trigger a periodic notification. The periodic notifications will start at time start_time and will then be fired with the given interval.

Parameters:

`clock` (Gst.Clock) –

The object to get a periodic notification id from

`start_time` (int) –

the requested start time

`interval` (int) –

the requested interval

Returns (object) –

a object that can be used to request the time notification.

#### gst_clock_new_single_shot_id

    GstClockID
    gst_clock_new_single_shot_id (GstClock * clock,
                                  GstClockTime time)

Gets a GstClockID from clock to trigger a single shot notification at the requested time.

Parameters:

`clock` –

The GstClockID to get a single shot notification from

`time` –

the requested time

Returns ( [transfer: full]) –

a GstClockID that can be used to request the time notification.

#### Gst.Clock.prototype.new_single_shot_id

    function Gst.Clock.prototype.new_single_shot_id(time: Number): {
        // javascript wrapper for 'gst_clock_new_single_shot_id'
    }

Gets a Object from clock to trigger a single shot notification at the requested time.

Parameters:

`clock` (Gst.Clock) –

The Object to get a single shot notification from

`time` (Number) –

the requested time

Returns (Object) –

a Object that can be used to request the time notification.

#### Gst.Clock.new_single_shot_id

    def Gst.Clock.new_single_shot_id (self, time):
        #python wrapper for 'gst_clock_new_single_shot_id'

Gets a object from clock to trigger a single shot notification at the requested time.

Parameters:

`clock` (Gst.Clock) –

The object to get a single shot notification from

`time` (int) –

the requested time

Returns (object) –

a object that can be used to request the time notification.

#### gst_clock_periodic_id_reinit

    gboolean
    gst_clock_periodic_id_reinit (GstClock * clock,
                                  GstClockID id,
                                  GstClockTime start_time,
                                  GstClockTime interval)

Reinitializes the provided periodic id to the provided start time and interval. Does not modify the reference count.

Parameters:

`clock` –

a GstClock

`id` –

a GstClockID

`start_time` –

the requested start time

`interval` –

the requested interval

Returns –

TRUE if the GstClockID could be reinitialized to the provided time, else FALSE.

#### Gst.Clock.prototype.periodic_id_reinit

    function Gst.Clock.prototype.periodic_id_reinit(id: Object, start_time: Number, interval: Number): {
        // javascript wrapper for 'gst_clock_periodic_id_reinit'
    }

Reinitializes the provided periodic id to the provided start time and interval. Does not modify the reference count.

Parameters:

`clock` (Gst.Clock) –

a Gst.Clock

`id` (Object) –

a Object

`start_time` (Number) –

the requested start time

`interval` (Number) –

the requested interval

Returns (Number) –

true if the GstClockID could be reinitialized to the provided time, else false.

#### Gst.Clock.periodic_id_reinit

    def Gst.Clock.periodic_id_reinit (self, id, start_time, interval):
        #python wrapper for 'gst_clock_periodic_id_reinit'

Reinitializes the provided periodic id to the provided start time and interval. Does not modify the reference count.

Parameters:

`clock` (Gst.Clock) –

a Gst.Clock

`id` (object) –

a object

`start_time` (int) –

the requested start time

`interval` (int) –

the requested interval

Returns (bool) –

True if the GstClockID could be reinitialized to the provided time, else False.

#### gst_clock_set_calibration

    gst_clock_set_calibration (GstClock * clock,
                               GstClockTime internal,
                               GstClockTime external,
                               GstClockTime rate_num,
                               GstClockTime rate_denom)

Adjusts the rate and time of clock. A rate of 1/1 is the normal speed of the clock. Values bigger than 1/1 make the clock go faster.

internal and external are calibration parameters that arrange that gst_clock_get_time should have been external at internal time internal. This internal time should not be in the future; that is, it should be less than the value of gst_clock_get_internal_time when this function is called.

Subsequent calls to gst_clock_get_time will return clock times computed as follows:

      time = (internal_time - internal) * rate_num / rate_denom + external

This formula is implemented in gst_clock_adjust_unlocked. Of course, it tries to do the integer arithmetic as precisely as possible.

Note that gst_clock_get_time always returns increasing values so when you move the clock backwards, gst_clock_get_time will report the previous value until the clock catches up.

Parameters:

`clock` –

a GstClock to calibrate

`internal` –

a reference internal time

`external` –

a reference external time

`rate_num` –

the numerator of the rate of the clock relative to its internal time

`rate_denom` –

the denominator of the rate of the clock

#### Gst.Clock.prototype.set_calibration

    function Gst.Clock.prototype.set_calibration(internal: Number, external: Number, rate_num: Number, rate_denom: Number): {
        // javascript wrapper for 'gst_clock_set_calibration'
    }

Adjusts the rate and time of clock. A rate of 1/1 is the normal speed of the clock. Values bigger than 1/1 make the clock go faster.

internal and external are calibration parameters that arrange that Gst.Clock.prototype.get_time should have been external at internal time internal. This internal time should not be in the future; that is, it should be less than the value of Gst.Clock.prototype.get_internal_time when this function is called.

Subsequent calls to Gst.Clock.prototype.get_time will return clock times computed as follows:

      time = (internal_time - internal) * rate_num / rate_denom + external

This formula is implemented in Gst.Clock.prototype.adjust_unlocked. Of course, it tries to do the integer arithmetic as precisely as possible.

Note that Gst.Clock.prototype.get_time always returns increasing values so when you move the clock backwards, Gst.Clock.prototype.get_time will report the previous value until the clock catches up.

Parameters:

`clock` (Gst.Clock) –

a Gst.Clock to calibrate

`internal` (Number) –

a reference internal time

`external` (Number) –

a reference external time

`rate_num` (Number) –

the numerator of the rate of the clock relative to its internal time

`rate_denom` (Number) –

the denominator of the rate of the clock

#### Gst.Clock.set_calibration

    def Gst.Clock.set_calibration (self, internal, external, rate_num, rate_denom):
        #python wrapper for 'gst_clock_set_calibration'

Adjusts the rate and time of clock. A rate of 1/1 is the normal speed of the clock. Values bigger than 1/1 make the clock go faster.

internal and external are calibration parameters that arrange that Gst.Clock.get_time should have been external at internal time internal. This internal time should not be in the future; that is, it should be less than the value of Gst.Clock.get_internal_time when this function is called.

Subsequent calls to Gst.Clock.get_time will return clock times computed as follows:

      time = (internal_time - internal) * rate_num / rate_denom + external

This formula is implemented in Gst.Clock.adjust_unlocked. Of course, it tries to do the integer arithmetic as precisely as possible.

Note that Gst.Clock.get_time always returns increasing values so when you move the clock backwards, Gst.Clock.get_time will report the previous value until the clock catches up.

Parameters:

`clock` (Gst.Clock) –

a Gst.Clock to calibrate

`internal` (int) –

a reference internal time

`external` (int) –

a reference external time

`rate_num` (int) –

the numerator of the rate of the clock relative to its internal time

`rate_denom` (int) –

the denominator of the rate of the clock

#### gst_clock_set_master

    gboolean
    gst_clock_set_master (GstClock * clock,
                          GstClock * master)

Sets master as the master clock for clock. clock will be automatically calibrated so that gst_clock_get_time reports the same time as the master clock.

A clock provider that slaves its clock to a master can get the current calibration values with gst_clock_get_calibration.

master can be NULL in which case clock will not be slaved anymore. It will however keep reporting its time adjusted with the last configured rate and time offsets.

Parameters:

`clock` –

a GstClock

`master` ( [nullable]) –

a master GstClock

Returns –

TRUE if the clock is capable of being slaved to a master clock. Trying to set a master on a clock without the GST_CLOCK_FLAG_CAN_SET_MASTER flag will make this function return FALSE.

#### Gst.Clock.prototype.set_master

    function Gst.Clock.prototype.set_master(master: Gst.Clock): {
        // javascript wrapper for 'gst_clock_set_master'
    }

Sets master as the master clock for clock. clock will be automatically calibrated so that Gst.Clock.prototype.get_time reports the same time as the master clock.

A clock provider that slaves its clock to a master can get the current calibration values with Gst.Clock.prototype.get_calibration.

master can be null in which case clock will not be slaved anymore. It will however keep reporting its time adjusted with the last configured rate and time offsets.

Parameters:

`clock` (Gst.Clock) –

a Gst.Clock

`master` (Gst.Clock) –

a master Gst.Clock

Returns (Number) –

true if the clock is capable of being slaved to a master clock. Trying to set a master on a clock without the Gst.ClockFlags.CAN_SET_MASTER flag will make this function return false.

#### Gst.Clock.set_master

    def Gst.Clock.set_master (self, master):
        #python wrapper for 'gst_clock_set_master'

Sets master as the master clock for clock. clock will be automatically calibrated so that Gst.Clock.get_time reports the same time as the master clock.

A clock provider that slaves its clock to a master can get the current calibration values with Gst.Clock.get_calibration.

master can be None in which case clock will not be slaved anymore. It will however keep reporting its time adjusted with the last configured rate and time offsets.

Parameters:

`clock` (Gst.Clock) –

a Gst.Clock

`master` (Gst.Clock) –

a master Gst.Clock

Returns (bool) –

True if the clock is capable of being slaved to a master clock. Trying to set a master on a clock without the Gst.ClockFlags.CAN_SET_MASTER flag will make this function return False.

#### gst_clock_set_resolution

    GstClockTime
    gst_clock_set_resolution (GstClock * clock,
                              GstClockTime resolution)

Sets the accuracy of the clock. Some clocks have the possibility to operate with different accuracy at the expense of more resource usage. There is normally no need to change the default resolution of a clock. The resolution of a clock can only be changed if the clock has the GST_CLOCK_FLAG_CAN_SET_RESOLUTION flag set.

Parameters:

`clock` –

a GstClock

`resolution` –

The resolution to set

Returns –

the new resolution of the clock.

#### Gst.Clock.prototype.set_resolution

    function Gst.Clock.prototype.set_resolution(resolution: Number): {
        // javascript wrapper for 'gst_clock_set_resolution'
    }

Sets the accuracy of the clock. Some clocks have the possibility to operate with different accuracy at the expense of more resource usage. There is normally no need to change the default resolution of a clock. The resolution of a clock can only be changed if the clock has the Gst.ClockFlags.CAN_SET_RESOLUTION flag set.

Parameters:

`clock` (Gst.Clock) –

a Gst.Clock

`resolution` (Number) –

The resolution to set

Returns (Number) –

the new resolution of the clock.

#### Gst.Clock.set_resolution

    def Gst.Clock.set_resolution (self, resolution):
        #python wrapper for 'gst_clock_set_resolution'

Sets the accuracy of the clock. Some clocks have the possibility to operate with different accuracy at the expense of more resource usage. There is normally no need to change the default resolution of a clock. The resolution of a clock can only be changed if the clock has the Gst.ClockFlags.CAN_SET_RESOLUTION flag set.

Parameters:

`clock` (Gst.Clock) –

a Gst.Clock

`resolution` (int) –

The resolution to set

Returns (int) –

the new resolution of the clock.

#### gst_clock_set_synced

    gst_clock_set_synced (GstClock * clock,
                          gboolean synced)

Sets clock to synced and emits the synced signal, and wakes up any thread waiting in gst_clock_wait_for_sync.

This function must only be called if GST_CLOCK_FLAG_NEEDS_STARTUP_SYNC is set on the clock, and is intended to be called by subclasses only.

Parameters:

`clock` –

a GstClock

`synced` –

if the clock is synced

Since : 1.6

#### Gst.Clock.prototype.set_synced

    function Gst.Clock.prototype.set_synced(synced: Number): {
        // javascript wrapper for 'gst_clock_set_synced'
    }

Sets clock to synced and emits the synced signal, and wakes up any thread waiting in Gst.Clock.prototype.wait_for_sync.

This function must only be called if Gst.ClockFlags.NEEDS_STARTUP_SYNC is set on the clock, and is intended to be called by subclasses only.

Parameters:

`clock` (Gst.Clock) –

a GstClock

`synced` (Number) –

if the clock is synced

Since : 1.6

#### Gst.Clock.set_synced

    def Gst.Clock.set_synced (self, synced):
        #python wrapper for 'gst_clock_set_synced'

Sets clock to synced and emits the synced signal, and wakes up any thread waiting in Gst.Clock.wait_for_sync.

This function must only be called if Gst.ClockFlags.NEEDS_STARTUP_SYNC is set on the clock, and is intended to be called by subclasses only.

Parameters:

`clock` (Gst.Clock) –

a GstClock

`synced` (bool) –

if the clock is synced

Since : 1.6

#### gst_clock_set_timeout

    gst_clock_set_timeout (GstClock * clock,
                           GstClockTime timeout)

Sets the amount of time, in nanoseconds, to sample master and slave clocks

Parameters:

`clock` –

a GstClock

`timeout` –

a timeout

#### Gst.Clock.prototype.set_timeout

    function Gst.Clock.prototype.set_timeout(timeout: Number): {
        // javascript wrapper for 'gst_clock_set_timeout'
    }

Sets the amount of time, in nanoseconds, to sample master and slave clocks

Parameters:

`clock` (Gst.Clock) –

a Gst.Clock

`timeout` (Number) –

a timeout

#### Gst.Clock.set_timeout

    def Gst.Clock.set_timeout (self, timeout):
        #python wrapper for 'gst_clock_set_timeout'

Sets the amount of time, in nanoseconds, to sample master and slave clocks

Parameters:

`clock` (Gst.Clock) –

a Gst.Clock

`timeout` (int) –

a timeout

#### gst_clock_single_shot_id_reinit

    gboolean
    gst_clock_single_shot_id_reinit (GstClock * clock,
                                     GstClockID id,
                                     GstClockTime time)

Reinitializes the provided single shot id to the provided time. Does not modify the reference count.

Parameters:

`clock` –

a GstClock

`id` –

a GstClockID

`time` –

The requested time.

Returns –

TRUE if the GstClockID could be reinitialized to the provided time, else FALSE.

#### Gst.Clock.prototype.single_shot_id_reinit

    function Gst.Clock.prototype.single_shot_id_reinit(id: Object, time: Number): {
        // javascript wrapper for 'gst_clock_single_shot_id_reinit'
    }

Reinitializes the provided single shot id to the provided time. Does not modify the reference count.

Parameters:

`clock` (Gst.Clock) –

a Gst.Clock

`id` (Object) –

a Object

`time` (Number) –

The requested time.

Returns (Number) –

true if the GstClockID could be reinitialized to the provided time, else false.

#### Gst.Clock.single_shot_id_reinit

    def Gst.Clock.single_shot_id_reinit (self, id, time):
        #python wrapper for 'gst_clock_single_shot_id_reinit'

Reinitializes the provided single shot id to the provided time. Does not modify the reference count.

Parameters:

`clock` (Gst.Clock) –

a Gst.Clock

`id` (object) –

a object

`time` (int) –

The requested time.

Returns (bool) –

True if the GstClockID could be reinitialized to the provided time, else False.

#### gst_clock_unadjust_unlocked

    GstClockTime
    gst_clock_unadjust_unlocked (GstClock * clock,
                                 GstClockTime external)

Converts the given external clock time to the internal time of clock, using the rate and reference time set with gst_clock_set_calibration. This function should be called with the clock's OBJECT_LOCK held and is mainly used by clock subclasses.

This function is the reverse of gst_clock_adjust_unlocked.

Parameters:

`clock` –

a GstClock to use

`external` –

an external clock time

Returns –

the internal time of the clock corresponding to external.

#### Gst.Clock.prototype.unadjust_unlocked

    function Gst.Clock.prototype.unadjust_unlocked(external: Number): {
        // javascript wrapper for 'gst_clock_unadjust_unlocked'
    }

Converts the given external clock time to the internal time of clock, using the rate and reference time set with Gst.Clock.prototype.set_calibration. This function should be called with the clock's OBJECT_LOCK held and is mainly used by clock subclasses.

This function is the reverse of Gst.Clock.prototype.adjust_unlocked.

Parameters:

`clock` (Gst.Clock) –

a Gst.Clock to use

`external` (Number) –

an external clock time

Returns (Number) –

the internal time of the clock corresponding to external.

#### Gst.Clock.unadjust_unlocked

    def Gst.Clock.unadjust_unlocked (self, external):
        #python wrapper for 'gst_clock_unadjust_unlocked'

Converts the given external clock time to the internal time of clock, using the rate and reference time set with Gst.Clock.set_calibration. This function should be called with the clock's OBJECT_LOCK held and is mainly used by clock subclasses.

This function is the reverse of Gst.Clock.adjust_unlocked.

Parameters:

`clock` (Gst.Clock) –

a Gst.Clock to use

`external` (int) –

an external clock time

Returns (int) –

the internal time of the clock corresponding to external.

#### gst_clock_unadjust_with_calibration

    GstClockTime
    gst_clock_unadjust_with_calibration (GstClock * clock,
                                         GstClockTime external_target,
                                         GstClockTime cinternal,
                                         GstClockTime cexternal,
                                         GstClockTime cnum,
                                         GstClockTime cdenom)

Converts the given external_target clock time to the internal time, using the passed calibration parameters. This function performs the same calculation as gst_clock_unadjust_unlocked when called using the current calibration parameters.

Note: The clock parameter is unused and can be NULL

Parameters:

`clock` ( [nullable]) –

a GstClock to use

`external_target` –

a clock time

`cinternal` –

a reference internal time

`cexternal` –

a reference external time

`cnum` –

the numerator of the rate of the clock relative to its internal time

`cdenom` –

the denominator of the rate of the clock

Returns –

the converted time of the clock.

Since : 1.8

#### Gst.Clock.prototype.unadjust_with_calibration

    function Gst.Clock.prototype.unadjust_with_calibration(external_target: Number, cinternal: Number, cexternal: Number, cnum: Number, cdenom: Number): {
        // javascript wrapper for 'gst_clock_unadjust_with_calibration'
    }

Converts the given external_target clock time to the internal time, using the passed calibration parameters. This function performs the same calculation as Gst.Clock.prototype.unadjust_unlocked when called using the current calibration parameters.

Note: The clock parameter is unused and can be NULL

Parameters:

`clock` (Gst.Clock) –

a Gst.Clock to use

`external_target` (Number) –

a clock time

`cinternal` (Number) –

a reference internal time

`cexternal` (Number) –

a reference external time

`cnum` (Number) –

the numerator of the rate of the clock relative to its internal time

`cdenom` (Number) –

the denominator of the rate of the clock

Returns (Number) –

the converted time of the clock.

Since : 1.8

#### Gst.Clock.unadjust_with_calibration

    def Gst.Clock.unadjust_with_calibration (self, external_target, cinternal, cexternal, cnum, cdenom):
        #python wrapper for 'gst_clock_unadjust_with_calibration'

Converts the given external_target clock time to the internal time, using the passed calibration parameters. This function performs the same calculation as Gst.Clock.unadjust_unlocked when called using the current calibration parameters.

Note: The clock parameter is unused and can be NULL

Parameters:

`clock` (Gst.Clock) –

a Gst.Clock to use

`external_target` (int) –

a clock time

`cinternal` (int) –

a reference internal time

`cexternal` (int) –

a reference external time

`cnum` (int) –

the numerator of the rate of the clock relative to its internal time

`cdenom` (int) –

the denominator of the rate of the clock

Returns (int) –

the converted time of the clock.

Since : 1.8

#### gst_clock_wait_for_sync

    gboolean
    gst_clock_wait_for_sync (GstClock * clock,
                             GstClockTime timeout)

Waits until clock is synced for reporting the current time. If timeout is GST_CLOCK_TIME_NONE it will wait forever, otherwise it will time out after timeout nanoseconds.

For asynchronous waiting, the synced signal can be used.

This returns immediately with TRUE if GST_CLOCK_FLAG_NEEDS_STARTUP_SYNC is not set on the clock, or if the clock is already synced.

Parameters:

`clock` –

a GstClock

`timeout` –

timeout for waiting or GST_CLOCK_TIME_NONE

Returns –

TRUE if waiting was successful, or FALSE on timeout

Since : 1.6

#### Gst.Clock.prototype.wait_for_sync

    function Gst.Clock.prototype.wait_for_sync(timeout: Number): {
        // javascript wrapper for 'gst_clock_wait_for_sync'
    }

Waits until clock is synced for reporting the current time. If timeout is Gst.CLOCK_TIME_NONE it will wait forever, otherwise it will time out after timeout nanoseconds.

For asynchronous waiting, the synced signal can be used.

This returns immediately with true if Gst.ClockFlags.NEEDS_STARTUP_SYNC is not set on the clock, or if the clock is already synced.

Parameters:

`clock` (Gst.Clock) –

a GstClock

`timeout` (Number) –

timeout for waiting or Gst.CLOCK_TIME_NONE

Returns (Number) –

true if waiting was successful, or false on timeout

Since : 1.6

#### Gst.Clock.wait_for_sync

    def Gst.Clock.wait_for_sync (self, timeout):
        #python wrapper for 'gst_clock_wait_for_sync'

Waits until clock is synced for reporting the current time. If timeout is Gst.CLOCK_TIME_NONE it will wait forever, otherwise it will time out after timeout nanoseconds.

For asynchronous waiting, the synced signal can be used.

This returns immediately with True if Gst.ClockFlags.NEEDS_STARTUP_SYNC is not set on the clock, or if the clock is already synced.

Parameters:

`clock` (Gst.Clock) –

a GstClock

`timeout` (int) –

timeout for waiting or Gst.CLOCK_TIME_NONE

Returns (bool) –

True if waiting was successful, or False on timeout

Since : 1.6

### Functions

#### gst_clock_id_compare_func

    gint
    gst_clock_id_compare_func (gconstpointer id1,
                               gconstpointer id2)

Compares the two GstClockID instances. This function can be used as a GCompareFunc when sorting ids.

Parameters:

`id1` –

A GstClockID

`id2` –

A GstClockID to compare with

Returns –

negative value if `a < b`; zero if `a = b`; positive value if `a > b`

#### Gst.Clock.prototype.id_compare_func

    function Gst.Clock.prototype.id_compare_func(id1: Object, id2: Object): {
        // javascript wrapper for 'gst_clock_id_compare_func'
    }

Compares the two Object instances. This function can be used as a GCompareFunc when sorting ids.

Parameters:

`id1` (Object) –

A Object

`id2` (Object) –

A Object to compare with

Returns (Number) –

negative value if `a < b`; zero if `a = b`; positive value if `a > b`

#### Gst.Clock.id_compare_func

    def Gst.Clock.id_compare_func (id1, id2):
        #python wrapper for 'gst_clock_id_compare_func'

Compares the two object instances. This function can be used as a GCompareFunc when sorting ids.

Parameters:

`id1` (object) –

A object

`id2` (object) –

A object to compare with

Returns (int) –

negative value if `a < b`; zero if `a = b`; positive value if `a > b`

#### gst_clock_id_get_clock

    GstClock *
    gst_clock_id_get_clock (GstClockID id)

This function returns the underlying clock.

Parameters:

`id` –

a GstClockID

Returns ( [transfer: full][nullable]) –

a GstClock or NULL when the underlying clock has been freed.

Since : 1.16

#### Gst.Clock.prototype.id_get_clock

    function Gst.Clock.prototype.id_get_clock(id: Object): {
        // javascript wrapper for 'gst_clock_id_get_clock'
    }

This function returns the underlying clock.

Parameters:

`id` (Object) –

a Object

Returns (Gst.Clock) –

a Gst.Clock or null when the underlying clock has been freed.

Since : 1.16

#### Gst.Clock.id_get_clock

    def Gst.Clock.id_get_clock (id):
        #python wrapper for 'gst_clock_id_get_clock'

This function returns the underlying clock.

Parameters:

`id` (object) –

a object

Returns (Gst.Clock) –

a Gst.Clock or None when the underlying clock has been freed.

Since : 1.16

#### gst_clock_id_get_time

    GstClockTime
    gst_clock_id_get_time (GstClockID id)

Gets the time of the clock ID

Parameters:

`id` –

The GstClockID to query

Returns –

the time of the given clock id.

#### Gst.Clock.prototype.id_get_time

    function Gst.Clock.prototype.id_get_time(id: Object): {
        // javascript wrapper for 'gst_clock_id_get_time'
    }

Gets the time of the clock ID

Parameters:

`id` (Object) –

The Object to query

Returns (Number) –

the time of the given clock id.

#### Gst.Clock.id_get_time

    def Gst.Clock.id_get_time (id):
        #python wrapper for 'gst_clock_id_get_time'

Gets the time of the clock ID

Parameters:

`id` (object) –

The object to query

Returns (int) –

the time of the given clock id.

#### gst_clock_id_ref

    GstClockID
    gst_clock_id_ref (GstClockID id)

Increases the refcount of given id.

Parameters:

`id` –

The GstClockID to ref

Returns ( [transfer: full]) –

The same GstClockID with increased refcount.

#### Gst.Clock.prototype.id_ref

    function Gst.Clock.prototype.id_ref(id: Object): {
        // javascript wrapper for 'gst_clock_id_ref'
    }

Increases the refcount of given id.

Parameters:

`id` (Object) –

The Object to ref

Returns (Object) –

The same Object with increased refcount.

#### Gst.Clock.id_ref

    def Gst.Clock.id_ref (id):
        #python wrapper for 'gst_clock_id_ref'

Increases the refcount of given id.

Parameters:

`id` (object) –

The object to ref

Returns (object) –

The same object with increased refcount.

#### gst_clock_id_unref

    gst_clock_id_unref (GstClockID id)

Unrefs given id. When the refcount reaches 0 the GstClockID will be freed.

Parameters:

`id` ( [transfer: full]) –

The GstClockID to unref

#### Gst.Clock.prototype.id_unref

    function Gst.Clock.prototype.id_unref(id: Object): {
        // javascript wrapper for 'gst_clock_id_unref'
    }

Unrefs given id. When the refcount reaches 0 the Object will be freed.

Parameters:

`id` (Object) –

The Object to unref

#### Gst.Clock.id_unref

    def Gst.Clock.id_unref (id):
        #python wrapper for 'gst_clock_id_unref'

Unrefs given id. When the refcount reaches 0 the object will be freed.

Parameters:

`id` (object) –

The object to unref

#### gst_clock_id_unschedule

    gst_clock_id_unschedule (GstClockID id)

Cancels an outstanding request with id. This can either be an outstanding async notification or a pending sync notification. After this call, id cannot be used anymore to receive sync or async notifications, you need to create a new GstClockID.

Parameters:

`id` –

The id to unschedule

#### Gst.Clock.prototype.id_unschedule

    function Gst.Clock.prototype.id_unschedule(id: Object): {
        // javascript wrapper for 'gst_clock_id_unschedule'
    }

Cancels an outstanding request with id. This can either be an outstanding async notification or a pending sync notification. After this call, id cannot be used anymore to receive sync or async notifications, you need to create a new Object.

Parameters:

`id` (Object) –

The id to unschedule

#### Gst.Clock.id_unschedule

    def Gst.Clock.id_unschedule (id):
        #python wrapper for 'gst_clock_id_unschedule'

Cancels an outstanding request with id. This can either be an outstanding async notification or a pending sync notification. After this call, id cannot be used anymore to receive sync or async notifications, you need to create a new object.

Parameters:

`id` (object) –

The id to unschedule

#### gst_clock_id_uses_clock

    gboolean
    gst_clock_id_uses_clock (GstClockID id,
                             GstClock * clock)

This function returns whether id uses clock as the underlying clock. clock can be NULL, in which case the return value indicates whether the underlying clock has been freed. If this is the case, the id is no longer usable and should be freed.

Parameters:

`id` –

a GstClockID to check

`clock` –

a GstClock to compare against

Returns –

whether the clock id uses the same underlying GstClock clock.

Since : 1.16

#### Gst.Clock.prototype.id_uses_clock

    function Gst.Clock.prototype.id_uses_clock(id: Object, clock: Gst.Clock): {
        // javascript wrapper for 'gst_clock_id_uses_clock'
    }

This function returns whether id uses clock as the underlying clock. clock can be NULL, in which case the return value indicates whether the underlying clock has been freed. If this is the case, the id is no longer usable and should be freed.

Parameters:

`id` (Object) –

a Object to check

`clock` (Gst.Clock) –

a Gst.Clock to compare against

Returns (Number) –

whether the clock id uses the same underlying Gst.Clock clock.

Since : 1.16

#### Gst.Clock.id_uses_clock

    def Gst.Clock.id_uses_clock (id, clock):
        #python wrapper for 'gst_clock_id_uses_clock'

This function returns whether id uses clock as the underlying clock. clock can be NULL, in which case the return value indicates whether the underlying clock has been freed. If this is the case, the id is no longer usable and should be freed.

Parameters:

`id` (object) –

a object to check

`clock` (Gst.Clock) –

a Gst.Clock to compare against

Returns (bool) –

whether the clock id uses the same underlying Gst.Clock clock.

Since : 1.16

#### gst_clock_id_wait

    GstClockReturn
    gst_clock_id_wait (GstClockID id,
                       GstClockTimeDiff * jitter)

Performs a blocking wait on id. id should have been created with gst_clock_new_single_shot_id or gst_clock_new_periodic_id and should not have been unscheduled with a call to gst_clock_id_unschedule.

If the jitter argument is not NULL and this function returns GST_CLOCK_OK or GST_CLOCK_EARLY, it will contain the difference against the clock and the time of id when this method was called. Positive values indicate how late id was relative to the clock (in which case this function will return GST_CLOCK_EARLY). Negative values indicate how much time was spent waiting on the clock before this function returned.

Parameters:

`id` –

The GstClockID to wait on

`jitter` ( [out][optional]) –

a pointer that will contain the jitter, can be NULL.

Returns –

the result of the blocking wait. GST_CLOCK_EARLY will be returned if the current clock time is past the time of id, GST_CLOCK_OK if id was scheduled in time. GST_CLOCK_UNSCHEDULED if id was unscheduled with gst_clock_id_unschedule.

#### Gst.Clock.prototype.id_wait

    function Gst.Clock.prototype.id_wait(id: Object): {
        // javascript wrapper for 'gst_clock_id_wait'
    }

Performs a blocking wait on id. id should have been created with Gst.Clock.prototype.new_single_shot_id or Gst.Clock.prototype.new_periodic_id and should not have been unscheduled with a call to Gst.Clock.prototype.id_unschedule.

If the jitter argument is not null and this function returns Gst.ClockReturn.OK or Gst.ClockReturn.EARLY, it will contain the difference against the clock and the time of id when this method was called. Positive values indicate how late id was relative to the clock (in which case this function will return Gst.ClockReturn.EARLY). Negative values indicate how much time was spent waiting on the clock before this function returned.

Parameters:

`id` (Object) –

The Object to wait on

Returns a tuple made of:

(Gst.ClockReturn ) –

the result of the blocking wait. Gst.ClockReturn.EARLY will be returned if the current clock time is past the time of id, Gst.ClockReturn.OK if id was scheduled in time. Gst.ClockReturn.UNSCHEDULED if id was unscheduled with Gst.Clock.prototype.id_unschedule.

`jitter` (Number ) –

the result of the blocking wait. Gst.ClockReturn.EARLY will be returned if the current clock time is past the time of id, Gst.ClockReturn.OK if id was scheduled in time. Gst.ClockReturn.UNSCHEDULED if id was unscheduled with Gst.Clock.prototype.id_unschedule.

#### Gst.Clock.id_wait

    def Gst.Clock.id_wait (id):
        #python wrapper for 'gst_clock_id_wait'

Performs a blocking wait on id. id should have been created with Gst.Clock.new_single_shot_id or Gst.Clock.new_periodic_id and should not have been unscheduled with a call to Gst.Clock.id_unschedule.

If the jitter argument is not None and this function returns Gst.ClockReturn.OK or Gst.ClockReturn.EARLY, it will contain the difference against the clock and the time of id when this method was called. Positive values indicate how late id was relative to the clock (in which case this function will return Gst.ClockReturn.EARLY). Negative values indicate how much time was spent waiting on the clock before this function returned.

Parameters:

`id` (object) –

The object to wait on

Returns a tuple made of:

(Gst.ClockReturn ) –

the result of the blocking wait. Gst.ClockReturn.EARLY will be returned if the current clock time is past the time of id, Gst.ClockReturn.OK if id was scheduled in time. Gst.ClockReturn.UNSCHEDULED if id was unscheduled with Gst.Clock.id_unschedule.

`jitter` (int ) –

the result of the blocking wait. Gst.ClockReturn.EARLY will be returned if the current clock time is past the time of id, Gst.ClockReturn.OK if id was scheduled in time. Gst.ClockReturn.UNSCHEDULED if id was unscheduled with Gst.Clock.id_unschedule.

#### gst_clock_id_wait_async

    GstClockReturn
    gst_clock_id_wait_async (GstClockID id,
                             GstClockCallback func,
                             gpointer user_data,
                             GDestroyNotify destroy_data)

Registers a callback on the given GstClockID id with the given function and user_data. When passing a GstClockID with an invalid time to this function, the callback will be called immediately with a time set to GST_CLOCK_TIME_NONE. The callback will be called when the time of id has been reached.

The callback func can be invoked from any thread, either provided by the core or from a streaming thread. The application should be prepared for this.

Parameters:

`id` –

a GstClockID to wait on

`func` –

The callback function

`user_data` –

User data passed in the callback

`destroy_data` –

GDestroyNotify for user_data

Returns –

the result of the non blocking wait.

#### Gst.Clock.prototype.id_wait_async

    function Gst.Clock.prototype.id_wait_async(id: Object, func: Gst.ClockCallback, user_data: Object): {
        // javascript wrapper for 'gst_clock_id_wait_async'
    }

Registers a callback on the given Object id with the given function and user_data. When passing a Object with an invalid time to this function, the callback will be called immediately with a time set to Gst.CLOCK_TIME_NONE. The callback will be called when the time of id has been reached.

The callback func can be invoked from any thread, either provided by the core or from a streaming thread. The application should be prepared for this.

Parameters:

`id` (Object) –

a Object to wait on

`func` (Gst.ClockCallback) –

The callback function

`user_data` (Object) –

User data passed in the callback

Returns (Gst.ClockReturn) –

the result of the non blocking wait.

#### Gst.Clock.id_wait_async

    def Gst.Clock.id_wait_async (id, func, *user_data):
        #python wrapper for 'gst_clock_id_wait_async'

Registers a callback on the given object id with the given function and user_data. When passing a object with an invalid time to this function, the callback will be called immediately with a time set to Gst.CLOCK_TIME_NONE. The callback will be called when the time of id has been reached.

The callback func can be invoked from any thread, either provided by the core or from a streaming thread. The application should be prepared for this.

Parameters:

`id` (object) –

a object to wait on

`func` (Gst.ClockCallback) –

The callback function

`user_data` (variadic) –

User data passed in the callback

Returns (Gst.ClockReturn) –

the result of the non blocking wait.

### Signals

#### synced

    synced_callback (GstClock * self,
                     gboolean synced,
                     gpointer user_data)

Signaled on clocks with GST_CLOCK_FLAG_NEEDS_STARTUP_SYNC set once the clock is synchronized, or when it completely lost synchronization. This signal will not be emitted on clocks without the flag.

This signal will be emitted from an arbitrary thread, most likely not the application's main thread.

Parameters:

`self` –

the clock

`synced` –

if the clock is synced now

`user_data` –
No description available

Flags: Run Last

Since : 1.6

#### synced

    function synced_callback(self: Gst.Clock, synced: Number, user_data: Object): {
        // javascript callback for the 'synced' signal
    }

Signaled on clocks with Gst.ClockFlags.NEEDS_STARTUP_SYNC set once the clock is synchronized, or when it completely lost synchronization. This signal will not be emitted on clocks without the flag.

This signal will be emitted from an arbitrary thread, most likely not the application's main thread.

Parameters:

`self` (Gst.Clock) –

the clock

`synced` (Number) –

if the clock is synced now

`user_data` (Object) –
No description available

Flags: Run Last

Since : 1.6

#### synced

    def synced_callback (self, synced, *user_data):
        #python callback for the 'synced' signal

Signaled on clocks with Gst.ClockFlags.NEEDS_STARTUP_SYNC set once the clock is synchronized, or when it completely lost synchronization. This signal will not be emitted on clocks without the flag.

This signal will be emitted from an arbitrary thread, most likely not the application's main thread.

Parameters:

`self` (Gst.Clock) –

the clock

`synced` (bool) –

if the clock is synced now

`user_data` (variadic) –
No description available

Flags: Run Last

Since : 1.6

### Properties

#### timeout

    “timeout” guint64

Flags : Read / Write

#### timeout

    “timeout” Number

Flags : Read / Write

#### timeout

    “self.props.timeout” int

Flags : Read / Write

#### window-size

    “window-size” gint

Flags : Read / Write

#### window-size

    “window-size” Number

Flags : Read / Write

#### window_size

    “self.props.window_size” int

Flags : Read / Write

#### window-threshold

    “window-threshold” gint

Flags : Read / Write

#### window-threshold

    “window-threshold” Number

Flags : Read / Write

#### window_threshold

    “self.props.window_threshold” int

Flags : Read / Write

### Virtual Methods

#### change_resolution

    GstClockTime
    change_resolution (GstClock * clock,
                       GstClockTime old_resolution,
                       GstClockTime new_resolution)

Change the resolution of the clock. Not all values might be acceptable.

Parameters:

`clock` –

the GstClock

`old_resolution` –

the previous resolution

`new_resolution` –

the new resolution

Returns –

the new resolution

#### vfunc_change_resolution

    function vfunc_change_resolution(clock: Gst.Clock, old_resolution: Number, new_resolution: Number): {
        // javascript implementation of the 'change_resolution' virtual method
    }

Change the resolution of the clock. Not all values might be acceptable.

Parameters:

`clock` (Gst.Clock) –

the Gst.Clock

`old_resolution` (Number) –

the previous resolution

`new_resolution` (Number) –

the new resolution

Returns (Number) –

the new resolution

#### do_change_resolution

    def do_change_resolution (clock, old_resolution, new_resolution):
        #python implementation of the 'change_resolution' virtual method

Change the resolution of the clock. Not all values might be acceptable.

Parameters:

`clock` (Gst.Clock) –

the Gst.Clock

`old_resolution` (int) –

the previous resolution

`new_resolution` (int) –

the new resolution

Returns (int) –

the new resolution

#### get_internal_time

    GstClockTime
    get_internal_time (GstClock * clock)

Get the internal unadjusted time of the clock.

Implement wait instead.

Parameters:

`clock` –

the GstClock

Returns –

the internal time

#### vfunc_get_internal_time

    function vfunc_get_internal_time(clock: Gst.Clock): {
        // javascript implementation of the 'get_internal_time' virtual method
    }

Get the internal unadjusted time of the clock.

Implement vfunc_wait instead.

Parameters:

`clock` (Gst.Clock) –

the Gst.Clock

Returns (Number) –

the internal time

#### do_get_internal_time

    def do_get_internal_time (clock):
        #python implementation of the 'get_internal_time' virtual method

Get the internal unadjusted time of the clock.

Implement do_wait instead.

Parameters:

`clock` (Gst.Clock) –

the Gst.Clock

Returns (int) –

the internal time

#### get_resolution

    GstClockTime
    get_resolution (GstClock * clock)

Get the resolution of the clock.

Parameters:

`clock` –

the GstClock

Returns –

the current resolution

#### vfunc_get_resolution

    function vfunc_get_resolution(clock: Gst.Clock): {
        // javascript implementation of the 'get_resolution' virtual method
    }

Get the resolution of the clock.

Parameters:

`clock` (Gst.Clock) –

the Gst.Clock

Returns (Number) –

the current resolution

#### do_get_resolution

    def do_get_resolution (clock):
        #python implementation of the 'get_resolution' virtual method

Get the resolution of the clock.

Parameters:

`clock` (Gst.Clock) –

the Gst.Clock

Returns (int) –

the current resolution

#### unschedule

    unschedule (GstClock * clock,
                GstClockEntry * entry)

Unblock a blocking or async wait operation.

Parameters:

`clock` –

the GstClock

`entry` –

the entry to unschedule

#### vfunc_unschedule

    function vfunc_unschedule(clock: Gst.Clock, entry: Gst.ClockEntry): {
        // javascript implementation of the 'unschedule' virtual method
    }

Unblock a blocking or async wait operation.

Parameters:

`clock` (Gst.Clock) –

the Gst.Clock

`entry` (Gst.ClockEntry) –

the entry to unschedule

#### do_unschedule

    def do_unschedule (clock, entry):
        #python implementation of the 'unschedule' virtual method

Unblock a blocking or async wait operation.

Parameters:

`clock` (Gst.Clock) –

the Gst.Clock

`entry` (Gst.ClockEntry) –

the entry to unschedule

#### wait

    GstClockReturn
    wait (GstClock * clock,
          GstClockEntry * entry,
          GstClockTimeDiff * jitter)

Perform a blocking wait on the given GstClockEntry and return the jitter.

Parameters:

`clock` –

the GstClock

`entry` –

the entry to wait on

`jitter` ( [out][allow-none]) –

a pointer that will contain the jitter

Returns –

the result of the blocking wait. GST_CLOCK_EARLY will be returned if the current clock time is past the time of id, GST_CLOCK_OK if id was scheduled in time. GST_CLOCK_UNSCHEDULED if id was unscheduled with gst_clock_id_unschedule.

#### vfunc_wait

    function vfunc_wait(clock: Gst.Clock, entry: Gst.ClockEntry): {
        // javascript implementation of the 'wait' virtual method
    }

Perform a blocking wait on the given Gst.ClockEntry and return the jitter.

Parameters:

`clock` (Gst.Clock) –

the Gst.Clock

`entry` (Gst.ClockEntry) –

the entry to wait on

Returns a tuple made of:

(Gst.ClockReturn ) –

the result of the blocking wait. Gst.ClockReturn.EARLY will be returned if the current clock time is past the time of id, Gst.ClockReturn.OK if id was scheduled in time. Gst.ClockReturn.UNSCHEDULED if id was unscheduled with Gst.Clock.prototype.id_unschedule.

`jitter` (Number ) –

the result of the blocking wait. Gst.ClockReturn.EARLY will be returned if the current clock time is past the time of id, Gst.ClockReturn.OK if id was scheduled in time. Gst.ClockReturn.UNSCHEDULED if id was unscheduled with Gst.Clock.prototype.id_unschedule.

#### do_wait

    def do_wait (clock, entry):
        #python implementation of the 'wait' virtual method

Perform a blocking wait on the given Gst.ClockEntry and return the jitter.

Parameters:

`clock` (Gst.Clock) –

the Gst.Clock

`entry` (Gst.ClockEntry) –

the entry to wait on

Returns a tuple made of:

(Gst.ClockReturn ) –

the result of the blocking wait. Gst.ClockReturn.EARLY will be returned if the current clock time is past the time of id, Gst.ClockReturn.OK if id was scheduled in time. Gst.ClockReturn.UNSCHEDULED if id was unscheduled with Gst.Clock.id_unschedule.

`jitter` (int ) –

the result of the blocking wait. Gst.ClockReturn.EARLY will be returned if the current clock time is past the time of id, Gst.ClockReturn.OK if id was scheduled in time. Gst.ClockReturn.UNSCHEDULED if id was unscheduled with Gst.Clock.id_unschedule.

#### wait_async

    GstClockReturn
    wait_async (GstClock * clock,
                GstClockEntry * entry)

Perform an asynchronous wait on the given GstClockEntry.

Parameters:

`clock` –

the GstClock

`entry` –

the entry to wait on

Returns –

the result of the non blocking wait.

#### vfunc_wait_async

    function vfunc_wait_async(clock: Gst.Clock, entry: Gst.ClockEntry): {
        // javascript implementation of the 'wait_async' virtual method
    }

Perform an asynchronous wait on the given Gst.ClockEntry.

Parameters:

`clock` (Gst.Clock) –

the Gst.Clock

`entry` (Gst.ClockEntry) –

the entry to wait on

Returns (Gst.ClockReturn) –

the result of the non blocking wait.

#### do_wait_async

    def do_wait_async (clock, entry):
        #python implementation of the 'wait_async' virtual method

Perform an asynchronous wait on the given Gst.ClockEntry.

Parameters:

`clock` (Gst.Clock) –

the Gst.Clock

`entry` (Gst.ClockEntry) –

the entry to wait on

Returns (Gst.ClockReturn) –

the result of the non blocking wait.

## GstClockEntry

All pending timeouts or periodic notifies are converted into an entry. Note that GstClockEntry should be treated as an opaque structure. It must not be extended or allocated using a custom allocator.

### Members

`refcount` (gint) –

reference counter (read-only)

## Gst.ClockEntry

All pending timeouts or periodic notifies are converted into an entry. Note that GstClockEntry should be treated as an opaque structure. It must not be extended or allocated using a custom allocator.

### Members

`refcount` (Number) –

reference counter (read-only)

## Gst.ClockEntry

All pending timeouts or periodic notifies are converted into an entry. Note that GstClockEntry should be treated as an opaque structure. It must not be extended or allocated using a custom allocator.

### Members

`refcount` (int) –

reference counter (read-only)

## Function Macros

### GST_CLOCK_CAST

    #define GST_CLOCK_CAST(clock)           ((GstClock*)(clock))

### GST_CLOCK_DIFF

    #define GST_CLOCK_DIFF(s, e)            (GstClockTimeDiff)((e) - (s))

Calculates a difference between two clock times as a GstClockTimeDiff. The difference is calculated as e - s.

Parameters:

`s` –

the first time

`e` –

the second time

### GST_CLOCK_ENTRY

    #define GST_CLOCK_ENTRY(entry)          ((GstClockEntry *)(entry))

Casts to a clock entry

Parameters:

`entry` –

the entry to cast

### GST_CLOCK_ENTRY_CLOCK

    #define GST_CLOCK_ENTRY_CLOCK(entry)    ((entry)->clock)

Gets the owner clock of the entry

Parameters:

`entry` –

the entry to query

deprecated : Use gst_clock_id_get_clock() instead.

### GST_CLOCK_ENTRY_INTERVAL

    #define GST_CLOCK_ENTRY_INTERVAL(entry) ((entry)->interval)

Gets the interval of this periodic entry

Parameters:

`entry` –

the entry to query

### GST_CLOCK_ENTRY_STATUS

    #define GST_CLOCK_ENTRY_STATUS(entry)   ((entry)->status)

The status of the entry

Parameters:

`entry` –

the entry to query

### GST_CLOCK_ENTRY_TIME

    #define GST_CLOCK_ENTRY_TIME(entry)     ((entry)->time)

Gets the requested time of this entry

Parameters:

`entry` –

the entry to query

### GST_CLOCK_ENTRY_TYPE

    #define GST_CLOCK_ENTRY_TYPE(entry)     ((entry)->type)

Gets the type of the clock entry

Parameters:

`entry` –

the entry to query

### GST_CLOCK_FLAGS

    #define GST_CLOCK_FLAGS(clock)  GST_OBJECT_FLAGS(clock)

Gets the GstClockFlags clock flags.

Parameters:

`clock` –

the clock to query

### GST_CLOCK_STIME_IS_VALID

    #define GST_CLOCK_STIME_IS_VALID(time)   (((GstClockTimeDiff)(time)) != GST_CLOCK_STIME_NONE)

Tests if a given GstClockTimeDiff of gint64 represents a valid defined time.

Parameters:

`time` –

signed clock time to validate

Since : 1.6

### GST_CLOCK_TIME_IS_VALID

    #define GST_CLOCK_TIME_IS_VALID(time)   (((GstClockTime)(time)) != GST_CLOCK_TIME_NONE)

Tests if a given GstClockTime represents a valid defined time.

Parameters:

`time` –

clock time to validate

### GST_STIME_ARGS

    #define GST_STIME_ARGS(t)						\
      ((t) == GST_CLOCK_STIME_NONE || (t) >= 0) ? '+' : '-',		\
        GST_CLOCK_STIME_IS_VALID (t) ?					\
        (guint) (((GstClockTime)(ABS(t))) / (GST_SECOND * 60 * 60)) : 99,	\
        GST_CLOCK_STIME_IS_VALID (t) ?					\
        (guint) ((((GstClockTime)(ABS(t))) / (GST_SECOND * 60)) % 60) : 99,	\
        GST_CLOCK_STIME_IS_VALID (t) ?					\
        (guint) ((((GstClockTime)(ABS(t))) / GST_SECOND) % 60) : 99,	\
        GST_CLOCK_STIME_IS_VALID (t) ?					\
        (guint) (((GstClockTime)(ABS(t))) % GST_SECOND) : 999999999

Formats t for the GST_STIME_FORMAT format string. Note: t will be evaluated more than once.

Parameters:

`t` –

a GstClockTimeDiff or gint64

Since : 1.6

### GST_TIMESPEC_TO_TIME

    #define GST_TIMESPEC_TO_TIME(ts)        (GstClockTime)((ts).tv_sec * GST_SECOND + (ts).tv_nsec * GST_NSECOND)

Converts a struct timespec (see `man pselect`) to a GstClockTime.

Parameters:

`ts` –

the timespec to convert

### GST_TIMEVAL_TO_TIME

    #define GST_TIMEVAL_TO_TIME(tv)         (GstClockTime)((tv).tv_sec * GST_SECOND + (tv).tv_usec * GST_USECOND)

Converts a GTimeVal to a GstClockTime.

Parameters:

`tv` –

the timeval to convert

### GST_TIME_ARGS

    #define GST_TIME_ARGS(t) \
            GST_CLOCK_TIME_IS_VALID (t) ? \
            (guint) (((GstClockTime)(t)) / (GST_SECOND * 60 * 60)) : 99, \
            GST_CLOCK_TIME_IS_VALID (t) ? \
            (guint) ((((GstClockTime)(t)) / (GST_SECOND * 60)) % 60) : 99, \
            GST_CLOCK_TIME_IS_VALID (t) ? \
            (guint) ((((GstClockTime)(t)) / GST_SECOND) % 60) : 99, \
            GST_CLOCK_TIME_IS_VALID (t) ? \
            (guint) (((GstClockTime)(t)) % GST_SECOND) : 999999999

Formats t for the GST_TIME_FORMAT format string. Note: t will be evaluated more than once.

Parameters:

`t` –

a GstClockTime

### GST_TIME_AS_MSECONDS

    #define GST_TIME_AS_MSECONDS(time) ((time) / G_GINT64_CONSTANT (1000000))

Converts a GstClockTime to milliseconds (1/1000 of a second).

Parameters:

`time` –

the time

### GST_TIME_AS_NSECONDS

    #define GST_TIME_AS_NSECONDS(time) (time)

Converts a GstClockTime to nanoseconds (1/1000000000 of a second).

Parameters:

`time` –

the time

### GST_TIME_AS_SECONDS

    #define GST_TIME_AS_SECONDS(time)  ((time) / GST_SECOND)

Converts a GstClockTime to seconds.

Parameters:

`time` –

the time

### GST_TIME_AS_USECONDS

    #define GST_TIME_AS_USECONDS(time) ((time) / G_GINT64_CONSTANT (1000))

Converts a GstClockTime to microseconds (1/1000000 of a second).

Parameters:

`time` –

the time

### GST_TIME_TO_TIMESPEC

    #define GST_TIME_TO_TIMESPEC(t,ts)                                          \
    G_STMT_START {                                                              \
      G_STATIC_ASSERT (sizeof ((ts).tv_sec) == 4 || sizeof ((ts).tv_sec) == 8); \
      if (sizeof ((ts).tv_sec) == 4) {                                          \
        g_assert ("Value of time " #t " is out of timespec's range" &&          \
            ((t) / GST_SECOND) < G_MAXINT32);                                   \
      }                                                                         \
      (ts).tv_sec  =  ((t) / GST_SECOND);                                       \
      (ts).tv_nsec = (((t) - (ts).tv_sec * GST_SECOND) / GST_NSECOND);          \
    } G_STMT_END

Converts a GstClockTime to a struct timespec (see `man pselect`)

Parameters:

`t` –

The GstClockTime to convert

`ts` –

The target timespec

### GST_TIME_TO_TIMEVAL

    #define GST_TIME_TO_TIMEVAL(t,tv)                                           \
    G_STMT_START {                                                              \
      G_STATIC_ASSERT (sizeof ((tv).tv_sec) == 4 || sizeof ((tv).tv_sec) == 8); \
      if (sizeof ((tv).tv_sec) == 4) {                                          \
        g_assert ("Value of time " #t " is out of timeval's range" &&           \
            ((t) / GST_SECOND) < G_MAXINT32);                                   \
      }                                                                         \
      (tv).tv_sec  = (((GstClockTime) (t)) / GST_SECOND);                       \
      (tv).tv_usec = ((((GstClockTime) (t)) -                                   \
                      ((GstClockTime) (tv).tv_sec) * GST_SECOND)                \
                     / GST_USECOND);                                            \
    } G_STMT_END

Converts a GstClockTime to a GTimeVal

> on many 32-bit systems, a timeval has a range of only 2^32 - 1 seconds, which is about 68 years. Expect trouble if you want to schedule stuff in your pipeline for 2038. This macro asserts that this case does not happen.

Parameters:

`t` –

The GstClockTime to convert

`tv` –

The target timeval

## Enumerations

### GstClockEntryType

The type of the clock entry

##### Members

`GST_CLOCK_ENTRY_SINGLE` (0) –

a single shot timeout

`GST_CLOCK_ENTRY_PERIODIC` (1) –

a periodic timeout request

### Gst.ClockEntryType

The type of the clock entry

##### Members

`Gst.ClockEntryType.SINGLE` (0) –

a single shot timeout

`Gst.ClockEntryType.PERIODIC` (1) –

a periodic timeout request

### Gst.ClockEntryType

The type of the clock entry

##### Members

`Gst.ClockEntryType.SINGLE` (0) –

a single shot timeout

`Gst.ClockEntryType.PERIODIC` (1) –

a periodic timeout request

### GstClockFlags

The capabilities of this clock

##### Members

`GST_CLOCK_FLAG_CAN_DO_SINGLE_SYNC` (16) –

clock can do a single sync timeout request

`GST_CLOCK_FLAG_CAN_DO_SINGLE_ASYNC` (32) –

clock can do a single async timeout request

`GST_CLOCK_FLAG_CAN_DO_PERIODIC_SYNC` (64) –

clock can do sync periodic timeout requests

`GST_CLOCK_FLAG_CAN_DO_PERIODIC_ASYNC` (128) –

clock can do async periodic timeout callbacks

`GST_CLOCK_FLAG_CAN_SET_RESOLUTION` (256) –

clock's resolution can be changed

`GST_CLOCK_FLAG_CAN_SET_MASTER` (512) –

clock can be slaved to a master clock

`GST_CLOCK_FLAG_NEEDS_STARTUP_SYNC` (1024) –

clock needs to be synced before it can be used

(Since: 1.6)
`GST_CLOCK_FLAG_LAST` (4096) –

subclasses can add additional flags starting from this flag

### Gst.ClockFlags

The capabilities of this clock

##### Members

`Gst.ClockFlags.CAN_DO_SINGLE_SYNC` (16) –

clock can do a single sync timeout request

`Gst.ClockFlags.CAN_DO_SINGLE_ASYNC` (32) –

clock can do a single async timeout request

`Gst.ClockFlags.CAN_DO_PERIODIC_SYNC` (64) –

clock can do sync periodic timeout requests

`Gst.ClockFlags.CAN_DO_PERIODIC_ASYNC` (128) –

clock can do async periodic timeout callbacks

`Gst.ClockFlags.CAN_SET_RESOLUTION` (256) –

clock's resolution can be changed

`Gst.ClockFlags.CAN_SET_MASTER` (512) –

clock can be slaved to a master clock

`Gst.ClockFlags.NEEDS_STARTUP_SYNC` (1024) –

clock needs to be synced before it can be used

(Since: 1.6)
`Gst.ClockFlags.LAST` (4096) –

subclasses can add additional flags starting from this flag

### Gst.ClockFlags

The capabilities of this clock

##### Members

`Gst.ClockFlags.CAN_DO_SINGLE_SYNC` (16) –

clock can do a single sync timeout request

`Gst.ClockFlags.CAN_DO_SINGLE_ASYNC` (32) –

clock can do a single async timeout request

`Gst.ClockFlags.CAN_DO_PERIODIC_SYNC` (64) –

clock can do sync periodic timeout requests

`Gst.ClockFlags.CAN_DO_PERIODIC_ASYNC` (128) –

clock can do async periodic timeout callbacks

`Gst.ClockFlags.CAN_SET_RESOLUTION` (256) –

clock's resolution can be changed

`Gst.ClockFlags.CAN_SET_MASTER` (512) –

clock can be slaved to a master clock

`Gst.ClockFlags.NEEDS_STARTUP_SYNC` (1024) –

clock needs to be synced before it can be used

(Since: 1.6)
`Gst.ClockFlags.LAST` (4096) –

subclasses can add additional flags starting from this flag

### GstClockReturn

The return value of a clock operation.

##### Members

`GST_CLOCK_OK` (0) –

The operation succeeded.

`GST_CLOCK_EARLY` (1) –

The operation was scheduled too late.

`GST_CLOCK_UNSCHEDULED` (2) –

The clockID was unscheduled

`GST_CLOCK_BUSY` (3) –

The ClockID is busy

`GST_CLOCK_BADTIME` (4) –

A bad time was provided to a function.

`GST_CLOCK_ERROR` (5) –

An error occurred

`GST_CLOCK_UNSUPPORTED` (6) –

Operation is not supported

`GST_CLOCK_DONE` (7) –

The ClockID is done waiting

### Gst.ClockReturn

The return value of a clock operation.

##### Members

`Gst.ClockReturn.OK` (0) –

The operation succeeded.

`Gst.ClockReturn.EARLY` (1) –

The operation was scheduled too late.

`Gst.ClockReturn.UNSCHEDULED` (2) –

The clockID was unscheduled

`Gst.ClockReturn.BUSY` (3) –

The ClockID is busy

`Gst.ClockReturn.BADTIME` (4) –

A bad time was provided to a function.

`Gst.ClockReturn.ERROR` (5) –

An error occurred

`Gst.ClockReturn.UNSUPPORTED` (6) –

Operation is not supported

`Gst.ClockReturn.DONE` (7) –

The ClockID is done waiting

### Gst.ClockReturn

The return value of a clock operation.

##### Members

`Gst.ClockReturn.OK` (0) –

The operation succeeded.

`Gst.ClockReturn.EARLY` (1) –

The operation was scheduled too late.

`Gst.ClockReturn.UNSCHEDULED` (2) –

The clockID was unscheduled

`Gst.ClockReturn.BUSY` (3) –

The ClockID is busy

`Gst.ClockReturn.BADTIME` (4) –

A bad time was provided to a function.

`Gst.ClockReturn.ERROR` (5) –

An error occurred

`Gst.ClockReturn.UNSUPPORTED` (6) –

Operation is not supported

`Gst.ClockReturn.DONE` (7) –

The ClockID is done waiting

## Constants

### GST_CLOCK_STIME_NONE

    #define GST_CLOCK_STIME_NONE             ((GstClockTimeDiff)G_MININT64)

Constant to define an undefined clock time.

### GST_CLOCK_TIME_NONE

    #define GST_CLOCK_TIME_NONE             ((GstClockTime) -1)

Constant to define an undefined clock time.

### Gst.CLOCK_TIME_NONE

Constant to define an undefined clock time.

### Gst.CLOCK_TIME_NONE

Constant to define an undefined clock time.

### GST_MSECOND

    #define GST_MSECOND ((GstClockTimeDiff)(GST_SECOND / G_GINT64_CONSTANT (1000)))

Constant that defines one GStreamer millisecond.

### Gst.MSECOND

Constant that defines one GStreamer millisecond.

### Gst.MSECOND

Constant that defines one GStreamer millisecond.

### GST_NSECOND

    #define GST_NSECOND ((GstClockTimeDiff)(GST_SECOND / G_GINT64_CONSTANT (1000000000)))

Constant that defines one GStreamer nanosecond

### Gst.NSECOND

Constant that defines one GStreamer nanosecond

### Gst.NSECOND

Constant that defines one GStreamer nanosecond

### GST_SECOND

    #define GST_SECOND  ((GstClockTimeDiff)(G_USEC_PER_SEC * G_GINT64_CONSTANT (1000)))

Constant that defines one GStreamer second.

### Gst.SECOND

Constant that defines one GStreamer second.

### Gst.SECOND

Constant that defines one GStreamer second.

### GST_STIME_FORMAT

    #define GST_STIME_FORMAT "c%" GST_TIME_FORMAT

A string that can be used in printf-like format strings to display a signed GstClockTimeDiff or gint64 value in `h:m:s` format. Use GST_TIME_ARGS to construct the matching arguments.

Example:

    printf("%" GST_STIME_FORMAT "\n", GST_STIME_ARGS(ts));

Since : 1.6

### GST_TIME_FORMAT

    #define GST_TIME_FORMAT "u:%02u:%02u.%09u"

A string that can be used in printf-like format strings to display a GstClockTime value in `h:m:s` format. Use GST_TIME_ARGS to construct the matching arguments.

Example:

    printf("%" GST_TIME_FORMAT "\n", GST_TIME_ARGS(ts));

### GST_TYPE_CLOCK_TIME

    #define GST_TYPE_CLOCK_TIME G_TYPE_UINT64

The GType of a GstClockTime.

### GST_USECOND

    #define GST_USECOND ((GstClockTimeDiff)(GST_SECOND / G_GINT64_CONSTANT (1000000)))

Constant that defines one GStreamer microsecond.

### Gst.USECOND

Constant that defines one GStreamer microsecond.

### Gst.USECOND

Constant that defines one GStreamer microsecond.

## Aliases

### GstClockID

    typedef gpointer GstClockID

A datatype to hold the handle to an outstanding sync or async clock callback.

### GstClockTime

    typedef guint64 GstClockTime

A datatype to hold a time, measured in nanoseconds.

### GstClockTimeDiff

    typedef gint64 GstClockTimeDiff

A datatype to hold a time difference, measured in nanoseconds.

## Callbacks

### GstClockCallback

    gboolean
    (*GstClockCallback) (GstClock * clock,
                         GstClockTime time,
                         GstClockID id,
                         gpointer user_data)

The function prototype of the callback.

Parameters:

`clock` –

The clock that triggered the callback

`time` –

The time it was triggered

`id` –

The GstClockID that expired

`user_data` –

user data passed in the gst_clock_id_wait_async function

Returns –

TRUE or FALSE (currently unused)

### Gst.ClockCallback

    function Gst.ClockCallback(clock: Gst.Clock, time: Number, id: Object, user_data: Object): {
        // javascript wrapper for 'GstClockCallback'
    }

The function prototype of the callback.

Parameters:

`clock` (Gst.Clock) –

The clock that triggered the callback

`time` (Number) –

The time it was triggered

`id` (Object) –

The Object that expired

`user_data` (Object) –

user data passed in the Gst.Clock.prototype.id_wait_async function

Returns (Number) –

true or false (currently unused)

### Gst.ClockCallback

    def Gst.ClockCallback (clock, time, id, *user_data):
        #python wrapper for 'GstClockCallback'

The function prototype of the callback.

Parameters:

`clock` (Gst.Clock) –

The clock that triggered the callback

`time` (int) –

The time it was triggered

`id` (object) –

The object that expired

`user_data` (variadic) –

user data passed in the Gst.Clock.id_wait_async function

Returns (bool) –

True or False (currently unused)

The results of the search are