Documentation ¶
Index ¶
- Constants
- Variables
- func NetAddressMetaApiGetType() coreglib.Type
- func NetAddressMetaGetInfo() *gst.MetaInfo
- func NetControlMessageMetaApiGetType() coreglib.Type
- func NetControlMessageMetaGetInfo() *gst.MetaInfo
- func NetUtilsSetSocketTos(socket *gio.Socket, qosDscp int) bool
- func PtpDeinit()
- func PtpInit(clockId uint64, interfaces []string) bool
- func PtpIsInitialized() bool
- func PtpIsSupported() bool
- func PtpStatisticsCallbackAdd(callback PtpStatisticsCallback) uint32
- func PtpStatisticsCallbackRemove(id uint32)
- type NetAddressMeta
- type NetClientClock
- type NetClientClockClass
- type NetClientClockOverrides
- type NetControlMessageMeta
- type NetTimePacket
- type NetTimeProvider
- type NetTimeProviderClass
- type NetTimeProviderOverrides
- type NtpClock
- type NtpClockClass
- type NtpClockOverrides
- type PtpClock
- type PtpClockClass
- type PtpClockOverrides
- type PtpStatisticsCallback
Constants ¶
const NET_TIME_PACKET_SIZE = 16
NET_TIME_PACKET_SIZE: size of the packets sent between network clocks.
const PTP_CLOCK_ID_NONE = 18446744073709551615
PTP_CLOCK_ID_NONE: PTP clock identification that can be passed to gst_ptp_init() to automatically select one based on the MAC address of interfaces.
const PTP_STATISTICS_BEST_MASTER_CLOCK_SELECTED = "GstPtpStatisticsBestMasterClockSelected"
const PTP_STATISTICS_NEW_DOMAIN_FOUND = "GstPtpStatisticsNewDomainFound"
const PTP_STATISTICS_PATH_DELAY_MEASURED = "GstPtpStatisticsPathDelayMeasured"
const PTP_STATISTICS_TIME_UPDATED = "GstPtpStatisticsTimeUpdated"
Variables ¶
var ( GTypeNetClientClock = coreglib.Type(C.gst_net_client_clock_get_type()) GTypeNtpClock = coreglib.Type(C.gst_ntp_clock_get_type()) )
GType values.
var (
GTypeNetTimePacket = coreglib.Type(C.gst_net_time_packet_get_type())
)
GType values.
var (
GTypeNetTimeProvider = coreglib.Type(C.gst_net_time_provider_get_type())
)
GType values.
var (
GTypePtpClock = coreglib.Type(C.gst_ptp_clock_get_type())
)
GType values.
Functions ¶
func NetAddressMetaApiGetType ¶
The function returns the following values:
func NetAddressMetaGetInfo ¶
The function returns the following values:
func NetControlMessageMetaApiGetType ¶
The function returns the following values:
func NetControlMessageMetaGetInfo ¶
The function returns the following values:
func NetUtilsSetSocketTos ¶
NetUtilsSetSocketTos configures IP_TOS value of socket, i.e. sets QoS DSCP.
The function takes the following parameters:
- socket: socket to configure.
- qosDscp: qoS DSCP value.
The function returns the following values:
- ok: TRUE if successful, FALSE in case an error occurred.
func PtpDeinit ¶
func PtpDeinit()
PtpDeinit: 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.
func PtpInit ¶
PtpInit: 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.
The function takes the following parameters:
- clockId: PTP clock id of this process' clock or GST_PTP_CLOCK_ID_NONE.
- interfaces (optional): network interfaces to run the clock on.
The function returns the following values:
- ok: TRUE if the GStreamer PTP clock subsystem could be initialized.
func PtpIsInitialized ¶
func PtpIsInitialized() bool
PtpIsInitialized: check if the GStreamer PTP clock subsystem is initialized.
The function returns the following values:
- ok: TRUE if the GStreamer PTP clock subsystem is initialized.
func PtpIsSupported ¶
func PtpIsSupported() bool
PtpIsSupported: check if PTP clocks are generally supported on this system, and if previous initializations did not fail.
The function returns the following values:
- ok: TRUE if PTP clocks are generally supported on this system, and previous initializations did not fail.
func PtpStatisticsCallbackAdd ¶
func PtpStatisticsCallbackAdd(callback PtpStatisticsCallback) uint32
PtpStatisticsCallbackAdd installs a new statistics callback for gathering PTP statistics. See GstPtpStatisticsCallback for a list of statistics that are provided.
The function takes the following parameters:
- callback: gstPtpStatisticsCallback to call.
The function returns the following values:
- gulong: id for the callback that can be passed to gst_ptp_statistics_callback_remove().
func PtpStatisticsCallbackRemove ¶
func PtpStatisticsCallbackRemove(id uint32)
PtpStatisticsCallbackRemove removes a PTP statistics callback that was previously added with gst_ptp_statistics_callback_add().
The function takes the following parameters:
- id: callback id to remove.
Types ¶
type NetAddressMeta ¶
type NetAddressMeta struct {
// contains filtered or unexported fields
}
NetAddressMeta can be used to store a network address (a Address) in a Buffer so that it network elements can track the to and from address of the buffer.
An instance of this type is always passed by reference.
func BufferAddNetAddressMeta ¶
func BufferAddNetAddressMeta(buffer *gst.Buffer, addr gio.SocketAddresser) *NetAddressMeta
BufferAddNetAddressMeta attaches addr as metadata in a NetAddressMeta to buffer.
The function takes the following parameters:
- buffer: Buffer.
- addr GSocketAddress to connect to buffer.
The function returns the following values:
- netAddressMeta connected to buffer.
func BufferGetNetAddressMeta ¶
func BufferGetNetAddressMeta(buffer *gst.Buffer) *NetAddressMeta
BufferGetNetAddressMeta: find the NetAddressMeta on buffer.
The function takes the following parameters:
- buffer: Buffer.
The function returns the following values:
- netAddressMeta or NULL when there is no such metadata on buffer.
func (*NetAddressMeta) Addr ¶
func (n *NetAddressMeta) Addr() gio.SocketAddresser
Addr stored as metadata.
type NetClientClock ¶
type NetClientClock struct { gst.SystemClock // contains filtered or unexported fields }
NetClientClock implements a custom Clock that synchronizes its time to a remote time provider such as NetTimeProvider. NtpClock implements a Clock that synchronizes its time to a remote NTPv4 server.
A new clock is created with gst_net_client_clock_new() or gst_ntp_clock_new(), which takes the address and port of the remote time provider along with a name and an initial time.
This clock will poll the time provider and will update its calibration parameters based on the local and remote observations.
The "round-trip" property limits the maximum round trip packets can take.
Various parameters of the clock can be configured with the parent Clock "timeout", "window-size" and "window-threshold" object properties.
A NetClientClock and NtpClock is typically set on a Pipeline with gst_pipeline_use_clock().
If you set a Bus on the clock via the "bus" object property, it will send GST_MESSAGE_ELEMENT messages with an attached Structure containing statistics about clock accuracy and network traffic.
func NewNetClientClock ¶
func NewNetClientClock(name, remoteAddress string, remotePort int, baseTime gst.ClockTime) *NetClientClock
NewNetClientClock: create a new NetClientClock that will report the time provided by the NetTimeProvider on remote_address and remote_port.
The function takes the following parameters:
- name for the clock.
- remoteAddress address or hostname of the remote clock provider.
- remotePort: port of the remote clock provider.
- baseTime: initial time of the clock.
The function returns the following values:
- netClientClock: new Clock that receives a time from the remote clock.
type NetClientClockClass ¶
type NetClientClockClass struct {
// contains filtered or unexported fields
}
NetClientClockClass: instance of this type is always passed by reference.
func (*NetClientClockClass) ParentClass ¶
func (n *NetClientClockClass) ParentClass() *gst.SystemClockClass
type NetClientClockOverrides ¶
type NetClientClockOverrides struct { }
NetClientClockOverrides contains methods that are overridable.
type NetControlMessageMeta ¶
type NetControlMessageMeta struct {
// contains filtered or unexported fields
}
NetControlMessageMeta can be used to store control messages (ancillary data) which was received with or is to be sent alongside the buffer data. When used with socket sinks and sources which understand this meta it allows sending and receiving ancillary data such as unix credentials (See CredentialsMessage) and Unix file descriptions (See FDMessage).
An instance of this type is always passed by reference.
func BufferAddNetControlMessageMeta ¶
func BufferAddNetControlMessageMeta(buffer *gst.Buffer, message gio.SocketControlMessager) *NetControlMessageMeta
BufferAddNetControlMessageMeta attaches message as metadata in a NetControlMessageMeta to buffer.
The function takes the following parameters:
- buffer: Buffer.
- message: GSocketControlMessage to attach to buffer.
The function returns the following values:
- netControlMessageMeta connected to buffer.
func (*NetControlMessageMeta) Message ¶
func (n *NetControlMessageMeta) Message() gio.SocketControlMessager
Message stored as metadata.
func (*NetControlMessageMeta) Meta ¶
func (n *NetControlMessageMeta) Meta() *gst.Meta
Meta: parent type.
type NetTimePacket ¶
type NetTimePacket struct {
// contains filtered or unexported fields
}
NetTimePacket various functions for receiving, sending an serializing NetTimePacket structures.
An instance of this type is always passed by reference.
func NetTimePacketReceive ¶
func NetTimePacketReceive(socket *gio.Socket) (gio.SocketAddresser, *NetTimePacket, error)
NetTimePacketReceive receives a NetTimePacket over a socket. Handles interrupted system calls, but otherwise returns NULL on error.
The function takes the following parameters:
- socket to receive the time packet on.
The function returns the following values:
- srcAddress address of variable to return sender address.
- netTimePacket: new NetTimePacket, or NULL on error. Free with gst_net_time_packet_free() when done.
func (*NetTimePacket) Copy ¶
func (packet *NetTimePacket) Copy() *NetTimePacket
Copy: make a copy of packet.
The function returns the following values:
- netTimePacket: copy of packet, free with gst_net_time_packet_free().
func (*NetTimePacket) LocalTime ¶
func (n *NetTimePacket) LocalTime() gst.ClockTime
LocalTime: local time when this packet was sent.
func (*NetTimePacket) RemoteTime ¶
func (n *NetTimePacket) RemoteTime() gst.ClockTime
RemoteTime: remote time observation.
func (*NetTimePacket) Send ¶
func (packet *NetTimePacket) Send(socket *gio.Socket, destAddress gio.SocketAddresser) error
Send sends a NetTimePacket over a socket.
MT safe.
The function takes the following parameters:
- socket to send the time packet on.
- destAddress address to send the time packet to.
func (*NetTimePacket) Serialize ¶
func (packet *NetTimePacket) Serialize() *byte
Serialize: serialized a NetTimePacket into a newly-allocated sequence of T_NET_TIME_PACKET_SIZE bytes, in network byte order. The value returned is suitable for passing to write(2) or sendto(2) for communication over the network.
MT safe. Caller owns return value (g_free to free).
The function returns the following values:
- guint8: newly allocated sequence of T_NET_TIME_PACKET_SIZE bytes.
type NetTimeProvider ¶
type NetTimeProvider struct { gst.GstObject gio.Initable // contains filtered or unexported fields }
NetTimeProvider: this object exposes the time of a Clock on the network.
A NetTimeProvider is created with gst_net_time_provider_new() which takes a Clock, an address and a port number as arguments.
After creating the object, a client clock such as NetClientClock can query the exposed clock over the network for its values.
The NetTimeProvider typically wraps the clock used by a Pipeline.
func NewNetTimeProvider ¶
func NewNetTimeProvider(clock gst.Clocker, address string, port int) *NetTimeProvider
NewNetTimeProvider allows network clients to get the current time of clock.
The function takes the following parameters:
- clock to export over the network.
- address (optional) to bind on as a dotted quad (xxx.xxx.xxx.xxx), IPv6 address, or NULL to bind to all addresses.
- port to bind on, or 0 to let the kernel choose.
The function returns the following values:
- netTimeProvider: new NetTimeProvider, or NULL on error.
type NetTimeProviderClass ¶
type NetTimeProviderClass struct {
// contains filtered or unexported fields
}
NetTimeProviderClass: instance of this type is always passed by reference.
func (*NetTimeProviderClass) GstReserved ¶
func (n *NetTimeProviderClass) GstReserved() [4]unsafe.Pointer
func (*NetTimeProviderClass) ParentClass ¶
func (n *NetTimeProviderClass) ParentClass() *gst.ObjectClass
type NetTimeProviderOverrides ¶
type NetTimeProviderOverrides struct { }
NetTimeProviderOverrides contains methods that are overridable.
type NtpClock ¶
type NtpClock struct { NetClientClock // contains filtered or unexported fields }
func NewNtpClock ¶
NewNtpClock: create a new NtpClock that will report the time provided by the NTPv4 server on remote_address and remote_port.
The function takes the following parameters:
- name for the clock.
- remoteAddress address or hostname of the remote clock provider.
- remotePort: port of the remote clock provider.
- baseTime: initial time of the clock.
The function returns the following values:
- ntpClock: new Clock that receives a time from the remote clock.
type NtpClockClass ¶
type NtpClockClass struct {
// contains filtered or unexported fields
}
NtpClockClass: instance of this type is always passed by reference.
func (*NtpClockClass) ParentClass ¶
func (n *NtpClockClass) ParentClass() *gst.SystemClockClass
type NtpClockOverrides ¶
type NtpClockOverrides struct { }
NtpClockOverrides contains methods that are overridable.
type PtpClock ¶
type PtpClock struct { gst.SystemClock // contains filtered or unexported fields }
PtpClock 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.
func NewPtpClock ¶
NewPtpClock 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().
The function takes the following parameters:
- name: name of the clock.
- domain: PTP domain.
The function returns the following values:
- ptpClock: new Clock.
type PtpClockClass ¶
type PtpClockClass struct {
// contains filtered or unexported fields
}
PtpClockClass: opaque PtpClockClass structure.
An instance of this type is always passed by reference.
func (*PtpClockClass) ParentClass ¶
func (p *PtpClockClass) ParentClass() *gst.SystemClockClass
ParentClass: parented to SystemClockClass.
type PtpClockOverrides ¶
type PtpClockOverrides struct { }
PtpClockOverrides contains methods that are overridable.
type PtpStatisticsCallback ¶
PtpStatisticsCallback 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.