gstreamermm 1.8.0

Public Member Functions | Static Public Member Functions | Related Functions | List of all members
Gst::Clock Class Reference

Abstract class for global clocks GStreamer uses a global clock to synchronize the plugins in a pipeline. More...

`#include <gstreamermm/clock.h>`

Inheritance diagram for Gst::Clock:
[legend]

## Public Member Functions
| Clock (Clock&& src) noexcept
Clock& | operator= (Clock&& src) noexcept
| ~Clock () noexcept override
GstClock* | gobj ()
| Provides access to the underlying C GObject. More...
const GstClock* | gobj () const
| Provides access to the underlying C GObject. More...
GstClock* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
bool | add_observation (Gst::ClockTime slave_time, Gst::ClockTime master_time, gdouble& result)
| The time master_time of the master clock and the time slave_time of the slave clock are added to the list of observations. More...
bool | add_observation (Gst::ClockTime slave_time, Gst::ClockTime master_time, gdouble& result, Gst::ClockTime&internal, Gst::ClockTime& external, Gst::ClockTime& rate_num, Gst::ClockTime& rate_denom)
| 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. More...
bool | set_master (const Clock& master_clock)
| Set master_clock as the master clock for clock. More...
Glib::RefPtr< Gst::Clock > | get_master ()
| Get the master clock that clock is slaved to or `nullptr` when the clock is not slaved to any master clock. More...
Glib::RefPtr< const Gst::Clock > | get_master () const
| Get the master clock that clock is slaved to or `nullptr` when the clock is not slaved to any master clock. More...
Gst::ClockTime | set_resolution (Gst::ClockTime resolution)
| Set the accuracy of the clock. More...
Gst::ClockTime | get_resolution () const
| Get the accuracy of the clock. More...
Gst::ClockTime | get_time () const
| Gets the current time of the given clock. More...
Glib::RefPtr< Gst::ClockID > | create_single_shot_id (Gst::ClockTime time)
| Get a Gst::ClockID from clock to trigger a single shot notification at the requested time. More...
Glib::RefPtr< Gst::ClockID > | create_periodic_id (Gst::ClockTime start_time, Gst::ClockTime intervals)
| Get an ID from clock to trigger a periodic notification. More...
bool | single_shot_id_reinit (const Glib::RefPtr< Gst::ClockID >& id, Gst::ClockTime time)
| Reinitializes the provided single shot id to the provided time. More...
bool | periodic_id_reinit (const Glib::RefPtr< Gst::ClockID >& id, Gst::ClockTime start_time, Gst::ClockTime interval)
| Reinitializes the provided periodic id to the provided start time and interval. More...
Gst::ClockTime | get_internal_time () const
| Gets the current internal time of the given clock. More...
Gst::ClockTime | adjust_unlocked (Gst::ClockTime internal_time)
| Converts the given internal_time clock time to the external time, adjusting for the rate and reference time set with set_calibration() and making sure that the returned time is increasing. More...
Gst::ClockTime | unadjust_unlocked (Gst::ClockTime external_time)
| Converts the given external_time clock time to the internal time of clock, using the rate and reference time set with set_calibration(). More...
Gst::ClockTime | adjust_with_calibration (Gst::ClockTime internal_target, Gst::ClockTime cinternal, Gst::ClockTime cexternal, Gst::ClockTime cnum, Gst::ClockTime cdenom)
| Converts the given internal_target clock time to the external time, using the passed calibration parameters. More...
Gst::ClockTime | unadjust_with_calibration (Gst::ClockTime external_target, Gst::ClockTime cinternal, Gst::ClockTime cexternal, Gst::ClockTime cnum, Gst::ClockTime cdenom)
| Converts the given external_target clock time to the internal time, using the passed calibration parameters. More...
void | get_calibration (Gst::ClockTime&internal, Gst::ClockTime& external, Gst::ClockTime& rate_num, Gst::ClockTime& rate_denom) const
| Gets the internal rate and reference time of clock. More...
void | set_calibration (Gst::ClockTime internal, Gst::ClockTime external, Gst::ClockTime rate_num, Gst::ClockTime rate_denom)
| Adjusts the rate and time of clock. More...
bool | wait_for_sync (Gst::ClockTime timeout)
| Waits until clock is synced for reporting the current time. More...
bool | is_synced () const
| Checks if the clock is currently synced. More...
void | set_synced (bool synced)
| Sets clock to synced and emits the GstClock::synced signal, and wakes up any thread waiting in wait_for_sync(). More...
Glib::PropertyProxy< guint64 > | property_timeout ()
| get/set timeout can be achieved through 'timeout' property, so wrapping gst_clock_{get|set|_timeout is unnecessary. More...
Glib::PropertyProxy_ReadOnly< guint64 > | property_timeout () const
| The amount of time, in nanoseconds, to sample master and slave clocks. More...
Glib::PropertyProxy< int > | property_window_size ()
| The size of the window used to calculate rate and offset. More...
Glib::PropertyProxy_ReadOnly< int > | property_window_size () const
| The size of the window used to calculate rate and offset. More...
Glib::PropertyProxy< int > | property_window_threshold ()
| The threshold to start calculating rate and offset. More...
Glib::PropertyProxy_ReadOnly< int > | property_window_threshold () const
| The threshold to start calculating rate and offset. More...
virtual Gst::ClockTime | change_resolution_vfunc (Gst::ClockTime old_resolution, Gst::ClockTime new_resolution)
| Change the resolution of the clock. More...
virtual Gst::ClockTime | get_resolution_vfunc () const
| Get the resolution of the clock. More...
virtual Gst::ClockTime | get_internal_time_vfunc () const
| Get the internal unadjusted time of the clock. More...
virtual ClockReturn | wait_vfunc (const Glib::RefPtr< Gst::ClockID >& id, Gst::ClockTimeDiff& jitter)
| Perform a blocking wait for the given Gst::ClockID. More...
virtual ClockReturn | wait_async_vfunc (const Glib::RefPtr< Gst::ClockID >& id)
| Perform an asynchronous wait for the given Gst::ClockID. More...
virtual void | unschedule_vfunc (const Glib::RefPtr< Gst::ClockID >& id)
| Unblock a blocking or async wait operation. More...
Glib::SignalProxy< void, bool > | signal_synced ()
Public Member Functions inherited from Gst::Object
| Object (Object&& src) noexcept
Object& | operator= (Object&& src) noexcept
| ~Object () noexcept override
GstObject* | gobj ()
| Provides access to the underlying C GObject. More...
const GstObject* | gobj () const
| Provides access to the underlying C GObject. More...
GstObject* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
bool | is_element () const
bool | is_element_factory () const
bool | is_pad () const
bool | is_pad_template () const
bool | is_bin () const
guint32 | get_flags () const
| Returns the entire set of flags for the object. More...
bool | set_name (const Glib::ustring& name)
| Sets the name of object, or gives object a guaranteed unique name (if name is `nullptr`). More...
Glib::ustring | get_name () const
| Returns a copy of the name of object. More...
bool | set_parent (const Glib::RefPtr< Gst::Object >& parent)
| Sets the parent of object to parent. More...
Glib::RefPtr< Gst::Object > | get_parent ()
| Returns the parent of object. More...
Glib::RefPtr< const Gst::Object > | get_parent () const
| Returns the parent of object. More...
void | unparent ()
| Clear the parent of object, removing the associated reference. More...
void | set_control_rate (Gst::ClockTime control_rate)
| Change the control-rate for this object. More...
Gst::ClockTime | get_control_rate () const
| Obtain the control-rate for this object. More...
Gst::ClockTime | suggest_next_sync () const
| Returns a suggestion for timestamps where buffers should be split to get best controller results. More...
bool | sync_values (Gst::ClockTime timestamp)
| Sets the properties of the object, according to the Gst::ControlSources that (maybe) handle them and for the given timestamp. More...
void | set_control_bindings_disabled (bool disabled)
| This function is used to disable all controlled properties of the object for some time, i.e. sync_values() will do nothing. More...
bool | has_asctive_control_bindings () const
| Check if the object has an active controlled properties. More...
bool | has_ancestor (const Glib::RefPtr< const Gst::Object >& ancestor) const
| Check if object has an ancestor ancestor somewhere up in the hierarchy. More...
bool | has_as_ancestor (const Glib::RefPtr< Gst::Object >& ancestor) const
| Check if object has an ancestor ancestor somewhere up in the hierarchy. More...
bool | has_as_parent (const Glib::RefPtr< Gst::Object >& parent) const
| Check if parent is the parent of object. More...
Glib::ustring | get_path_string ()
| Generates a string describing the path of object in the object hierarchy. More...
Glib::PropertyProxy< Glib::ustring > | property_name ()
| The name of the object. More...
Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_name () const
| The name of the object. More...
Glib::PropertyProxy< Glib::RefPtr< Gst::Object > > | property_parent ()
| The parent of the object. More...
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Gst::Object > > | property_parent () const
| The parent of the object. More...
Glib::SignalProxy< void, const Glib::RefPtr< Gst::Object >&, GParamSpec*> | signal_deep_notify ()
int | get_refcount () const
Public Member Functions inherited from Glib::Object
| Object (const Object &)=delete
Object & | operator= (const Object &)=delete
| Object (Object &&src) noexcept
Object & | operator= (Object &&src) noexcept
void * | get_data (const QueryQuark &key)
void | set_data (const Quark &key, void *data)
void | set_data (const Quark &key, void *data, DestroyNotify notify)
void | remove_data (const QueryQuark &quark)
void * | steal_data (const QueryQuark &quark)
Glib::RefPtr< Glib::Object > | wrap (GObject *object, bool take_copy=false)
Public Member Functions inherited from Glib::ObjectBase
| ObjectBase (const ObjectBase &)=delete
ObjectBase & | operator= (const ObjectBase &)=delete
void | set_property_value (const Glib::ustring &property_name, const Glib::ValueBase &value)
void | get_property_value (const Glib::ustring &property_name, Glib::ValueBase &value) const
void | set_property (const Glib::ustring &property_name, const PropertyType &value)
void | get_property (const Glib::ustring &property_name, PropertyType &value) const
void | connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void > &slot)
void | connect_property_changed (const Glib::ustring &property_name, sigc::slot< void > &&slot)
sigc::connection | connect_property_changed_with_return (const Glib::ustring &property_name, const sigc::slot< void > &slot)
sigc::connection | connect_property_changed_with_return (const Glib::ustring &property_name, sigc::slot< void > &&slot)
void | freeze_notify ()
void | thaw_notify ()
virtual void | reference () const
virtual void | unreference () const
GObject * | gobj ()
const GObject * | gobj () const
GObject * | gobj_copy () const
Public Member Functions inherited from sigc::trackable
| trackable () noexcept
| trackable (const trackable &src) noexcept
| trackable (trackable &&src)
| ~trackable ()
void | add_destroy_notify_callback (void *data, func_destroy_notify func) const
void | notify_callbacks ()
trackable & | operator= (const trackable &src)
trackable & | operator= (trackable &&src)
void | remove_destroy_notify_callback (void *data) const

