Top | ![]() |
![]() |
![]() |
![]() |
GstPtpClockGstPtpClock — Special clock that synchronizes to a remote time provider via PTP (IEEE1588:2008). |
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.
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.
clock_id |
PTP clock id of this process' clock or |
|
interfaces |
network interfaces to run the clock on. |
[transfer none][array zero-terminated=1] |
Since: 1.6
void
gst_ptp_deinit (void
);
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
gboolean
gst_ptp_is_initialized (void
);
Check if the GStreamer PTP clock subsystem is initialized.
Since: 1.6
gboolean
gst_ptp_is_supported (void
);
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
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()
.
Since: 1.6
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.
callback |
GstPtpStatisticsCallback to call |
|
user_data |
Data to pass to the callback |
|
destroy_data |
GDestroyNotify to destroy the data |
Since: 1.6
void
gst_ptp_statistics_callback_remove (gulong id
);
Removes a PTP statistics callback that was previously added with
gst_ptp_statistics_callback_add()
.
Since: 1.6