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
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:
a time on the internal clock
a time on the external clock
Returns a tuple made of:
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:
a time on the internal clock
a time on the external clock
Returns a tuple made of:
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
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:
a time on the internal clock
a time on the external clock
Returns a tuple made of:
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:
a time on the internal clock
a time on the external clock
Returns a tuple made of:
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.
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.
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.
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
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:
a clock time
a reference internal time
a reference external time
the numerator of the rate of the clock relative to its internal time
the denominator of the rate of the clock
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:
a clock time
a reference internal time
a reference external time
the numerator of the rate of the clock relative to its internal time
the denominator of the rate of the clock
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.
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.
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
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.
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.
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
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.
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.
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
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.
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.
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
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.
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.
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
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.
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
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:
a GstClock
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:
a GstClock
Since : 1.6
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
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:
the requested start time
the requested interval
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:
the requested start time
the requested interval
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.
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:
the requested time
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:
the requested time
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
–
start_time
–
the requested start time
interval
–
the requested interval
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:
the requested start time
the requested interval
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:
the requested start time
the requested interval
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:
a reference internal time
a reference external time
the numerator of the rate of the clock relative to its internal time
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:
a reference internal time
a reference external time
the numerator of the rate of the clock relative to its internal time
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.
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.
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.
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.
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.
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.
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.
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.
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
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
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.
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:
The requested time.
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.
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.
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.
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.
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
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:
a clock time
a reference internal time
a reference external time
the numerator of the rate of the clock relative to its internal time
the denominator of the rate of the clock
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:
a clock time
a reference internal time
a reference external time
the numerator of the rate of the clock relative to its internal time
the denominator of the rate of the clock
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.
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.
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.
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.
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.
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.
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
–
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.
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
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
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
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.
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_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:
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:
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.
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.
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.
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.
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.
Returns a tuple made of:
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.
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.
Returns a tuple made of:
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.
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
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:
The callback function
User data passed in the callback
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:
The callback function
User data passed in the callback
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
–
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:
the clock
if the clock is synced now
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:
the clock
if the clock is synced now
Flags: Run Last
Since : 1.6
Properties
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
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:
the previous resolution
the new resolution
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:
the previous resolution
the new resolution
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
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.
the internal time
get_resolution
GstClockTime get_resolution (GstClock * clock)
Get the resolution of the clock.
Parameters:
clock
–
the GstClock
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.
the current resolution
unschedule
unschedule (GstClock * clock, GstClockEntry * entry)
Unblock a blocking or async wait operation.
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.
do_unschedule
def do_unschedule (clock, entry):
#python implementation of the 'unschedule' virtual method
Unblock a blocking or async wait operation.
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
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.
Returns a tuple made of:
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.
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.
Returns a tuple made of:
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.
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.
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.
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.
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
–
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
)
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.
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_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.
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
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:
The clock that triggered the callback
The time it was triggered
user data passed in the Gst.Clock.prototype.id_wait_async function
Gst.ClockCallback
def Gst.ClockCallback (clock, time, id, *user_data):
#python wrapper for 'GstClockCallback'
The function prototype of the callback.
Parameters:
The clock that triggered the callback
The time it was triggered
user data passed in the Gst.Clock.id_wait_async function
The results of the search are