## Static Public Member Functions
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system. More...
Static Public Member Functions inherited from Gst::Object
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system. More...
static bool | check_uniqueness (const Glib::ListHandle< const Gst::Object >& list, const Glib::ustring& name)
| Checks to see if there is any object named name in list. More...

## Related Functions
(Note that these are not member functions.)
Glib::RefPtr< Gst::Clock > | wrap (GstClock* object, bool take_copy=false)
| A Glib::wrap() method for this object. More...
Related Functions inherited from Gst::Object
Glib::RefPtr< Gst::Object > | wrap (GstObject* object, bool take_copy=false)
| A Glib::wrap() method for this object. More...

## Additional Inherited Members
Public Types inherited from Glib::Object
typedef void(*)(gpointer data | DestroyNotify)
Public Types inherited from sigc::trackable
typedef internal::func_destroy_notify | func_destroy_notify
Protected Member Functions inherited from Gst::Object
virtual void | on_deep_notify (const Glib::RefPtr< Gst::Object >& prop_object, GParamSpec* prop)
| This is a default handler for the signal signal_deep_notify(). More...
Protected Member Functions inherited from Glib::Object
| Object ()
| Object (const Glib::ConstructParams &construct_params)
| Object (GObject *castitem)
| ~Object () noexceptoverride
Protected Member Functions inherited from Glib::ObjectBase
| ObjectBase ()
| ObjectBase (const char *custom_type_name)
| ObjectBase (const std::type_info &custom_type_info)
| ObjectBase (ObjectBase &&src) noexcept
ObjectBase & | operator= (ObjectBase &&src) noexcept
virtual | ~ObjectBase () noexcept=0
void | initialize (GObject *castitem)
void | initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper)

