*/
/**
* SECTION:gstptpclock
+ * @title: GstPtpClock
* @short_description: Special clock that synchronizes to a remote time
* provider via PTP (IEEE1588:2008).
* @see_also: #GstClock, #GstNetClientClock, #GstPipeline
* 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
#include <sys/wait.h>
#endif
#ifdef G_OS_WIN32
+#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
#include <sys/types.h>
+
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#elif defined(G_OS_WIN32)
+#include <io.h>
+#endif
#include <gst/base/base.h>
sizeof (header), &written, &err);
if (status == G_IO_STATUS_ERROR) {
g_warning ("Failed to write to stdout: %s", err->message);
+ g_clear_error (&err);
return G_SOURCE_REMOVE;
} else if (status == G_IO_STATUS_EOF) {
g_message ("EOF on stdout");
(const gchar *) delay_req, 44, &written, &err);
if (status == G_IO_STATUS_ERROR) {
g_warning ("Failed to write to stdout: %s", err->message);
+ g_clear_error (&err);
g_main_loop_quit (main_loop);
return G_SOURCE_REMOVE;
} else if (status == G_IO_STATUS_EOF) {
&read, &err);
if (status == G_IO_STATUS_ERROR) {
GST_ERROR ("Failed to read from stdin: %s", err->message);
+ g_clear_error (&err);
g_main_loop_quit (main_loop);
return G_SOURCE_REMOVE;
} else if (status == G_IO_STATUS_EOF) {
status = g_io_channel_read_chars (channel, buffer, header.size, &read, &err);
if (status == G_IO_STATUS_ERROR) {
GST_ERROR ("Failed to read from stdin: %s", err->message);
+ g_clear_error (&err);
g_main_loop_quit (main_loop);
return G_SOURCE_REMOVE;
} else if (status == G_IO_STATUS_EOF) {
/**
* gst_ptp_init:
* @clock_id: PTP clock id of this process' clock or %GST_PTP_CLOCK_ID_NONE
- * @interfaces: (transfer none) (array zero-terminated=1): network interfaces to run the clock on
+ * @interfaces: (transfer none) (array zero-terminated=1) (allow-none): network interfaces to run the clock on
*
* Initialize the GStreamer PTP subsystem and create a PTP ordinary clock in
* slave-only mode for all domains on the given @interfaces with the
* 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.
*
{
PROP_0,
PROP_DOMAIN,
- PROP_INTERNAL_CLOCK
+ PROP_INTERNAL_CLOCK,
+ PROP_MASTER_CLOCK_ID,
+ PROP_GRANDMASTER_CLOCK_ID
};
#define GST_PTP_CLOCK_GET_PRIVATE(obj) \
"Internal clock", GST_TYPE_CLOCK,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (gobject_class, PROP_MASTER_CLOCK_ID,
+ g_param_spec_uint64 ("master-clock-id", "Master Clock ID",
+ "Master Clock ID", 0, G_MAXUINT64, 0,
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (gobject_class, PROP_GRANDMASTER_CLOCK_ID,
+ g_param_spec_uint64 ("grandmaster-clock-id", "Grand Master Clock ID",
+ "Grand Master Clock ID", 0, G_MAXUINT64, 0,
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+
clock_class->get_internal_time = gst_ptp_clock_get_internal_time;
}
gst_ptp_clock_ensure_domain_clock (self);
g_value_set_object (value, self->priv->domain_clock);
break;
+ case PROP_MASTER_CLOCK_ID:
+ case PROP_GRANDMASTER_CLOCK_ID:{
+ GList *l;
+
+ g_mutex_lock (&domain_clocks_lock);
+ g_value_set_uint64 (value, 0);
+
+ for (l = domain_clocks; l; l = l->next) {
+ PtpDomainData *clock_data = l->data;
+
+ if (clock_data->domain == self->priv->domain) {
+ if (prop_id == PROP_MASTER_CLOCK_ID)
+ g_value_set_uint64 (value,
+ clock_data->master_clock_identity.clock_identity);
+ else
+ g_value_set_uint64 (value, clock_data->grandmaster_identity);
+ break;
+ }
+ }
+ g_mutex_unlock (&domain_clocks_lock);
+ break;
+ }
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
* 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