Trait gstreamer::prelude::ClockExt

source ·
pub trait ClockExt: IsA<Clock> + Sealed + 'static {
Show 23 methods // Provided methods fn add_observation( &self, slave: ClockTime, master: ClockTime, ) -> Option<f64> { ... } fn add_observation_unapplied( &self, slave: ClockTime, master: ClockTime, ) -> Option<(f64, ClockTime, ClockTime, ClockTime, ClockTime)> { ... } fn adjust_unlocked(&self, internal: ClockTime) -> Option<ClockTime> { ... } fn internal_time(&self) -> ClockTime { ... } fn master(&self) -> Option<Clock> { ... } fn resolution(&self) -> ClockTime { ... } fn time(&self) -> Option<ClockTime> { ... } fn timeout(&self) -> Option<ClockTime> { ... } fn is_synced(&self) -> bool { ... } fn set_master( &self, master: Option<&impl IsA<Clock>>, ) -> Result<(), BoolError> { ... } fn set_resolution(&self, resolution: ClockTime) -> ClockTime { ... } fn set_synced(&self, synced: bool) { ... } fn set_timeout(&self, timeout: impl Into<Option<ClockTime>>) { ... } fn unadjust_unlocked(&self, external: ClockTime) -> Option<ClockTime> { ... } fn wait_for_sync( &self, timeout: impl Into<Option<ClockTime>>, ) -> Result<(), BoolError> { ... } fn window_size(&self) -> i32 { ... } fn set_window_size(&self, window_size: i32) { ... } fn window_threshold(&self) -> i32 { ... } fn set_window_threshold(&self, window_threshold: i32) { ... } fn connect_synced<F: Fn(&Self, bool) + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_timeout_notify<F: Fn(&Self) + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_window_size_notify<F: Fn(&Self) + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_window_threshold_notify<F: Fn(&Self) + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId { ... }
}
Expand description

Trait containing all Clock methods.

§Implementors

Clock, SystemClock

Provided Methods§

source

fn add_observation(&self, slave: ClockTime, master: ClockTime) -> Option<f64>

The time master of the master clock and the time slave of the slave clock are added to the list of observations. If enough observations are available, a linear regression algorithm is run on the observations and self 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.

§slave

a time on the slave

§master

a time on the master

§Returns

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

§r_squared

a pointer to hold the result

source

fn add_observation_unapplied( &self, slave: ClockTime, master: ClockTime, ) -> Option<(f64, ClockTime, ClockTime, ClockTime, ClockTime)>

Add a clock observation to the internal slaving algorithm the same as add_observation(), and return the result of the master clock estimation, without updating the internal calibration.

The caller can then take the results and call ClockExtManual::set_calibration() with the values, or some modified version of them.

§slave

a time on the slave

§master

a time on the master

§Returns

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

§r_squared

a pointer to hold the result

§internal

a location to store the internal time

§external

a location to store the external time

§rate_num

a location to store the rate numerator

§rate_denom

a location to store the rate denominator

source

fn adjust_unlocked(&self, internal: ClockTime) -> Option<ClockTime>

Converts the given internal clock time to the external time, adjusting for the rate and reference time set with ClockExtManual::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 unadjust_unlocked().

§internal

a clock time

§Returns

the converted time of the clock.

source

fn internal_time(&self) -> ClockTime

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

§Returns

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

source

fn master(&self) -> Option<Clock>

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

§Returns

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

source

fn resolution(&self) -> ClockTime

Gets the accuracy of the clock. The accuracy of the clock is the granularity of the values returned by time().

§Returns

the resolution of the clock in units of GstClockTime.

source

fn time(&self) -> Option<ClockTime>

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

§Returns

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

source

fn timeout(&self) -> Option<ClockTime>

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

§Returns

the interval between samples.

source

fn is_synced(&self) -> bool

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

§Returns

true if the clock is currently synced

source

fn set_master(&self, master: Option<&impl IsA<Clock>>) -> Result<(), BoolError>

Sets master as the master clock for self. self will be automatically calibrated so that 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 ClockExtManual::calibration().

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

§master

a master Clock

§Returns

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

source

fn set_resolution(&self, resolution: ClockTime) -> ClockTime

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 ClockFlags::CAN_SET_RESOLUTION flag set.

§resolution

The resolution to set

§Returns

the new resolution of the clock.

source

fn set_synced(&self, synced: bool)

Sets self to synced and emits the synced signal, and wakes up any thread waiting in wait_for_sync().

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

§synced

if the clock is synced

source

fn set_timeout(&self, timeout: impl Into<Option<ClockTime>>)

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

§timeout

a timeout

source

fn unadjust_unlocked(&self, external: ClockTime) -> Option<ClockTime>

Converts the given external clock time to the internal time of self, using the rate and reference time set with ClockExtManual::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 adjust_unlocked().

§external

an external clock time

§Returns

the internal time of the clock corresponding to external.

source

fn wait_for_sync( &self, timeout: impl Into<Option<ClockTime>>, ) -> Result<(), BoolError>

Waits until self 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 ClockFlags::NEEDS_STARTUP_SYNC is not set on the clock, or if the clock is already synced.

§timeout

timeout for waiting or GST_CLOCK_TIME_NONE

§Returns

true if waiting was successful, or false on timeout

source

fn window_size(&self) -> i32

source

fn set_window_size(&self, window_size: i32)

source

fn window_threshold(&self) -> i32

source

fn set_window_threshold(&self, window_threshold: i32)

source

fn connect_synced<F: Fn(&Self, bool) + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId

Signaled on clocks with 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.

§synced

if the clock is synced now

source

fn connect_timeout_notify<F: Fn(&Self) + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId

source

fn connect_window_size_notify<F: Fn(&Self) + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId

source

fn connect_window_threshold_notify<F: Fn(&Self) + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<O: IsA<Clock>> ClockExt for O