## Detailed Description

Abstract class for global clocks GStreamer uses a global clock to synchronize the plugins in a pipeline.

Different clock implementations are possible by implementing this abstract base class.

The Gst::Clock returns a monotonically increasing time with the method 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 newsegment events and the element's base time, see Gst::Pipeline.

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

One first needs to create a Gst::ClockID for the periodic or single shot notification using create_single_shot_id() or create_periodic_id().

To perform a blocking wait for the specific time of the Gst::ClockID use the Gst::ClockID::wait(). To receive a callback when the specific time is reached in the clock use Gst::ClockID::wait_async(). Both these calls can be interrupted with the Gst::ClockID::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 it is unscheduled. To schedule a sync periodic callback, Gst::ClockID::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 Gst::ClockID that has been unscheduled cannot be used again for any wait operation, a new Gst::ClockID should be created.

It is possible to perform a blocking wait on the same Gst::ClockID from multiple threads. However, registering the same Gst::ClockID 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 Gst::ClockID, 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 Gst::ClockID has to keep a handle to the Gst::ClockID 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. (The RefPtr takes care of

- * unreffing in this case)

  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 Gst::Clock with the 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 set_calibration(). This feature is mostly useful for plugins that have an internal clock but must operate with another clock selected by the Gst::Pipeline. They can track the offset and rate difference of their internal clock relative to the master clock by using the get_calibration() method.

  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.

  Last reviewed on 2016-05-16 (1.8.0)

