GstPtpClock
GstPtpClock implements a PTP (IEEE1588:2008) ordinary clock in slave-only mode, that allows a GStreamer pipeline to synchronize to a PTP network clock in some specific domain.
The PTP subsystem can be initialized with gst_ptp_init, which then starts a helper process to do the actual communication via the PTP ports. This is required as PTP listens on ports < 1024 and thus requires special privileges. Once this helper process is started, the main process will synchronize to all PTP domains that are detected on the selected interfaces.
gst_ptp_clock_new then allows to create a GstClock that provides the PTP time from a master clock inside a specific PTP domain. This clock will only return valid timestamps once the timestamps in the PTP domain are known. To check this, you can use gst_clock_wait_for_sync, the GstClock::synced signal and gst_clock_is_synced.
To gather statistics about the PTP clock synchronization, gst_ptp_statistics_callback_add can be used. This gives the application the possibility to collect all kinds of statistics from the clock synchronization.
GstPtpClock
GObject ╰──GInitiallyUnowned ╰──GstObject ╰──GstClock ╰──GstSystemClock ╰──GstPtpClock
Opaque GstPtpClock structure.
Members
clock
(GstSystemClock)
–
Class structure
GstPtpClockClass
Opaque GstPtpClockClass structure.
Fields
parent_class
(GstSystemClockClass)
–
parented to GstSystemClockClass
GstNet.PtpClockClass
Opaque GstNet.PtpClockClass structure.
Attributes
parent_class
(Gst.SystemClockClass)
–
parented to Gst.SystemClockClass
GstNet.PtpClockClass
Opaque GstNet.PtpClockClass structure.
Attributes
parent_class
(Gst.SystemClockClass)
–
parented to Gst.SystemClockClass
GstNet.PtpClock
GObject.Object ╰──GObject.InitiallyUnowned ╰──Gst.Object ╰──Gst.Clock ╰──Gst.SystemClock ╰──GstNet.PtpClock
Opaque GstNet.PtpClock structure.
Members
clock
(Gst.SystemClock)
–
GstNet.PtpClock
GObject.Object ╰──GObject.InitiallyUnowned ╰──Gst.Object ╰──Gst.Clock ╰──Gst.SystemClock ╰──GstNet.PtpClock
Opaque GstNet.PtpClock structure.
Members
clock
(Gst.SystemClock)
–
Constructors
gst_ptp_clock_new
GstClock * gst_ptp_clock_new (const gchar * name, guint domain)
Creates a new PTP clock instance that exports the PTP time of the master clock in domain. This clock can be slaved to other clocks as needed.
If gst_ptp_init was not called before, this will call gst_ptp_init with default parameters.
This clock only returns valid timestamps after it received the first times from the PTP master clock on the network. Once this happens the GstPtpClock::internal-clock property will become non-NULL. You can check this with gst_clock_wait_for_sync, the GstClock::synced signal and gst_clock_is_synced.
Parameters:
name
(
[nullable])
–
Name of the clock
domain
–
PTP domain
A new GstClock
Since : 1.6
GstNet.PtpClock.prototype.new
function GstNet.PtpClock.prototype.new(name: String, domain: Number): {
// javascript wrapper for 'gst_ptp_clock_new'
}
Creates a new PTP clock instance that exports the PTP time of the master clock in domain. This clock can be slaved to other clocks as needed.
If GstNet.prototype.ptp_init was not called before, this will call GstNet.prototype.ptp_init with default parameters.
This clock only returns valid timestamps after it received the first times from the PTP master clock on the network. Once this happens the GstPtpClock::internal-clock property will become non-NULL. You can check this with Gst.Clock.prototype.wait_for_sync, the GstClock::synced signal and Gst.Clock.prototype.is_synced.
Since : 1.6
GstNet.PtpClock.new
def GstNet.PtpClock.new (name, domain):
#python wrapper for 'gst_ptp_clock_new'
Creates a new PTP clock instance that exports the PTP time of the master clock in domain. This clock can be slaved to other clocks as needed.
If GstNet.ptp_init was not called before, this will call GstNet.ptp_init with default parameters.
This clock only returns valid timestamps after it received the first times from the PTP master clock on the network. Once this happens the GstPtpClock::internal-clock property will become non-NULL. You can check this with Gst.Clock.wait_for_sync, the GstClock::synced signal and Gst.Clock.is_synced.
Since : 1.6
Properties
Functions
gst_ptp_deinit
gst_ptp_deinit ()
Deinitialize the GStreamer PTP subsystem and stop the PTP clock. If there are any remaining GstPtpClock instances, they won't be further synchronized to the PTP network clock.
Since : 1.6
GstNet.prototype.ptp_deinit
function GstNet.prototype.ptp_deinit(): {
// javascript wrapper for 'gst_ptp_deinit'
}
Deinitialize the GStreamer PTP subsystem and stop the PTP clock. If there are any remaining GstPtpClock instances, they won't be further synchronized to the PTP network clock.
Since : 1.6
GstNet.ptp_deinit
def GstNet.ptp_deinit ():
#python wrapper for 'gst_ptp_deinit'
Deinitialize the GStreamer PTP subsystem and stop the PTP clock. If there are any remaining GstPtpClock instances, they won't be further synchronized to the PTP network clock.
Since : 1.6
gst_ptp_init
gboolean gst_ptp_init (guint64 clock_id, gchar ** interfaces)
Initialize the GStreamer PTP subsystem and create a PTP ordinary clock in slave-only mode for all domains on the given interfaces with the given clock_id.
If clock_id is GST_PTP_CLOCK_ID_NONE, a clock id is automatically generated from the MAC address of the first network interface.
This function is automatically called by gst_ptp_clock_new with default parameters if it wasn't called before.
Parameters:
clock_id
–
PTP clock id of this process' clock or GST_PTP_CLOCK_ID_NONE
interfaces
(
[transfer: none][arrayzero-terminated=1][allow-none])
–
network interfaces to run the clock on
TRUE if the GStreamer PTP clock subsystem could be initialized.
Since : 1.6
GstNet.prototype.ptp_init
function GstNet.prototype.ptp_init(clock_id: Number, interfaces: [ String ]): {
// javascript wrapper for 'gst_ptp_init'
}
Initialize the GStreamer PTP subsystem and create a PTP ordinary clock in slave-only mode for all domains on the given interfaces with the given clock_id.
If clock_id is GstNet.PTP_CLOCK_ID_NONE, a clock id is automatically generated from the MAC address of the first network interface.
This function is automatically called by GstNet.PtpClock.prototype.new with default parameters if it wasn't called before.
Parameters:
PTP clock id of this process' clock or GstNet.PTP_CLOCK_ID_NONE
network interfaces to run the clock on
Since : 1.6
GstNet.ptp_init
def GstNet.ptp_init (clock_id, interfaces):
#python wrapper for 'gst_ptp_init'
Initialize the GStreamer PTP subsystem and create a PTP ordinary clock in slave-only mode for all domains on the given interfaces with the given clock_id.
If clock_id is GstNet.PTP_CLOCK_ID_NONE, a clock id is automatically generated from the MAC address of the first network interface.
This function is automatically called by GstNet.PtpClock.new with default parameters if it wasn't called before.
Parameters:
PTP clock id of this process' clock or GstNet.PTP_CLOCK_ID_NONE
network interfaces to run the clock on
Since : 1.6
gst_ptp_init_full
gboolean gst_ptp_init_full (const GstStructure * config)
Initialize the GStreamer PTP subsystem and create a PTP ordinary clock in slave-only mode according to the config.
config is a GstStructure with the following optional fields:
-
guint64
clock-id
: The clock ID to use for the local clock. If the clock-id is not provided or GST_PTP_CLOCK_ID_NONE is provided, a clock id is automatically generated from the MAC address of the first network interface. -
GStrv
interfaces
: The interface names to listen on for PTP packets. If none are provided then all compatible interfaces will be used. -
guint
ttl
: The TTL to use for multicast packets sent out by GStreamer. This defaults to 1, i.e. packets will not leave the local network.
This function is automatically called by gst_ptp_clock_new with default parameters if it wasn't called before.
Parameters:
config
–
Configuration for initializing the GStreamer PTP subsystem
TRUE if the GStreamer PTP clock subsystem could be initialized.
Since : 1.24
GstNet.prototype.ptp_init_full
function GstNet.prototype.ptp_init_full(config: Gst.Structure): {
// javascript wrapper for 'gst_ptp_init_full'
}
Initialize the GStreamer PTP subsystem and create a PTP ordinary clock in slave-only mode according to the config.
config is a Gst.Structure with the following optional fields:
-
Number
clock-id
: The clock ID to use for the local clock. If the clock-id is not provided or GstNet.PTP_CLOCK_ID_NONE is provided, a clock id is automatically generated from the MAC address of the first network interface. -
GStrv (not introspectable)
interfaces
: The interface names to listen on for PTP packets. If none are provided then all compatible interfaces will be used. -
Number
ttl
: The TTL to use for multicast packets sent out by GStreamer. This defaults to 1, i.e. packets will not leave the local network.
This function is automatically called by GstNet.PtpClock.prototype.new with default parameters if it wasn't called before.
Parameters:
Configuration for initializing the GStreamer PTP subsystem
Since : 1.24
GstNet.ptp_init_full
def GstNet.ptp_init_full (config):
#python wrapper for 'gst_ptp_init_full'
Initialize the GStreamer PTP subsystem and create a PTP ordinary clock in slave-only mode according to the config.
config is a Gst.Structure with the following optional fields:
-
int
clock-id
: The clock ID to use for the local clock. If the clock-id is not provided or GstNet.PTP_CLOCK_ID_NONE is provided, a clock id is automatically generated from the MAC address of the first network interface. -
GStrv (not introspectable)
interfaces
: The interface names to listen on for PTP packets. If none are provided then all compatible interfaces will be used. -
int
ttl
: The TTL to use for multicast packets sent out by GStreamer. This defaults to 1, i.e. packets will not leave the local network.
This function is automatically called by GstNet.PtpClock.new with default parameters if it wasn't called before.
Parameters:
Configuration for initializing the GStreamer PTP subsystem
Since : 1.24
gst_ptp_is_initialized
gboolean gst_ptp_is_initialized ()
Check if the GStreamer PTP clock subsystem is initialized.
TRUE if the GStreamer PTP clock subsystem is initialized.
Since : 1.6
GstNet.prototype.ptp_is_initialized
function GstNet.prototype.ptp_is_initialized(): {
// javascript wrapper for 'gst_ptp_is_initialized'
}
Check if the GStreamer PTP clock subsystem is initialized.
Since : 1.6
gst_ptp_is_supported
gboolean gst_ptp_is_supported ()
Check if PTP clocks are generally supported on this system, and if previous initializations did not fail.
TRUE if PTP clocks are generally supported on this system, and previous initializations did not fail.
Since : 1.6
GstNet.prototype.ptp_is_supported
function GstNet.prototype.ptp_is_supported(): {
// javascript wrapper for 'gst_ptp_is_supported'
}
Check if PTP clocks are generally supported on this system, and if previous initializations did not fail.
Since : 1.6
GstNet.ptp_is_supported
def GstNet.ptp_is_supported ():
#python wrapper for 'gst_ptp_is_supported'
Check if PTP clocks are generally supported on this system, and if previous initializations did not fail.
Since : 1.6
gst_ptp_statistics_callback_add
gulong gst_ptp_statistics_callback_add (GstPtpStatisticsCallback callback, gpointer user_data, GDestroyNotify destroy_data)
Installs a new statistics callback for gathering PTP statistics. See GstPtpStatisticsCallback for a list of statistics that are provided.
Parameters:
callback
–
GstPtpStatisticsCallback to call
user_data
–
Data to pass to the callback
destroy_data
–
GDestroyNotify to destroy the data
Id for the callback that can be passed to gst_ptp_statistics_callback_remove
Since : 1.6
GstNet.prototype.ptp_statistics_callback_add
function GstNet.prototype.ptp_statistics_callback_add(callback: GstNet.PtpStatisticsCallback, user_data: Object): {
// javascript wrapper for 'gst_ptp_statistics_callback_add'
}
Installs a new statistics callback for gathering PTP statistics. See GstPtpStatisticsCallback for a list of statistics that are provided.
Parameters:
GstPtpStatisticsCallback to call
Data to pass to the callback
Id for the callback that can be passed to GstNet.prototype.ptp_statistics_callback_remove
Since : 1.6
GstNet.ptp_statistics_callback_add
def GstNet.ptp_statistics_callback_add (callback, *user_data):
#python wrapper for 'gst_ptp_statistics_callback_add'
Installs a new statistics callback for gathering PTP statistics. See GstPtpStatisticsCallback for a list of statistics that are provided.
Parameters:
GstPtpStatisticsCallback to call
Data to pass to the callback
Id for the callback that can be passed to GstNet.ptp_statistics_callback_remove
Since : 1.6
gst_ptp_statistics_callback_remove
gst_ptp_statistics_callback_remove (gulong id)
Removes a PTP statistics callback that was previously added with gst_ptp_statistics_callback_add.
Parameters:
id
–
Callback id to remove
Since : 1.6
GstNet.prototype.ptp_statistics_callback_remove
function GstNet.prototype.ptp_statistics_callback_remove(id: Number): {
// javascript wrapper for 'gst_ptp_statistics_callback_remove'
}
Removes a PTP statistics callback that was previously added with GstNet.prototype.ptp_statistics_callback_add.
Parameters:
Callback id to remove
Since : 1.6
GstNet.ptp_statistics_callback_remove
def GstNet.ptp_statistics_callback_remove (id):
#python wrapper for 'gst_ptp_statistics_callback_remove'
Removes a PTP statistics callback that was previously added with GstNet.ptp_statistics_callback_add.
Parameters:
Callback id to remove
Since : 1.6
Constants
GST_PTP_CLOCK_ID_NONE
#define GST_PTP_CLOCK_ID_NONE ((guint64) -1)
PTP clock identification that can be passed to gst_ptp_init to automatically select one based on the MAC address of interfaces
GstNet.PTP_CLOCK_ID_NONE
PTP clock identification that can be passed to GstNet.prototype.ptp_init to automatically select one based on the MAC address of interfaces
GstNet.PTP_CLOCK_ID_NONE
PTP clock identification that can be passed to GstNet.ptp_init to automatically select one based on the MAC address of interfaces
GST_PTP_STATISTICS_BEST_MASTER_CLOCK_SELECTED
#define GST_PTP_STATISTICS_BEST_MASTER_CLOCK_SELECTED "GstPtpStatisticsBestMasterClockSelected"
GstNet.PTP_STATISTICS_BEST_MASTER_CLOCK_SELECTED
GstNet.PTP_STATISTICS_BEST_MASTER_CLOCK_SELECTED
GST_PTP_STATISTICS_NEW_DOMAIN_FOUND
#define GST_PTP_STATISTICS_NEW_DOMAIN_FOUND "GstPtpStatisticsNewDomainFound"
GstNet.PTP_STATISTICS_NEW_DOMAIN_FOUND
GstNet.PTP_STATISTICS_NEW_DOMAIN_FOUND
GST_PTP_STATISTICS_PATH_DELAY_MEASURED
#define GST_PTP_STATISTICS_PATH_DELAY_MEASURED "GstPtpStatisticsPathDelayMeasured"
GstNet.PTP_STATISTICS_PATH_DELAY_MEASURED
GstNet.PTP_STATISTICS_PATH_DELAY_MEASURED
GST_PTP_STATISTICS_TIME_UPDATED
#define GST_PTP_STATISTICS_TIME_UPDATED "GstPtpStatisticsTimeUpdated"
GstNet.PTP_STATISTICS_TIME_UPDATED
GstNet.PTP_STATISTICS_TIME_UPDATED
GST_TYPE_PTP_CLOCK
#define GST_TYPE_PTP_CLOCK \ (gst_ptp_clock_get_type())
Callbacks
GstPtpStatisticsCallback
gboolean (*GstPtpStatisticsCallback) (guint8 domain, const GstStructure * stats, gpointer user_data)
The statistics can be the following structures:
GST_PTP_STATISTICS_NEW_DOMAIN_FOUND: "domain" G_TYPE_UINT The domain identifier of the domain "clock" GST_TYPE_CLOCK The internal clock that is slaved to the PTP domain
GST_PTP_STATISTICS_BEST_MASTER_CLOCK_SELECTED: "domain" G_TYPE_UINT The domain identifier of the domain "master-clock-id" G_TYPE_UINT64 PTP clock identifier of the selected master clock "master-clock-port" G_TYPE_UINT PTP port number of the selected master clock "grandmaster-clock-id" G_TYPE_UINT64 PTP clock identifier of the grandmaster clock
GST_PTP_STATISTICS_PATH_DELAY_MEASURED: "domain" G_TYPE_UINT The domain identifier of the domain "mean-path-delay-avg" GST_TYPE_CLOCK_TIME Average mean path delay "mean-path-delay" GST_TYPE_CLOCK_TIME Latest mean path delay "delay-request-delay" GST_TYPE_CLOCK_TIME Delay of DELAY_REQ / DELAY_RESP messages
GST_PTP_STATISTICS_TIME_UPDATED: "domain" G_TYPE_UINT The domain identifier of the domain "mean-path-delay-avg" GST_TYPE_CLOCK_TIME Average mean path delay "local-time" GST_TYPE_CLOCK_TIME Local time that corresponds to ptp-time "ptp-time" GST_TYPE_CLOCK_TIME Newly measured PTP time at local-time "estimated-ptp-time" GST_TYPE_CLOCK_TIME Estimated PTP time based on previous measurements "discontinuity" G_TYPE_INT64 Difference between estimated and measured PTP time "synced" G_TYPE_BOOLEAN Currently synced to the remote clock "r-squared" G_TYPE_DOUBLE R² of clock estimation regression "internal-time" GST_TYPE_CLOCK_TIME Internal time clock parameter "external-time" GST_TYPE_CLOCK_TIME External time clock parameter "rate-num" G_TYPE_UINT64 Internal/external rate numerator "rate-den" G_TYPE_UINT64 Internal/external rate denominator "rate" G_TYPE_DOUBLE Internal/external rate
If FALSE is returned, the callback is removed and never called again.
Parameters:
domain
–
PTP domain identifier
stats
–
New statistics
user_data
–
Data passed to gst_ptp_statistics_callback_add
GstNet.PtpStatisticsCallback
function GstNet.PtpStatisticsCallback(domain: Number, stats: Gst.Structure, user_data: Object): {
// javascript wrapper for 'GstPtpStatisticsCallback'
}
The statistics can be the following structures:
GST_PTP_STATISTICS_NEW_DOMAIN_FOUND: "domain" G_TYPE_UINT The domain identifier of the domain "clock" GST_TYPE_CLOCK The internal clock that is slaved to the PTP domain
GST_PTP_STATISTICS_BEST_MASTER_CLOCK_SELECTED: "domain" G_TYPE_UINT The domain identifier of the domain "master-clock-id" G_TYPE_UINT64 PTP clock identifier of the selected master clock "master-clock-port" G_TYPE_UINT PTP port number of the selected master clock "grandmaster-clock-id" G_TYPE_UINT64 PTP clock identifier of the grandmaster clock
GST_PTP_STATISTICS_PATH_DELAY_MEASURED: "domain" G_TYPE_UINT The domain identifier of the domain "mean-path-delay-avg" GST_TYPE_CLOCK_TIME Average mean path delay "mean-path-delay" GST_TYPE_CLOCK_TIME Latest mean path delay "delay-request-delay" GST_TYPE_CLOCK_TIME Delay of DELAY_REQ / DELAY_RESP messages
GST_PTP_STATISTICS_TIME_UPDATED: "domain" G_TYPE_UINT The domain identifier of the domain "mean-path-delay-avg" GST_TYPE_CLOCK_TIME Average mean path delay "local-time" GST_TYPE_CLOCK_TIME Local time that corresponds to ptp-time "ptp-time" GST_TYPE_CLOCK_TIME Newly measured PTP time at local-time "estimated-ptp-time" GST_TYPE_CLOCK_TIME Estimated PTP time based on previous measurements "discontinuity" G_TYPE_INT64 Difference between estimated and measured PTP time "synced" G_TYPE_BOOLEAN Currently synced to the remote clock "r-squared" G_TYPE_DOUBLE R² of clock estimation regression "internal-time" GST_TYPE_CLOCK_TIME Internal time clock parameter "external-time" GST_TYPE_CLOCK_TIME External time clock parameter "rate-num" G_TYPE_UINT64 Internal/external rate numerator "rate-den" G_TYPE_UINT64 Internal/external rate denominator "rate" G_TYPE_DOUBLE Internal/external rate
If false is returned, the callback is removed and never called again.
Parameters:
PTP domain identifier
New statistics
Data passed to GstNet.prototype.ptp_statistics_callback_add
GstNet.PtpStatisticsCallback
def GstNet.PtpStatisticsCallback (domain, stats, *user_data):
#python wrapper for 'GstPtpStatisticsCallback'
The statistics can be the following structures:
GST_PTP_STATISTICS_NEW_DOMAIN_FOUND: "domain" G_TYPE_UINT The domain identifier of the domain "clock" GST_TYPE_CLOCK The internal clock that is slaved to the PTP domain
GST_PTP_STATISTICS_BEST_MASTER_CLOCK_SELECTED: "domain" G_TYPE_UINT The domain identifier of the domain "master-clock-id" G_TYPE_UINT64 PTP clock identifier of the selected master clock "master-clock-port" G_TYPE_UINT PTP port number of the selected master clock "grandmaster-clock-id" G_TYPE_UINT64 PTP clock identifier of the grandmaster clock
GST_PTP_STATISTICS_PATH_DELAY_MEASURED: "domain" G_TYPE_UINT The domain identifier of the domain "mean-path-delay-avg" GST_TYPE_CLOCK_TIME Average mean path delay "mean-path-delay" GST_TYPE_CLOCK_TIME Latest mean path delay "delay-request-delay" GST_TYPE_CLOCK_TIME Delay of DELAY_REQ / DELAY_RESP messages
GST_PTP_STATISTICS_TIME_UPDATED: "domain" G_TYPE_UINT The domain identifier of the domain "mean-path-delay-avg" GST_TYPE_CLOCK_TIME Average mean path delay "local-time" GST_TYPE_CLOCK_TIME Local time that corresponds to ptp-time "ptp-time" GST_TYPE_CLOCK_TIME Newly measured PTP time at local-time "estimated-ptp-time" GST_TYPE_CLOCK_TIME Estimated PTP time based on previous measurements "discontinuity" G_TYPE_INT64 Difference between estimated and measured PTP time "synced" G_TYPE_BOOLEAN Currently synced to the remote clock "r-squared" G_TYPE_DOUBLE R² of clock estimation regression "internal-time" GST_TYPE_CLOCK_TIME Internal time clock parameter "external-time" GST_TYPE_CLOCK_TIME External time clock parameter "rate-num" G_TYPE_UINT64 Internal/external rate numerator "rate-den" G_TYPE_UINT64 Internal/external rate denominator "rate" G_TYPE_DOUBLE Internal/external rate
If False is returned, the callback is removed and never called again.
The results of the search are