## Constructor & Destructor Documentation

## § Clock()

Gst::Clock::Clock | ( | Clock&& | src | ) |
| noexcept

## § ~Clock()

Gst::Clock::~Clock | ( |  | ) |
| override noexcept

## Member Function Documentation

## § add_observation() [1/2]

bool Gst::Clock::add_observation | ( | Gst::ClockTime | slave_time,
|  | Gst::ClockTime | master_time,
|  | gdouble & | result
| ) |  |

The time master_time of the master clock and the time slave_time 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 clock is recalibrated.

If this functions returns `true`, result 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

  slave_time | A time on the slave.
  master_time | A time on the master.
  result | A pointer to hold the result.

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

MT safe.

## § add_observation() [2/2]

bool Gst::Clock::add_observation | ( | Gst::ClockTime | slave_time,
|  | Gst::ClockTime | master_time,
|  | gdouble & | result,
|  | Gst::ClockTime& | internal,
|  | Gst::ClockTime& | external,
|  | Gst::ClockTime& | rate_num,
|  | Gst::ClockTime& | rate_denom
| ) |  |

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 set_calibration() with the values, or some modified version of them.

Parameters

  slave_time | A time on the slave.
  master_time | A time on the master.
  result | 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.

## § adjust_unlocked()

Gst::ClockTime Gst::Clock::adjust_unlocked | ( | Gst::ClockTime | internal_time | ) |

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

Parameters

  internal_time | A clock time.

Returns
  The converted time of the clock.

## § adjust_with_calibration()

Gst::ClockTime Gst::Clock::adjust_with_calibration | ( | Gst::ClockTime | internal_target,
|  | Gst::ClockTime | cinternal,
|  | Gst::ClockTime | cexternal,
|  | Gst::ClockTime | cnum,
|  | Gst::ClockTime | cdenom
| ) |  |

Converts the given internal_target clock time to the external time, using the passed calibration parameters.

This function performs the same calculation as adjust_unlocked() when called using the current calibration parameters, but doesn't ensure a monotonically increasing result as adjust_unlocked() does.

Note
  The clock parameter is unused and can be `nullptr`

Parameters

  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.

## § change_resolution_vfunc()

virtual Gst::ClockTime Gst::Clock::change_resolution_vfunc | ( | Gst::ClockTime | old_resolution,
|  | Gst::ClockTime | new_resolution
| ) |  |
| virtual

Change the resolution of the clock.

Not all values might be acceptable. The new resolution should be returned.

## § create_periodic_id()

Glib::RefPtr<Gst::ClockID> Gst::Clock::create_periodic_id | ( | Gst::ClockTime | start_time,
|  | Gst::ClockTime | intervals
| ) |  |

Get 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 intervals. id should be unreffed after usage.

Free-function: gst_clock_id_unref

Parameters

  start_time | The requested start time.
  intervals | The requested interval.

Returns
  A Gst::ClockID that can be used to request the time notification.

MT safe.

## § create_single_shot_id()

Glib::RefPtr<Gst::ClockID> Gst::Clock::create_single_shot_id | ( | Gst::ClockTime | time | ) |

Get a Gst::ClockID from clock to trigger a single shot notification at the requested time.

The single shot id should be unreffed after usage.

Free-function: gst_clock_id_unref

Parameters

  time | The requested time.

Returns
  A Gst::ClockID that can be used to request the time notification.

MT safe.

## § get_calibration()

void Gst::Clock::get_calibration | ( | Gst::ClockTime& | internal,
|  | Gst::ClockTime& | external,
|  | Gst::ClockTime& | rate_num,
|  | Gst::ClockTime& | rate_denom
| ) |  | const

Gets the internal rate and reference time of clock.

See set_calibration() for more information.

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

MT safe.

Parameters

  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.

## § get_internal_time()

Gst::ClockTime Gst::Clock::get_internal_time | ( |  | ) | const

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.

MT safe.

## § get_internal_time_vfunc()

virtual Gst::ClockTime Gst::Clock::get_internal_time_vfunc | ( |  | ) | const
| virtual

Get the internal unadjusted time of the clock.

## § get_master() [1/2]

Glib::RefPtr<Gst::Clock> Gst::Clock::get_master | ( |  | ) |

Get the master clock that clock is slaved to or `nullptr` when the clock is not slaved to any master clock.

Returns
  A master Gst::Clock or `nullptr` when this clock is not slaved to a master clock. Unref after usage.

MT safe.

## § get_master() [2/2]

Glib::RefPtr<const Gst::Clock> Gst::Clock::get_master | ( |  | ) | const

Get the master clock that clock is slaved to or `nullptr` when the clock is not slaved to any master clock.

Returns
  A master Gst::Clock or `nullptr` when this clock is not slaved to a master clock. Unref after usage.

MT safe.

## § get_resolution()

Gst::ClockTime Gst::Clock::get_resolution | ( |  | ) | const

Get the accuracy of the clock.

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

Returns
  The resolution of the clock in units of Gst::ClockTime.

MT safe.

## § get_resolution_vfunc()

virtual Gst::ClockTime Gst::Clock::get_resolution_vfunc | ( |  | ) | const
| virtual

Get the resolution of the clock.

## § get_time()

Gst::ClockTime Gst::Clock::get_time | ( |  | ) | const

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.

MT safe.

## § get_type()

static GType Gst::Clock::get_type | ( |  | ) |
| static

Get the GType for this class, for use with the underlying GObject type system.

## § gobj() [1/2]

GstClock* Gst::Clock::gobj | ( |  | ) |
| inline

Provides access to the underlying C GObject.

## § gobj() [2/2]

const GstClock* Gst::Clock::gobj | ( |  | ) | const
| inline

Provides access to the underlying C GObject.

## § gobj_copy()

GstClock* Gst::Clock::gobj_copy | ( |  | ) |

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

## § is_synced()

bool Gst::Clock::is_synced | ( |  | ) | const

Checks if the clock is currently synced.

This returns if GST_CLOCK_FLAG_NEEDS_STARTUP_SYNC is not set on the clock.

Returns
  `true` if the clock is currently synced.

## § operator=()

Clock& Gst::Clock::operator= | ( | Clock&& | src | ) |
| noexcept

## § periodic_id_reinit()

bool Gst::Clock::periodic_id_reinit | ( | const Glib::RefPtr< Gst::ClockID >& | id,
|  | Gst::ClockTime | start_time,
|  | Gst::ClockTime | interval
| ) |  |

Reinitializes the provided periodic id to the provided start time and interval.

Does not modify the reference count.

Parameters

  id | A Gst::ClockID.
  start_time | The requested start time.
  interval | The requested interval.

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

## § property_timeout() [1/2]

Glib::PropertyProxy< guint64 > Gst::Clock::property_timeout | ( |  | ) |

get/set timeout can be achieved through 'timeout' property, so wrapping gst_clock_{get|set|_timeout is unnecessary.

The amount of time, in nanoseconds, to sample master and slave clocks.

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## § property_timeout() [2/2]

Glib::PropertyProxy_ReadOnly< guint64 > Gst::Clock::property_timeout | ( |  | ) | const

The amount of time, in nanoseconds, to sample master and slave clocks.

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## § property_window_size() [1/2]

Glib::PropertyProxy< int > Gst::Clock::property_window_size | ( |  | ) |

The size of the window used to calculate rate and offset.

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## § property_window_size() [2/2]

Glib::PropertyProxy_ReadOnly< int > Gst::Clock::property_window_size | ( |  | ) | const

The size of the window used to calculate rate and offset.

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## § property_window_threshold() [1/2]

Glib::PropertyProxy< int > Gst::Clock::property_window_threshold | ( |  | ) |

The threshold to start calculating rate and offset.

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## § property_window_threshold() [2/2]

Glib::PropertyProxy_ReadOnly< int > Gst::Clock::property_window_threshold | ( |  | ) | const

The threshold to start calculating rate and offset.

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## § set_calibration()

void Gst::Clock::set_calibration | ( | Gst::ClockTime | internal,
|  | Gst::ClockTime | external,
|  | Gst::ClockTime | rate_num,
|  | Gst::ClockTime | 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 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 get_internal_time() when this function is called.

Subsequent calls to get_time() will return clock times computed as follows:

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

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

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

MT safe.

Parameters

  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.

## § set_master()

bool Gst::Clock::set_master | ( | const Clock& | master_clock | ) |

Set master_clock as the master clock for clock.

clock will be automatically calibrated so that 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 get_calibration().

master_clock can be `nullptr` 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

  master_clock | A master Gst::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 Gst::CLOCK_FLAG_CAN_SET_MASTER flag will make this function return `false`.

MT safe.

## § set_resolution()

Gst::ClockTime Gst::Clock::set_resolution | ( | Gst::ClockTime | resolution | ) |

Set 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

  resolution | The resolution to set.

Returns
  The new resolution of the clock.

## § set_synced()

void Gst::Clock::set_synced | ( | bool | synced | ) |

Sets clock to synced and emits the GstClock::synced signal, and wakes up any thread waiting in 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

  synced | If the clock is synced.

## § signal_synced()

Glib::SignalProxy< void,bool > Gst::Clock::signal_synced | ( |  | ) |

Slot Prototype:
  `void on_my_synced(bool synced)`

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

  synced | If the clock is synced now.

## § single_shot_id_reinit()

bool Gst::Clock::single_shot_id_reinit | ( | const Glib::RefPtr< Gst::ClockID >& | id,
|  | Gst::ClockTime | time
| ) |  |

Reinitializes the provided single shot id to the provided time.

Does not modify the reference count.

Parameters

  id | A Gst::ClockID.
  time | The requested time.

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

## § unadjust_unlocked()

Gst::ClockTime Gst::Clock::unadjust_unlocked | ( | Gst::ClockTime | external_time | ) |

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

Parameters

  external_time | An external clock time.

Returns
  The internal time of the clock corresponding to external_time.

## § unadjust_with_calibration()

Gst::ClockTime Gst::Clock::unadjust_with_calibration | ( | Gst::ClockTime | external_target,
|  | Gst::ClockTime | cinternal,
|  | Gst::ClockTime | cexternal,
|  | Gst::ClockTime | cnum,
|  | Gst::ClockTime | cdenom
| ) |  |

Converts the given external_target clock time to the internal time, using the passed calibration parameters.

This function performs the same calculation as unadjust_unlocked() when called using the current calibration parameters.

Note
  The clock parameter is unused and can be `nullptr`

Parameters

  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.

## § unschedule_vfunc()

virtual void Gst::Clock::unschedule_vfunc | ( | const Glib::RefPtr< Gst::ClockID >& | id | ) |
| virtual

Unblock a blocking or async wait operation.

## § wait_async_vfunc()

virtual ClockReturn Gst::Clock::wait_async_vfunc | ( | const Glib::RefPtr< Gst::ClockID >& | id | ) |
| virtual

Perform an asynchronous wait for the given Gst::ClockID.

## § wait_for_sync()

bool Gst::Clock::wait_for_sync | ( | Gst::ClockTime | 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 GstClock::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

  timeout | Timeout for waiting or Gst::CLOCK_TIME_NONE.

Returns
  `true` if waiting was successful, or `false` on timeout.

## § wait_vfunc()

virtual ClockReturn Gst::Clock::wait_vfunc | ( | const Glib::RefPtr< Gst::ClockID >& | id,
|  | Gst::ClockTimeDiff& | jitter
| ) |  |
| virtual

Perform a blocking wait for the given Gst::ClockID.

Deprecated, implement wait_jitter_vfunc() instead.

## Friends And Related Function Documentation

## § wrap()

Glib::RefPtr< Gst::Clock > wrap | ( | GstClock * | object,
|  | bool | take_copy = `false`
| ) |  |
| related

A Glib::wrap() method for this object.

Parameters

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns
  A C++ instance that wraps this C instance.