Add bindings to GStreamer Net library

This commit is contained in:
Sebastian Dröge 2017-12-16 14:48:29 +02:00
parent 8a807c4265
commit 159429dd95
19 changed files with 100400 additions and 0 deletions

View file

@ -5,6 +5,7 @@ members = [
"gstreamer-app",
"gstreamer-audio",
"gstreamer-base",
"gstreamer-net",
"gstreamer-player",
"gstreamer-video",
"examples",

69
Gir_GstNet.toml Normal file
View file

@ -0,0 +1,69 @@
[options]
girs_dir = "gir-files"
library = "GstNet"
version = "1.0"
min_cfg_version = "1.8"
target_path = "gstreamer-net"
work_mode = "normal"
concurrency = "send+sync"
generate_safety_asserts = true
external_libraries = [
"GLib",
"GObject",
"Gst",
"Gio",
]
generate = [
]
manual = [
"GObject.Object",
"Gst.Object",
"Gst.Clock",
"Gst.Bus",
]
[[object]]
name = "Gst.ClockTime"
status = "manual"
conversion_type = "scalar"
[[object]]
name = "GstNet.NtpClock"
status = "generate"
trait = false
[[object.function]]
name = "new"
[[object.function.parameter]]
name = "name"
nullable = true
[[object]]
name = "GstNet.PtpClock"
status = "generate"
trait = false
[[object.function]]
name = "new"
[[object.function.parameter]]
name = "name"
nullable = true
[[object]]
name = "GstNet.NetClientClock"
status = "generate"
trait = false
[[object.function]]
name = "new"
[[object.function.parameter]]
name = "name"
nullable = true
[[object]]
name = "GstNet.NetTimeProvider"
status = "generate"
trait = false

92999
gir-files/Gio-2.0.gir Normal file

File diff suppressed because it is too large Load diff

5276
gir-files/GstMpegts-1.0.gir Normal file

File diff suppressed because it is too large Load diff

851
gir-files/GstNet-1.0.gir Normal file
View file

@ -0,0 +1,851 @@
<?xml version="1.0"?>
<!-- This file was automatically generated from C sources - DO NOT EDIT!
To affect the contents of this file, edit the original C definitions,
and/or use gtk-doc annotations. -->
<repository version="1.2"
xmlns="http://www.gtk.org/introspection/core/1.0"
xmlns:c="http://www.gtk.org/introspection/c/1.0"
xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
<include name="Gio" version="2.0"/>
<include name="Gst" version="1.0"/>
<package name="gstreamer-net-1.0"/>
<c:include name="gst/net/net.h"/>
<namespace name="GstNet"
version="1.0"
shared-library="libgstnet-1.0.so.0"
c:identifier-prefixes="Gst"
c:symbol-prefixes="gst">
<constant name="NET_TIME_PACKET_SIZE"
value="16"
c:type="GST_NET_TIME_PACKET_SIZE">
<doc xml:space="preserve">The size of the packets sent between network clocks.</doc>
<type name="gint" c:type="gint"/>
</constant>
<record name="NetAddressMeta" c:type="GstNetAddressMeta">
<doc xml:space="preserve">#GstNetAddressMeta can be used to store a network address (a #GSocketAddress)
in a #GstBuffer so that it network elements can track the to and from address
of the buffer.</doc>
<field name="meta" writable="1">
<doc xml:space="preserve">the parent type</doc>
<type name="Gst.Meta" c:type="GstMeta"/>
</field>
<field name="addr" writable="1">
<doc xml:space="preserve">a #GSocketAddress stored as metadata</doc>
<type name="Gio.SocketAddress" c:type="GSocketAddress*"/>
</field>
<function name="get_info" c:identifier="gst_net_address_meta_get_info">
<return-value transfer-ownership="none">
<type name="Gst.MetaInfo" c:type="const GstMetaInfo*"/>
</return-value>
</function>
</record>
<class name="NetClientClock"
c:symbol-prefix="net_client_clock"
c:type="GstNetClientClock"
parent="Gst.SystemClock"
glib:type-name="GstNetClientClock"
glib:get-type="gst_net_client_clock_get_type"
glib:type-struct="NetClientClockClass">
<doc xml:space="preserve">#GstNetClientClock implements a custom #GstClock that synchronizes its time
to a remote time provider such as #GstNetTimeProvider. #GstNtpClock
implements a #GstClock 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 #GstClock
"timeout", "window-size" and "window-threshold" object properties.
A #GstNetClientClock and #GstNtpClock is typically set on a #GstPipeline with
gst_pipeline_use_clock().
If you set a #GstBus on the clock via the "bus" object property, it will
send @GST_MESSAGE_ELEMENT messages with an attached #GstStructure containing
statistics about clock accuracy and network traffic.</doc>
<constructor name="new" c:identifier="gst_net_client_clock_new">
<doc xml:space="preserve">Create a new #GstNetClientInternalClock that will report the time
provided by the #GstNetTimeProvider on @remote_address and
@remote_port.</doc>
<return-value transfer-ownership="none">
<doc xml:space="preserve">a new #GstClock that receives a time from the remote
clock.</doc>
<type name="Gst.Clock" c:type="GstClock*"/>
</return-value>
<parameters>
<parameter name="name" transfer-ownership="none">
<doc xml:space="preserve">a name for the clock</doc>
<type name="utf8" c:type="const gchar*"/>
</parameter>
<parameter name="remote_address" transfer-ownership="none">
<doc xml:space="preserve">the address or hostname of the remote clock provider</doc>
<type name="utf8" c:type="const gchar*"/>
</parameter>
<parameter name="remote_port" transfer-ownership="none">
<doc xml:space="preserve">the port of the remote clock provider</doc>
<type name="gint" c:type="gint"/>
</parameter>
<parameter name="base_time" transfer-ownership="none">
<doc xml:space="preserve">initial time of the clock</doc>
<type name="Gst.ClockTime" c:type="GstClockTime"/>
</parameter>
</parameters>
</constructor>
<property name="address"
writable="1"
construct="1"
transfer-ownership="none">
<type name="utf8" c:type="gchar*"/>
</property>
<property name="base-time"
writable="1"
construct-only="1"
transfer-ownership="none">
<type name="guint64" c:type="guint64"/>
</property>
<property name="bus" writable="1" transfer-ownership="none">
<type name="Gst.Bus"/>
</property>
<property name="internal-clock" transfer-ownership="none">
<type name="Gst.Clock"/>
</property>
<property name="minimum-update-interval"
writable="1"
transfer-ownership="none">
<type name="guint64" c:type="guint64"/>
</property>
<property name="port"
writable="1"
construct="1"
transfer-ownership="none">
<type name="gint" c:type="gint"/>
</property>
<property name="round-trip-limit" writable="1" transfer-ownership="none">
<type name="guint64" c:type="guint64"/>
</property>
<field name="clock">
<type name="Gst.SystemClock" c:type="GstSystemClock"/>
</field>
<field name="priv" readable="0" private="1">
<type name="NetClientClockPrivate" c:type="GstNetClientClockPrivate*"/>
</field>
<field name="_gst_reserved" readable="0" private="1">
<array zero-terminated="0" c:type="gpointer" fixed-size="4">
<type name="gpointer" c:type="gpointer"/>
</array>
</field>
</class>
<record name="NetClientClockClass"
c:type="GstNetClientClockClass"
glib:is-gtype-struct-for="NetClientClock">
<field name="parent_class">
<type name="Gst.SystemClockClass" c:type="GstSystemClockClass"/>
</field>
<field name="_gst_reserved" readable="0" private="1">
<array zero-terminated="0" c:type="gpointer" fixed-size="4">
<type name="gpointer" c:type="gpointer"/>
</array>
</field>
</record>
<record name="NetClientClockPrivate"
c:type="GstNetClientClockPrivate"
disguised="1">
</record>
<record name="NetControlMessageMeta" c:type="GstNetControlMessageMeta">
<doc xml:space="preserve">#GstNetControlMessageMeta 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
#GUnixCredentialsMessage) and Unix file descriptions (See #GUnixFDMessage).</doc>
<field name="meta" writable="1">
<doc xml:space="preserve">the parent type</doc>
<type name="Gst.Meta" c:type="GstMeta"/>
</field>
<field name="message" writable="1">
<doc xml:space="preserve">a #GSocketControlMessage stored as metadata</doc>
<type name="Gio.SocketControlMessage" c:type="GSocketControlMessage*"/>
</field>
<function name="get_info"
c:identifier="gst_net_control_message_meta_get_info">
<return-value transfer-ownership="none">
<type name="Gst.MetaInfo" c:type="const GstMetaInfo*"/>
</return-value>
</function>
</record>
<record name="NetTimePacket"
c:type="GstNetTimePacket"
glib:type-name="GstNetTimePacket"
glib:get-type="gst_net_time_packet_get_type"
c:symbol-prefix="net_time_packet">
<doc xml:space="preserve">Various functions for receiving, sending an serializing #GstNetTimePacket
structures.</doc>
<field name="local_time" writable="1">
<doc xml:space="preserve">the local time when this packet was sent</doc>
<type name="Gst.ClockTime" c:type="GstClockTime"/>
</field>
<field name="remote_time" writable="1">
<doc xml:space="preserve">the remote time observation</doc>
<type name="Gst.ClockTime" c:type="GstClockTime"/>
</field>
<constructor name="new" c:identifier="gst_net_time_packet_new">
<doc xml:space="preserve">Creates a new #GstNetTimePacket from a buffer received over the network. The
caller is responsible for ensuring that @buffer is at least
#GST_NET_TIME_PACKET_SIZE bytes long.
If @buffer is #NULL, the local and remote times will be set to
#GST_CLOCK_TIME_NONE.
MT safe. Caller owns return value (gst_net_time_packet_free to free).</doc>
<return-value transfer-ownership="full">
<doc xml:space="preserve">The new #GstNetTimePacket.</doc>
<type name="NetTimePacket" c:type="GstNetTimePacket*"/>
</return-value>
<parameters>
<parameter name="buffer" transfer-ownership="none">
<doc xml:space="preserve">a buffer from which to construct the packet, or NULL</doc>
<array zero-terminated="0" c:type="guint8*">
<type name="guint8" c:type="guint8"/>
</array>
</parameter>
</parameters>
</constructor>
<method name="copy" c:identifier="gst_net_time_packet_copy">
<doc xml:space="preserve">Make a copy of @packet.</doc>
<return-value transfer-ownership="full">
<doc xml:space="preserve">a copy of @packet, free with gst_net_time_packet_free().</doc>
<type name="NetTimePacket" c:type="GstNetTimePacket*"/>
</return-value>
<parameters>
<instance-parameter name="packet" transfer-ownership="none">
<doc xml:space="preserve">the #GstNetTimePacket</doc>
<type name="NetTimePacket" c:type="const GstNetTimePacket*"/>
</instance-parameter>
</parameters>
</method>
<method name="free" c:identifier="gst_net_time_packet_free">
<doc xml:space="preserve">Free @packet.</doc>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
<parameters>
<instance-parameter name="packet" transfer-ownership="none">
<doc xml:space="preserve">the #GstNetTimePacket</doc>
<type name="NetTimePacket" c:type="GstNetTimePacket*"/>
</instance-parameter>
</parameters>
</method>
<method name="send" c:identifier="gst_net_time_packet_send" throws="1">
<doc xml:space="preserve">Sends a #GstNetTimePacket over a socket.
MT safe.</doc>
<return-value transfer-ownership="none">
<doc xml:space="preserve">TRUE if successful, FALSE in case an error occurred.</doc>
<type name="gboolean" c:type="gboolean"/>
</return-value>
<parameters>
<instance-parameter name="packet" transfer-ownership="none">
<doc xml:space="preserve">the #GstNetTimePacket to send</doc>
<type name="NetTimePacket" c:type="const GstNetTimePacket*"/>
</instance-parameter>
<parameter name="socket" transfer-ownership="none">
<doc xml:space="preserve">socket to send the time packet on</doc>
<type name="Gio.Socket" c:type="GSocket*"/>
</parameter>
<parameter name="dest_address" transfer-ownership="none">
<doc xml:space="preserve">address to send the time packet to</doc>
<type name="Gio.SocketAddress" c:type="GSocketAddress*"/>
</parameter>
</parameters>
</method>
<method name="serialize" c:identifier="gst_net_time_packet_serialize">
<doc xml:space="preserve">Serialized a #GstNetTimePacket into a newly-allocated sequence of
#GST_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).</doc>
<return-value transfer-ownership="none">
<doc xml:space="preserve">A newly allocated sequence of #GST_NET_TIME_PACKET_SIZE bytes.</doc>
<type name="guint8" c:type="guint8*"/>
</return-value>
<parameters>
<instance-parameter name="packet" transfer-ownership="none">
<doc xml:space="preserve">the #GstNetTimePacket</doc>
<type name="NetTimePacket" c:type="const GstNetTimePacket*"/>
</instance-parameter>
</parameters>
</method>
<function name="receive"
c:identifier="gst_net_time_packet_receive"
throws="1">
<doc xml:space="preserve">Receives a #GstNetTimePacket over a socket. Handles interrupted system
calls, but otherwise returns NULL on error.</doc>
<return-value transfer-ownership="full">
<doc xml:space="preserve">a new #GstNetTimePacket, or NULL on error. Free
with gst_net_time_packet_free() when done.</doc>
<type name="NetTimePacket" c:type="GstNetTimePacket*"/>
</return-value>
<parameters>
<parameter name="socket" transfer-ownership="none">
<doc xml:space="preserve">socket to receive the time packet on</doc>
<type name="Gio.Socket" c:type="GSocket*"/>
</parameter>
<parameter name="src_address"
direction="out"
caller-allocates="0"
transfer-ownership="full">
<doc xml:space="preserve">address of variable to return sender address</doc>
<type name="Gio.SocketAddress" c:type="GSocketAddress**"/>
</parameter>
</parameters>
</function>
</record>
<class name="NetTimeProvider"
c:symbol-prefix="net_time_provider"
c:type="GstNetTimeProvider"
parent="Gst.Object"
glib:type-name="GstNetTimeProvider"
glib:get-type="gst_net_time_provider_get_type"
glib:type-struct="NetTimeProviderClass">
<doc xml:space="preserve">This object exposes the time of a #GstClock on the network.
A #GstNetTimeProvider is created with gst_net_time_provider_new() which
takes a #GstClock, an address and a port number as arguments.
After creating the object, a client clock such as #GstNetClientClock can
query the exposed clock over the network for its values.
The #GstNetTimeProvider typically wraps the clock used by a #GstPipeline.</doc>
<implements name="Gio.Initable"/>
<constructor name="new" c:identifier="gst_net_time_provider_new">
<doc xml:space="preserve">Allows network clients to get the current time of @clock.</doc>
<return-value transfer-ownership="none">
<doc xml:space="preserve">the new #GstNetTimeProvider, or NULL on error</doc>
<type name="NetTimeProvider" c:type="GstNetTimeProvider*"/>
</return-value>
<parameters>
<parameter name="clock" transfer-ownership="none">
<doc xml:space="preserve">a #GstClock to export over the network</doc>
<type name="Gst.Clock" c:type="GstClock*"/>
</parameter>
<parameter name="address"
transfer-ownership="none"
nullable="1"
allow-none="1">
<doc xml:space="preserve">an address to bind on as a dotted quad
(xxx.xxx.xxx.xxx), IPv6 address, or NULL to bind to all addresses</doc>
<type name="utf8" c:type="const gchar*"/>
</parameter>
<parameter name="port" transfer-ownership="none">
<doc xml:space="preserve">a port to bind on, or 0 to let the kernel choose</doc>
<type name="gint" c:type="gint"/>
</parameter>
</parameters>
</constructor>
<property name="active" writable="1" transfer-ownership="none">
<type name="gboolean" c:type="gboolean"/>
</property>
<property name="address"
writable="1"
construct-only="1"
transfer-ownership="none">
<type name="utf8" c:type="gchar*"/>
</property>
<property name="clock"
writable="1"
construct-only="1"
transfer-ownership="none">
<type name="Gst.Clock"/>
</property>
<property name="port"
writable="1"
construct-only="1"
transfer-ownership="none">
<type name="gint" c:type="gint"/>
</property>
<field name="parent">
<type name="Gst.Object" c:type="GstObject"/>
</field>
<field name="priv" readable="0" private="1">
<type name="NetTimeProviderPrivate"
c:type="GstNetTimeProviderPrivate*"/>
</field>
<field name="_gst_reserved" readable="0" private="1">
<array zero-terminated="0" c:type="gpointer" fixed-size="4">
<type name="gpointer" c:type="gpointer"/>
</array>
</field>
</class>
<record name="NetTimeProviderClass"
c:type="GstNetTimeProviderClass"
glib:is-gtype-struct-for="NetTimeProvider">
<field name="parent_class">
<type name="Gst.ObjectClass" c:type="GstObjectClass"/>
</field>
<field name="_gst_reserved">
<array zero-terminated="0" c:type="gpointer" fixed-size="4">
<type name="gpointer" c:type="gpointer"/>
</array>
</field>
</record>
<record name="NetTimeProviderPrivate"
c:type="GstNetTimeProviderPrivate"
disguised="1">
</record>
<class name="NtpClock"
c:symbol-prefix="ntp_clock"
c:type="GstNtpClock"
parent="NetClientClock"
glib:type-name="GstNtpClock"
glib:get-type="gst_ntp_clock_get_type"
glib:type-struct="NtpClockClass">
<constructor name="new" c:identifier="gst_ntp_clock_new" version="1.6">
<doc xml:space="preserve">Create a new #GstNtpClock that will report the time provided by
the NTPv4 server on @remote_address and @remote_port.</doc>
<return-value transfer-ownership="none">
<doc xml:space="preserve">a new #GstClock that receives a time from the remote
clock.</doc>
<type name="Gst.Clock" c:type="GstClock*"/>
</return-value>
<parameters>
<parameter name="name" transfer-ownership="none">
<doc xml:space="preserve">a name for the clock</doc>
<type name="utf8" c:type="const gchar*"/>
</parameter>
<parameter name="remote_address" transfer-ownership="none">
<doc xml:space="preserve">the address or hostname of the remote clock provider</doc>
<type name="utf8" c:type="const gchar*"/>
</parameter>
<parameter name="remote_port" transfer-ownership="none">
<doc xml:space="preserve">the port of the remote clock provider</doc>
<type name="gint" c:type="gint"/>
</parameter>
<parameter name="base_time" transfer-ownership="none">
<doc xml:space="preserve">initial time of the clock</doc>
<type name="Gst.ClockTime" c:type="GstClockTime"/>
</parameter>
</parameters>
</constructor>
<field name="clock">
<type name="Gst.SystemClock" c:type="GstSystemClock"/>
</field>
<field name="priv" readable="0" private="1">
<type name="NetClientClockPrivate" c:type="GstNetClientClockPrivate*"/>
</field>
<field name="_gst_reserved" readable="0" private="1">
<array zero-terminated="0" c:type="gpointer" fixed-size="4">
<type name="gpointer" c:type="gpointer"/>
</array>
</field>
</class>
<record name="NtpClockClass"
c:type="GstNtpClockClass"
glib:is-gtype-struct-for="NtpClock">
<field name="parent_class">
<type name="Gst.SystemClockClass" c:type="GstSystemClockClass"/>
</field>
<field name="_gst_reserved" readable="0" private="1">
<array zero-terminated="0" c:type="gpointer" fixed-size="4">
<type name="gpointer" c:type="gpointer"/>
</array>
</field>
</record>
<constant name="PTP_CLOCK_ID_NONE"
value="18446744073709551615"
c:type="GST_PTP_CLOCK_ID_NONE">
<doc xml:space="preserve">PTP clock identification that can be passed to gst_ptp_init() to
automatically select one based on the MAC address of interfaces</doc>
<type name="guint64" c:type="guint64"/>
</constant>
<constant name="PTP_STATISTICS_BEST_MASTER_CLOCK_SELECTED"
value="GstPtpStatisticsBestMasterClockSelected"
c:type="GST_PTP_STATISTICS_BEST_MASTER_CLOCK_SELECTED">
<type name="utf8" c:type="gchar*"/>
</constant>
<constant name="PTP_STATISTICS_NEW_DOMAIN_FOUND"
value="GstPtpStatisticsNewDomainFound"
c:type="GST_PTP_STATISTICS_NEW_DOMAIN_FOUND">
<type name="utf8" c:type="gchar*"/>
</constant>
<constant name="PTP_STATISTICS_PATH_DELAY_MEASURED"
value="GstPtpStatisticsPathDelayMeasured"
c:type="GST_PTP_STATISTICS_PATH_DELAY_MEASURED">
<type name="utf8" c:type="gchar*"/>
</constant>
<constant name="PTP_STATISTICS_TIME_UPDATED"
value="GstPtpStatisticsTimeUpdated"
c:type="GST_PTP_STATISTICS_TIME_UPDATED">
<type name="utf8" c:type="gchar*"/>
</constant>
<class name="PtpClock"
c:symbol-prefix="ptp_clock"
c:type="GstPtpClock"
parent="Gst.SystemClock"
glib:type-name="GstPtpClock"
glib:get-type="gst_ptp_clock_get_type"
glib:type-struct="PtpClockClass">
<doc xml:space="preserve">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 &lt; 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.</doc>
<constructor name="new" c:identifier="gst_ptp_clock_new" version="1.6">
<doc xml:space="preserve">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().</doc>
<return-value transfer-ownership="none">
<type name="Gst.Clock" c:type="GstClock*"/>
</return-value>
<parameters>
<parameter name="name" transfer-ownership="none">
<doc xml:space="preserve">Name of the clock</doc>
<type name="utf8" c:type="const gchar*"/>
</parameter>
<parameter name="domain" transfer-ownership="none">
<doc xml:space="preserve">PTP domain</doc>
<type name="guint" c:type="guint"/>
</parameter>
</parameters>
</constructor>
<property name="domain"
writable="1"
construct-only="1"
transfer-ownership="none">
<type name="guint" c:type="guint"/>
</property>
<property name="grandmaster-clock-id" transfer-ownership="none">
<type name="guint64" c:type="guint64"/>
</property>
<property name="internal-clock" transfer-ownership="none">
<type name="Gst.Clock"/>
</property>
<property name="master-clock-id" transfer-ownership="none">
<type name="guint64" c:type="guint64"/>
</property>
<field name="clock">
<type name="Gst.SystemClock" c:type="GstSystemClock"/>
</field>
<field name="priv" readable="0" private="1">
<type name="PtpClockPrivate" c:type="GstPtpClockPrivate*"/>
</field>
<field name="_gst_reserved" readable="0" private="1">
<array zero-terminated="0" c:type="gpointer" fixed-size="4">
<type name="gpointer" c:type="gpointer"/>
</array>
</field>
</class>
<record name="PtpClockClass"
c:type="GstPtpClockClass"
glib:is-gtype-struct-for="PtpClock">
<doc xml:space="preserve">Opaque #GstPtpClockClass structure.</doc>
<field name="parent_class">
<doc xml:space="preserve">parented to #GstSystemClockClass</doc>
<type name="Gst.SystemClockClass" c:type="GstSystemClockClass"/>
</field>
<field name="_gst_reserved" readable="0" private="1">
<array zero-terminated="0" c:type="gpointer" fixed-size="4">
<type name="gpointer" c:type="gpointer"/>
</array>
</field>
</record>
<record name="PtpClockPrivate" c:type="GstPtpClockPrivate" disguised="1">
</record>
<callback name="PtpStatisticsCallback" c:type="GstPtpStatisticsCallback">
<doc xml:space="preserve">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.</doc>
<return-value transfer-ownership="none">
<type name="gboolean" c:type="gboolean"/>
</return-value>
<parameters>
<parameter name="domain" transfer-ownership="none">
<doc xml:space="preserve">PTP domain identifier</doc>
<type name="guint8" c:type="guint8"/>
</parameter>
<parameter name="stats" transfer-ownership="none">
<doc xml:space="preserve">New statistics</doc>
<type name="Gst.Structure" c:type="const GstStructure*"/>
</parameter>
<parameter name="user_data"
transfer-ownership="none"
nullable="1"
allow-none="1"
closure="2">
<doc xml:space="preserve">Data passed to gst_ptp_statistics_callback_add()</doc>
<type name="gpointer" c:type="gpointer"/>
</parameter>
</parameters>
</callback>
<function name="buffer_add_net_address_meta"
c:identifier="gst_buffer_add_net_address_meta">
<doc xml:space="preserve">Attaches @addr as metadata in a #GstNetAddressMeta to @buffer.</doc>
<return-value transfer-ownership="none">
<doc xml:space="preserve">a #GstNetAddressMeta connected to @buffer</doc>
<type name="NetAddressMeta" c:type="GstNetAddressMeta*"/>
</return-value>
<parameters>
<parameter name="buffer" transfer-ownership="none">
<doc xml:space="preserve">a #GstBuffer</doc>
<type name="Gst.Buffer" c:type="GstBuffer*"/>
</parameter>
<parameter name="addr" transfer-ownership="none">
<doc xml:space="preserve">a @GSocketAddress to connect to @buffer</doc>
<type name="Gio.SocketAddress" c:type="GSocketAddress*"/>
</parameter>
</parameters>
</function>
<function name="buffer_add_net_control_message_meta"
c:identifier="gst_buffer_add_net_control_message_meta">
<doc xml:space="preserve">Attaches @message as metadata in a #GstNetControlMessageMeta to @buffer.</doc>
<return-value transfer-ownership="none">
<doc xml:space="preserve">a #GstNetControlMessageMeta connected to @buffer</doc>
<type name="NetControlMessageMeta" c:type="GstNetControlMessageMeta*"/>
</return-value>
<parameters>
<parameter name="buffer" transfer-ownership="none">
<doc xml:space="preserve">a #GstBuffer</doc>
<type name="Gst.Buffer" c:type="GstBuffer*"/>
</parameter>
<parameter name="message" transfer-ownership="none">
<doc xml:space="preserve">a @GSocketControlMessage to attach to @buffer</doc>
<type name="Gio.SocketControlMessage"
c:type="GSocketControlMessage*"/>
</parameter>
</parameters>
</function>
<function name="buffer_get_net_address_meta"
c:identifier="gst_buffer_get_net_address_meta">
<doc xml:space="preserve">Find the #GstNetAddressMeta on @buffer.</doc>
<return-value transfer-ownership="none">
<doc xml:space="preserve">the #GstNetAddressMeta or %NULL when there
is no such metadata on @buffer.</doc>
<type name="NetAddressMeta" c:type="GstNetAddressMeta*"/>
</return-value>
<parameters>
<parameter name="buffer" transfer-ownership="none">
<doc xml:space="preserve">a #GstBuffer</doc>
<type name="Gst.Buffer" c:type="GstBuffer*"/>
</parameter>
</parameters>
</function>
<function name="net_address_meta_api_get_type"
c:identifier="gst_net_address_meta_api_get_type">
<return-value transfer-ownership="none">
<type name="GType" c:type="GType"/>
</return-value>
</function>
<function name="net_address_meta_get_info"
c:identifier="gst_net_address_meta_get_info"
moved-to="NetAddressMeta.get_info">
<return-value transfer-ownership="none">
<type name="Gst.MetaInfo" c:type="const GstMetaInfo*"/>
</return-value>
</function>
<function name="net_control_message_meta_api_get_type"
c:identifier="gst_net_control_message_meta_api_get_type">
<return-value transfer-ownership="none">
<type name="GType" c:type="GType"/>
</return-value>
</function>
<function name="net_control_message_meta_get_info"
c:identifier="gst_net_control_message_meta_get_info"
moved-to="NetControlMessageMeta.get_info">
<return-value transfer-ownership="none">
<type name="Gst.MetaInfo" c:type="const GstMetaInfo*"/>
</return-value>
</function>
<function name="net_time_packet_receive"
c:identifier="gst_net_time_packet_receive"
moved-to="NetTimePacket.receive"
throws="1">
<doc xml:space="preserve">Receives a #GstNetTimePacket over a socket. Handles interrupted system
calls, but otherwise returns NULL on error.</doc>
<return-value transfer-ownership="full">
<doc xml:space="preserve">a new #GstNetTimePacket, or NULL on error. Free
with gst_net_time_packet_free() when done.</doc>
<type name="NetTimePacket" c:type="GstNetTimePacket*"/>
</return-value>
<parameters>
<parameter name="socket" transfer-ownership="none">
<doc xml:space="preserve">socket to receive the time packet on</doc>
<type name="Gio.Socket" c:type="GSocket*"/>
</parameter>
<parameter name="src_address"
direction="out"
caller-allocates="0"
transfer-ownership="full">
<doc xml:space="preserve">address of variable to return sender address</doc>
<type name="Gio.SocketAddress" c:type="GSocketAddress**"/>
</parameter>
</parameters>
</function>
<function name="ptp_deinit" c:identifier="gst_ptp_deinit" version="1.6">
<doc xml:space="preserve">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.</doc>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
</function>
<function name="ptp_init" c:identifier="gst_ptp_init" version="1.6">
<doc xml:space="preserve">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.</doc>
<return-value transfer-ownership="none">
<doc xml:space="preserve">%TRUE if the GStreamer PTP clock subsystem could be initialized.</doc>
<type name="gboolean" c:type="gboolean"/>
</return-value>
<parameters>
<parameter name="clock_id" transfer-ownership="none">
<doc xml:space="preserve">PTP clock id of this process' clock or %GST_PTP_CLOCK_ID_NONE</doc>
<type name="guint64" c:type="guint64"/>
</parameter>
<parameter name="interfaces"
transfer-ownership="none"
nullable="1"
allow-none="1">
<doc xml:space="preserve">network interfaces to run the clock on</doc>
<array c:type="gchar**">
<type name="utf8" c:type="gchar*"/>
</array>
</parameter>
</parameters>
</function>
<function name="ptp_is_initialized"
c:identifier="gst_ptp_is_initialized"
version="1.6">
<doc xml:space="preserve">Check if the GStreamer PTP clock subsystem is initialized.</doc>
<return-value transfer-ownership="none">
<doc xml:space="preserve">%TRUE if the GStreamer PTP clock subsystem is intialized.</doc>
<type name="gboolean" c:type="gboolean"/>
</return-value>
</function>
<function name="ptp_is_supported"
c:identifier="gst_ptp_is_supported"
version="1.6">
<doc xml:space="preserve">Check if PTP clocks are generally supported on this system, and if previous
initializations did not fail.</doc>
<return-value transfer-ownership="none">
<doc xml:space="preserve">%TRUE if PTP clocks are generally supported on this system, and
previous initializations did not fail.</doc>
<type name="gboolean" c:type="gboolean"/>
</return-value>
</function>
<function name="ptp_statistics_callback_add"
c:identifier="gst_ptp_statistics_callback_add"
version="1.6">
<doc xml:space="preserve">Installs a new statistics callback for gathering PTP statistics. See
GstPtpStatisticsCallback for a list of statistics that are provided.</doc>
<return-value transfer-ownership="none">
<doc xml:space="preserve">Id for the callback that can be passed to
gst_ptp_statistics_callback_remove()</doc>
<type name="gulong" c:type="gulong"/>
</return-value>
<parameters>
<parameter name="callback"
transfer-ownership="none"
scope="notified"
closure="1"
destroy="2">
<doc xml:space="preserve">GstPtpStatisticsCallback to call</doc>
<type name="PtpStatisticsCallback"
c:type="GstPtpStatisticsCallback"/>
</parameter>
<parameter name="user_data"
transfer-ownership="none"
nullable="1"
allow-none="1">
<doc xml:space="preserve">Data to pass to the callback</doc>
<type name="gpointer" c:type="gpointer"/>
</parameter>
<parameter name="destroy_data" transfer-ownership="none" scope="async">
<doc xml:space="preserve">GDestroyNotify to destroy the data</doc>
<type name="GLib.DestroyNotify" c:type="GDestroyNotify"/>
</parameter>
</parameters>
</function>
<function name="ptp_statistics_callback_remove"
c:identifier="gst_ptp_statistics_callback_remove"
version="1.6">
<doc xml:space="preserve">Removes a PTP statistics callback that was previously added with
gst_ptp_statistics_callback_add().</doc>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
<parameters>
<parameter name="id" transfer-ownership="none">
<doc xml:space="preserve">Callback id to remove</doc>
<type name="gulong" c:type="gulong"/>
</parameter>
</parameters>
</function>
</namespace>
</repository>

114
gstreamer-net/CHANGELOG.md Normal file
View file

@ -0,0 +1,114 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html),
specifically the [variant used by Rust](http://doc.crates.io/manifest.html#the-version-field).
## [0.9.1] - 2017-11-26
### Fixed
- Export `FlowError`/`FlowSuccess`, `ClockError`/`ClockSuccess`,
`PadLinkError`/`PadLinkSuccess` too
## [0.9.0] - 2017-11-26
### Added
- Bindings for (outputting to) the GStreamer logging system
- Bindings for the GStreamer base library
- Bindings for all the `Pad` functions to override pad behaviour, and pad task
functions
- Bindings for `StaticCaps` and `StaticPadTemplate`
- Bindings for `deep-notify` signal on `Object`
- Support for directly creating `Error`/`Warning`/`Info` `Messages` and posting them
from an element with context information (file, line, module, etc.) similar
to the C `GST_ELEMENT_ERROR` macro
- Support for setting custom fields in `Messages`/`Events` during construction
- Support for creating Buffers out of anything that is `AsRef<[u8]>` or
`AsMut<[u8]>`
- Support for using the `Read` trait on `Adapter`
- Functions for getting all sink/src/all pads of an `Element`, and all children
of a `Bin`
- Builder for `Caps` and `Structures` in addition to the existing functions
- `AppSrc`/`AppSink` implement `BaseSrc`/`BaseSink` and `URIHandler`
- Rust ports of the basic tutorials 1 to 8 from
https://gstreamer.freedesktop.org/documentation/tutorials/
- "Getting started" and "Installation" sections to the README.md
- "dox" feature for generating documentation for all available configurations
### Fixed
- `StackTraceFlags` are only available since 1.12
- Worked around macOS requiring a `NSRunLoop` running on the main thread in all
examples and tutorials, to be able to show a window or anything else
### Changed
- `ClockTime` is now a wrapper around `Option<u64>` to handle the
`CLOCK_TIME_NONE` case better. This wrapper implements all the arithmetic
and other traits as needed and ensures that no accidential calculations with
`CLOCK_TIME_NONE` can happen
- "Values with format", like in `Duration`/`Position`/`Convert` queries or
`Seek` events now return a `FormatValue` type. This contains the actual
`Format` together with the value and does any required conversions. This
also makes it harder to accidentially mix e.g. values in bytes and time
- `PadProbeId` does not implement `Clone`/`Copy` anymore
- Property notify watches return a custom type instead of ulong
- `Error`/`Warning`/`Info` `Messages` can only be created with specific kinds of
`glib::Error` now. Using arbitrary ones does not work
- `Iterator` bindings were completely rewritten and provide the item type as a
generic type parameter now, greatly simplifying its usage
- All `glib::Values` are now `glib::SendValue` instead, e.g. in `Caps` and
`Structures`, as their content must be possible to send to different threads
safely
- `Message::get_src()` can return `None`
- Allow `None` as `Caps` in `AppSrc`/`AppSink`
- Allow everything implementing `Into<Option<&str>>` to be used as a pad name
- Moved `copy()` from `GstRc` directly to `MiniObject`
- Success/Error enums (like `FlowReturn`, `PadLinkReturn`, `StateChangeReturn`) now
implement an `into_result()` function that splits them into a `Result` with
the good and bad cases. Also mark them as `#[must_use]` to make it harder to
accidentially ignore errors.
- Error enums implement the `Error` trait
- Many examples use the `failure` crate for error handling now, cleaning up the
error handling code quite a bit
- Lots of other code cleanup, compiler/clippy warning cleanup, etc.
## [0.8.2] - 2017-11-11
### Fixed
- Implement StaticType of BufferRef instead of Buffer. Buffer aka
GstRc<BufferRef> already implements StaticType if BufferRef does, and
without this it was not possible to use Buffers in GValues.
- Free memory of the appsink/appsrc callbacks with the correct type. It was
crashing because of using the wrong type before.
- Fix documentation URLs in Cargo.toml.
### Added
- Installation instructions and links to documentation for getting started to
README.md.
## [0.8.1] - 2017-09-15
### Added
- Implement Send+Sync for Query, Message and Event, and their corresponding
Ref types.
### Fixed
- Constructor for gst_player::Player now works properly with GStreamer 1.12
when passing a video renderer or signal dispatcher. There was a reference
counting bug.
- Instead of returning &'static references from functions, return references
with a generic, unbound lifetime instead.
See https://github.com/rust-lang/rust/pull/42417#issue-233404573
- Various "unused external crate" warnings and clippy warnings everywhere.
### Changed
- Remove Cargo.lock from GIT, it's not very useful for library crates.
- Run everything through latest rustfmt-nightly.
- Use while-let (instead of loop and if-let) and CLOCK_TIME_NONE (instead of
u64::MAX) in the examples.
## [0.8.0] - 2017-08-31
- Initial release of the autogenerated GStreamer bindings. Older versions
(< 0.8.0) of the bindings can be found [here](https://github.com/arturoc/gstreamer1.0-rs).
The API of the two is incompatible.
[Unreleased]: https://github.com/sdroege/gstreamer-rs/compare/0.8.1...HEAD
[0.8.1]: https://github.com/sdroege/gstreamer-rs/compare/0.8.0...0.8.1

36
gstreamer-net/Cargo.toml Normal file
View file

@ -0,0 +1,36 @@
[package]
name = "gstreamer-net"
version = "0.10.0"
authors = ["Sebastian Dröge <sebastian@centricular.com>"]
categories = ["api-bindings", "multimedia"]
description = "Rust bindings for GStreamer Net library"
repository = "https://github.com/sdroege/gstreamer-rs"
license = "MIT/Apache-2.0"
readme = "README.md"
homepage = "https://gstreamer.freedesktop.org"
documentation = "https://sdroege.github.io/rustdoc/gstreamer/gstreamer-net"
keywords = ["gstreamer", "multimedia", "audio", "video", "gnome"]
build = "build.rs"
[dependencies]
glib-sys = { git = "https://github.com/gtk-rs/sys" }
gobject-sys = { git = "https://github.com/gtk-rs/sys" }
gstreamer-sys = { git = "https://github.com/sdroege/gstreamer-sys", features = ["v1_8"] }
gstreamer-net-sys = { git = "https://github.com/sdroege/gstreamer-sys", features = ["v1_8"] }
glib = { git = "https://github.com/gtk-rs/glib" }
gstreamer = { path = "../gstreamer" }
[build-dependencies.rustdoc-stripper]
version = "0.1"
optional = true
[features]
v1_10 = ["gstreamer-sys/v1_10", "gstreamer-net-sys/v1_10"]
v1_12 = ["gstreamer-sys/v1_12", "gstreamer-net-sys/v1_12", "v1_10"]
embed-lgpl-docs = ["rustdoc-stripper"]
purge-lgpl-docs = ["rustdoc-stripper"]
dox = ["gstreamer-net-sys/dox", "glib/dox", "gstreamer/dox"]
default-features = []
[badges]
travis-ci = { repository = "sdroege/gstreamer-rs", branch = "master" }

View file

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

23
gstreamer-net/LICENSE-MIT Normal file
View file

@ -0,0 +1,23 @@
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

170
gstreamer-net/README.md Normal file
View file

@ -0,0 +1,170 @@
# gstreamer-rs [![crates.io](https://img.shields.io/crates/v/gstreamer-app.svg)](https://crates.io/crates/gstreamer-app) [![Build Status](https://travis-ci.org/sdroege/gstreamer-rs.svg?branch=master)](https://travis-ci.org/sdroege/gstreamer-rs)
[GStreamer](https://gstreamer.freedesktop.org/) (Net library) bindings for Rust.
Documentation can be found [here](https://sdroege.github.io/rustdoc/gstreamer/gstreamer/).
These bindings are providing a safe API that can be used to interface with
GStreamer, e.g. for writing GStreamer-based applications.
For background and motivation, see the [announcement blogpost](https://coaxion.net/blog/2017/07/writing-gstreamer-applications-in-rust/).
The bindings (since 0.8.0) are autogenerated with [gir](https://github.com/gtk-rs/gir/)
based on the [GObject-Introspection](https://wiki.gnome.org/Projects/GObjectIntrospection/)
API metadata provided by the GStreamer project. Older versions before 0.8.0 were manually
written and the repository can be found [here](https://github.com/arturoc/gstreamer1.0-rs).
The API of the two is incompatible.
A crate for writing GStreamer plugins in Rust can be found here: https://github.com/sdroege/gst-plugin-rs
## Table of Contents
1. [Installation](#installation)
1. [Linux/BSDs](#installation-linux)
1. [macOS](#installation-macos)
1. [Windows](#installation-windows)
1. [Getting Started](#getting-started)
1. [License](#license)
1. [Contribution](#contribution)
<a name="installation"/>
## Installation
To build the GStreamer bindings or anything depending on them, you need to
have at least GStreamer 1.8 and gst-plugins-base 1.8 installed. In addition,
some of the examples/tutorials require various GStreamer plugins to be
available, which can be found in gst-plugins-base, gst-plugins-good,
gst-plugins-bad, gst-plugins-ugly and/or gst-libav.
<a name="installation-linux"/>
### Linux/BSDs
You need to install the above mentioned packages with your distributions
package manager, or build them from source.
On Debian/Ubuntu they can be installed with
```
$ apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \
gstreamer1.0-plugins-base gstreamer1.0-plugins-good \
gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly \
gstreamer1.0-libav
```
Package names on other distributions should be similar.
Please submit a pull request with instructions for yours.
<a name="installation-macos"/>
### macOS
You can install GStreamer and the plugins via [Homebrew](https://brew.sh/) or
by installing the [binaries](https://gstreamer.freedesktop.org/data/pkg/osx/)
provided by the GStreamer project.
#### Homebrew
```
$ brew install gstreamer gst-plugins-base gst-plugins-good \
gst-plugins-bad gst-plugins-ugly gst-libav
```
#### GStreamer Binaries
You need to download the *two* `.pkg` files from the GStreamer website and
install them, e.g. `gstreamer-1.0-1.12.3-x86_64.pkg` and
`gstreamer-1.0-devel-1.12.3-x86_64.pkg`.
After installation, you also need to install `pkg-config` (e.g. via Homebrew)
and set the `PKG_CONFIG_PATH` environment variable
```
$ export PKG_CONFIG_PATH="/Frameworks/GStreamer.framework/Versions/Current/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
```
<a name="installation-windows"/>
### Windows
You can install GStreamer and the plugins via [MSYS2](http://www.msys2.org/)
with `pacman` or by installing the
[binaries](https://gstreamer.freedesktop.org/data/pkg/windows/) provided by
the GStreamer project.
#### MSYS2 / pacman
```
$ pacman -S pkg-config mingw-w64-x86_64-gstreamer mingw-w64-x86_64-gst-plugins-base \
mingw-w64-x86_64-gst-plugins-good mingw-w64-x86_64-gst-plugins-bad \
mingw-w64-x86_64-gst-plugins-ugly mingw-w64-x86_64-gst-libav
```
#### GStreamer Binaries
You need to download the *two* `.msi` files for your platform from the
GStreamer website and install them, e.g. `gstreamer-1.0-x86_64-1.12.3.msi` and
`gstreamer-1.0-devel-x86_64-1.12.3.msi`.
After installation, you also need to install `pkg-config` (e.g. via MSYS2 or
from [here](https://sourceforge.net/projects/pkgconfiglite/))
and set the `PKG_CONFIG_PATH` environment variable
```
$ export PKG_CONFIG_PATH="c:\\gstreamer\\1.0\\x86_64\\lib\\pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
```
<a name="getting-started"/>
## Getting Started
The API reference can be found
[here](https://sdroege.github.io/rustdoc/gstreamer/gstreamer/), however it is
only the Rust API reference and does not explain any of the concepts.
For getting started with GStreamer development, the best would be to follow
the [documentation](https://gstreamer.freedesktop.org/documentation/) on the
GStreamer website, especially the [Application Development
Manual](https://gstreamer.freedesktop.org/documentation/application-development/).
While being C-centric, it explains all the fundamental concepts of GStreamer
and the code examples should be relatively easily translatable to Rust. The
API is basically the same, function/struct names are the same and everything
is only more convenient (hopefully) and safer.
In addition there are
[tutorials](https://gstreamer.freedesktop.org/documentation/tutorials/) on the
GStreamer website. Many of them were ported to Rust already and the code can
be found in the
[tutorials](https://github.com/sdroege/gstreamer-rs/tree/master/tutorials)
directory.
Some further examples for various aspects of GStreamer and how to use it from
Rust can be found in the
[examples](https://github.com/sdroege/gstreamer-rs/tree/master/examples)
directory.
<a name="license"/>
## LICENSE
gstreamer-rs and all crates contained in here are licensed under either of
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
http://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or
http://opensource.org/licenses/MIT)
at your option.
GStreamer itself is licensed under the Lesser General Public License version
2.1 or (at your option) any later version:
https://www.gnu.org/licenses/lgpl-2.1.html
<a name="contribution"/>
## Contribution
Any kinds of contributions are welcome as a pull request.
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in gstreamer-rs by you, as defined in the Apache-2.0 license, shall be
dual licensed as above, without any additional terms or conditions.

34
gstreamer-net/build.rs Normal file
View file

@ -0,0 +1,34 @@
fn main() {
manage_docs();
}
#[cfg(any(feature = "embed-lgpl-docs", feature = "purge-lgpl-docs"))]
fn manage_docs() {
extern crate stripper_lib;
use std::io;
let path = "src";
let ignores: &[&str] = &[];
stripper_lib::loop_over_files(
path.as_ref(),
&mut |w, s| stripper_lib::strip_comments(w, s, &mut io::sink(), true),
&ignores,
false,
);
#[cfg(feature = "embed-lgpl-docs")]
{
let docs = include_str!("../docs/gstreamer-net/docs.md");
let mut infos = stripper_lib::parse_cmts(docs.lines(), true);
stripper_lib::loop_over_files(
path.as_ref(),
&mut |w, s| stripper_lib::regenerate_comments(w, s, &mut infos, true, true),
&ignores,
false,
);
}
}
#[cfg(not(any(feature = "embed-lgpl-docs", feature = "purge-lgpl-docs")))]
fn manage_docs() {}

View file

@ -0,0 +1,6 @@
// This file was generated by gir (d50d839) from gir-files (???)
// DO NOT EDIT
use ffi;
use glib::translate::*;

View file

@ -0,0 +1,6 @@
// This file was generated by gir (d50d839) from gir-files (???)
// DO NOT EDIT
use ffi;
use glib::translate::*;

View file

@ -0,0 +1,18 @@
// This file was generated by gir (d50d839) from gir-files (???)
// DO NOT EDIT
mod net_client_clock;
pub use self::net_client_clock::NetClientClock;
mod net_time_provider;
pub use self::net_time_provider::NetTimeProvider;
mod ntp_clock;
pub use self::ntp_clock::NtpClock;
mod ptp_clock;
pub use self::ptp_clock::PtpClock;
#[doc(hidden)]
pub mod traits {
}

View file

@ -0,0 +1,234 @@
// This file was generated by gir (d50d839) from gir-files (???)
// DO NOT EDIT
use ffi;
use glib::StaticType;
use glib::Value;
use glib::object::Downcast;
use glib::signal::SignalHandlerId;
use glib::signal::connect;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use gst;
use gst_ffi;
use std::boxed::Box as Box_;
use std::mem;
use std::mem::transmute;
use std::ptr;
glib_wrapper! {
pub struct NetClientClock(Object<ffi::GstNetClientClock, ffi::GstNetClientClockClass>): [
gst::Clock => gst_ffi::GstClock,
gst::Object => gst_ffi::GstObject,
];
match fn {
get_type => || ffi::gst_net_client_clock_get_type(),
}
}
impl NetClientClock {
pub fn new<'a, P: Into<Option<&'a str>>>(name: P, remote_address: &str, remote_port: i32, base_time: gst::ClockTime) -> NetClientClock {
assert_initialized_main_thread!();
let name = name.into();
let name = name.to_glib_none();
unsafe {
gst::Clock::from_glib_none(ffi::gst_net_client_clock_new(name.0, remote_address.to_glib_none().0, remote_port, base_time.to_glib())).downcast_unchecked()
}
}
pub fn get_property_address(&self) -> Option<String> {
unsafe {
let mut value = Value::uninitialized();
gobject_ffi::g_value_init(value.to_glib_none_mut().0, <String as StaticType>::static_type().to_glib());
gobject_ffi::g_object_get_property(self.to_glib_none().0, "address".to_glib_none().0, value.to_glib_none_mut().0);
value.get()
}
}
pub fn set_property_address(&self, address: Option<&str>) {
unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, "address".to_glib_none().0, Value::from(address).to_glib_none().0);
}
}
pub fn get_property_base_time(&self) -> u64 {
unsafe {
let mut value = Value::uninitialized();
gobject_ffi::g_value_init(value.to_glib_none_mut().0, <u64 as StaticType>::static_type().to_glib());
gobject_ffi::g_object_get_property(self.to_glib_none().0, "base-time".to_glib_none().0, value.to_glib_none_mut().0);
value.get().unwrap()
}
}
pub fn get_property_bus(&self) -> Option<gst::Bus> {
unsafe {
let mut value = Value::uninitialized();
gobject_ffi::g_value_init(value.to_glib_none_mut().0, <gst::Bus as StaticType>::static_type().to_glib());
gobject_ffi::g_object_get_property(self.to_glib_none().0, "bus".to_glib_none().0, value.to_glib_none_mut().0);
value.get()
}
}
pub fn set_property_bus(&self, bus: Option<&gst::Bus>) {
unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, "bus".to_glib_none().0, Value::from(bus).to_glib_none().0);
}
}
pub fn get_property_internal_clock(&self) -> Option<gst::Clock> {
unsafe {
let mut value = Value::uninitialized();
gobject_ffi::g_value_init(value.to_glib_none_mut().0, <gst::Clock as StaticType>::static_type().to_glib());
gobject_ffi::g_object_get_property(self.to_glib_none().0, "internal-clock".to_glib_none().0, value.to_glib_none_mut().0);
value.get()
}
}
pub fn get_property_minimum_update_interval(&self) -> u64 {
unsafe {
let mut value = Value::uninitialized();
gobject_ffi::g_value_init(value.to_glib_none_mut().0, <u64 as StaticType>::static_type().to_glib());
gobject_ffi::g_object_get_property(self.to_glib_none().0, "minimum-update-interval".to_glib_none().0, value.to_glib_none_mut().0);
value.get().unwrap()
}
}
pub fn set_property_minimum_update_interval(&self, minimum_update_interval: u64) {
unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, "minimum-update-interval".to_glib_none().0, Value::from(&minimum_update_interval).to_glib_none().0);
}
}
pub fn get_property_port(&self) -> i32 {
unsafe {
let mut value = Value::uninitialized();
gobject_ffi::g_value_init(value.to_glib_none_mut().0, <i32 as StaticType>::static_type().to_glib());
gobject_ffi::g_object_get_property(self.to_glib_none().0, "port".to_glib_none().0, value.to_glib_none_mut().0);
value.get().unwrap()
}
}
pub fn set_property_port(&self, port: i32) {
unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, "port".to_glib_none().0, Value::from(&port).to_glib_none().0);
}
}
pub fn get_property_round_trip_limit(&self) -> u64 {
unsafe {
let mut value = Value::uninitialized();
gobject_ffi::g_value_init(value.to_glib_none_mut().0, <u64 as StaticType>::static_type().to_glib());
gobject_ffi::g_object_get_property(self.to_glib_none().0, "round-trip-limit".to_glib_none().0, value.to_glib_none_mut().0);
value.get().unwrap()
}
}
pub fn set_property_round_trip_limit(&self, round_trip_limit: u64) {
unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, "round-trip-limit".to_glib_none().0, Value::from(&round_trip_limit).to_glib_none().0);
}
}
pub fn connect_property_address_notify<F: Fn(&NetClientClock) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&NetClientClock) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::address",
transmute(notify_address_trampoline as usize), Box_::into_raw(f) as *mut _)
}
}
pub fn connect_property_base_time_notify<F: Fn(&NetClientClock) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&NetClientClock) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::base-time",
transmute(notify_base_time_trampoline as usize), Box_::into_raw(f) as *mut _)
}
}
pub fn connect_property_bus_notify<F: Fn(&NetClientClock) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&NetClientClock) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::bus",
transmute(notify_bus_trampoline as usize), Box_::into_raw(f) as *mut _)
}
}
pub fn connect_property_internal_clock_notify<F: Fn(&NetClientClock) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&NetClientClock) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::internal-clock",
transmute(notify_internal_clock_trampoline as usize), Box_::into_raw(f) as *mut _)
}
}
pub fn connect_property_minimum_update_interval_notify<F: Fn(&NetClientClock) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&NetClientClock) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::minimum-update-interval",
transmute(notify_minimum_update_interval_trampoline as usize), Box_::into_raw(f) as *mut _)
}
}
pub fn connect_property_port_notify<F: Fn(&NetClientClock) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&NetClientClock) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::port",
transmute(notify_port_trampoline as usize), Box_::into_raw(f) as *mut _)
}
}
pub fn connect_property_round_trip_limit_notify<F: Fn(&NetClientClock) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&NetClientClock) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::round-trip-limit",
transmute(notify_round_trip_limit_trampoline as usize), Box_::into_raw(f) as *mut _)
}
}
}
unsafe impl Send for NetClientClock {}
unsafe impl Sync for NetClientClock {}
unsafe extern "C" fn notify_address_trampoline(this: *mut ffi::GstNetClientClock, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) {
callback_guard!();
let f: &&(Fn(&NetClientClock) + Send + Sync + 'static) = transmute(f);
f(&from_glib_borrow(this))
}
unsafe extern "C" fn notify_base_time_trampoline(this: *mut ffi::GstNetClientClock, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) {
callback_guard!();
let f: &&(Fn(&NetClientClock) + Send + Sync + 'static) = transmute(f);
f(&from_glib_borrow(this))
}
unsafe extern "C" fn notify_bus_trampoline(this: *mut ffi::GstNetClientClock, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) {
callback_guard!();
let f: &&(Fn(&NetClientClock) + Send + Sync + 'static) = transmute(f);
f(&from_glib_borrow(this))
}
unsafe extern "C" fn notify_internal_clock_trampoline(this: *mut ffi::GstNetClientClock, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) {
callback_guard!();
let f: &&(Fn(&NetClientClock) + Send + Sync + 'static) = transmute(f);
f(&from_glib_borrow(this))
}
unsafe extern "C" fn notify_minimum_update_interval_trampoline(this: *mut ffi::GstNetClientClock, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) {
callback_guard!();
let f: &&(Fn(&NetClientClock) + Send + Sync + 'static) = transmute(f);
f(&from_glib_borrow(this))
}
unsafe extern "C" fn notify_port_trampoline(this: *mut ffi::GstNetClientClock, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) {
callback_guard!();
let f: &&(Fn(&NetClientClock) + Send + Sync + 'static) = transmute(f);
f(&from_glib_borrow(this))
}
unsafe extern "C" fn notify_round_trip_limit_trampoline(this: *mut ffi::GstNetClientClock, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) {
callback_guard!();
let f: &&(Fn(&NetClientClock) + Send + Sync + 'static) = transmute(f);
f(&from_glib_borrow(this))
}

View file

@ -0,0 +1,140 @@
// This file was generated by gir (d50d839) from gir-files (???)
// DO NOT EDIT
use ffi;
use glib::StaticType;
use glib::Value;
use glib::object::IsA;
use glib::signal::SignalHandlerId;
use glib::signal::connect;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use gst;
use gst_ffi;
use std::boxed::Box as Box_;
use std::mem;
use std::mem::transmute;
use std::ptr;
glib_wrapper! {
pub struct NetTimeProvider(Object<ffi::GstNetTimeProvider, ffi::GstNetTimeProviderClass>): [
gst::Object => gst_ffi::GstObject,
];
match fn {
get_type => || ffi::gst_net_time_provider_get_type(),
}
}
impl NetTimeProvider {
pub fn new<'a, P: IsA<gst::Clock>, Q: Into<Option<&'a str>>>(clock: &P, address: Q, port: i32) -> NetTimeProvider {
assert_initialized_main_thread!();
let address = address.into();
let address = address.to_glib_none();
unsafe {
from_glib_none(ffi::gst_net_time_provider_new(clock.to_glib_none().0, address.0, port))
}
}
pub fn get_property_active(&self) -> bool {
unsafe {
let mut value = Value::uninitialized();
gobject_ffi::g_value_init(value.to_glib_none_mut().0, <bool as StaticType>::static_type().to_glib());
gobject_ffi::g_object_get_property(self.to_glib_none().0, "active".to_glib_none().0, value.to_glib_none_mut().0);
value.get().unwrap()
}
}
pub fn set_property_active(&self, active: bool) {
unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, "active".to_glib_none().0, Value::from(&active).to_glib_none().0);
}
}
pub fn get_property_address(&self) -> Option<String> {
unsafe {
let mut value = Value::uninitialized();
gobject_ffi::g_value_init(value.to_glib_none_mut().0, <String as StaticType>::static_type().to_glib());
gobject_ffi::g_object_get_property(self.to_glib_none().0, "address".to_glib_none().0, value.to_glib_none_mut().0);
value.get()
}
}
pub fn get_property_clock(&self) -> Option<gst::Clock> {
unsafe {
let mut value = Value::uninitialized();
gobject_ffi::g_value_init(value.to_glib_none_mut().0, <gst::Clock as StaticType>::static_type().to_glib());
gobject_ffi::g_object_get_property(self.to_glib_none().0, "clock".to_glib_none().0, value.to_glib_none_mut().0);
value.get()
}
}
pub fn get_property_port(&self) -> i32 {
unsafe {
let mut value = Value::uninitialized();
gobject_ffi::g_value_init(value.to_glib_none_mut().0, <i32 as StaticType>::static_type().to_glib());
gobject_ffi::g_object_get_property(self.to_glib_none().0, "port".to_glib_none().0, value.to_glib_none_mut().0);
value.get().unwrap()
}
}
pub fn connect_property_active_notify<F: Fn(&NetTimeProvider) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&NetTimeProvider) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::active",
transmute(notify_active_trampoline as usize), Box_::into_raw(f) as *mut _)
}
}
pub fn connect_property_address_notify<F: Fn(&NetTimeProvider) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&NetTimeProvider) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::address",
transmute(notify_address_trampoline as usize), Box_::into_raw(f) as *mut _)
}
}
pub fn connect_property_clock_notify<F: Fn(&NetTimeProvider) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&NetTimeProvider) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::clock",
transmute(notify_clock_trampoline as usize), Box_::into_raw(f) as *mut _)
}
}
pub fn connect_property_port_notify<F: Fn(&NetTimeProvider) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&NetTimeProvider) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::port",
transmute(notify_port_trampoline as usize), Box_::into_raw(f) as *mut _)
}
}
}
unsafe impl Send for NetTimeProvider {}
unsafe impl Sync for NetTimeProvider {}
unsafe extern "C" fn notify_active_trampoline(this: *mut ffi::GstNetTimeProvider, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) {
callback_guard!();
let f: &&(Fn(&NetTimeProvider) + Send + Sync + 'static) = transmute(f);
f(&from_glib_borrow(this))
}
unsafe extern "C" fn notify_address_trampoline(this: *mut ffi::GstNetTimeProvider, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) {
callback_guard!();
let f: &&(Fn(&NetTimeProvider) + Send + Sync + 'static) = transmute(f);
f(&from_glib_borrow(this))
}
unsafe extern "C" fn notify_clock_trampoline(this: *mut ffi::GstNetTimeProvider, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) {
callback_guard!();
let f: &&(Fn(&NetTimeProvider) + Send + Sync + 'static) = transmute(f);
f(&from_glib_borrow(this))
}
unsafe extern "C" fn notify_port_trampoline(this: *mut ffi::GstNetTimeProvider, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) {
callback_guard!();
let f: &&(Fn(&NetTimeProvider) + Send + Sync + 'static) = transmute(f);
f(&from_glib_borrow(this))
}

View file

@ -0,0 +1,39 @@
// This file was generated by gir (d50d839) from gir-files (???)
// DO NOT EDIT
use NetClientClock;
use ffi;
use glib::object::Downcast;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use gst;
use gst_ffi;
use std::mem;
use std::ptr;
glib_wrapper! {
pub struct NtpClock(Object<ffi::GstNtpClock, ffi::GstNtpClockClass>): [
NetClientClock,
gst::Clock => gst_ffi::GstClock,
gst::Object => gst_ffi::GstObject,
];
match fn {
get_type => || ffi::gst_ntp_clock_get_type(),
}
}
impl NtpClock {
pub fn new<'a, P: Into<Option<&'a str>>>(name: P, remote_address: &str, remote_port: i32, base_time: gst::ClockTime) -> NtpClock {
assert_initialized_main_thread!();
let name = name.into();
let name = name.to_glib_none();
unsafe {
gst::Clock::from_glib_none(ffi::gst_ntp_clock_new(name.0, remote_address.to_glib_none().0, remote_port, base_time.to_glib())).downcast_unchecked()
}
}
}
unsafe impl Send for NtpClock {}
unsafe impl Sync for NtpClock {}

View file

@ -0,0 +1,135 @@
// This file was generated by gir (d50d839) from gir-files (???)
// DO NOT EDIT
use ffi;
use glib::StaticType;
use glib::Value;
use glib::object::Downcast;
use glib::signal::SignalHandlerId;
use glib::signal::connect;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use gst;
use gst_ffi;
use std::boxed::Box as Box_;
use std::mem;
use std::mem::transmute;
use std::ptr;
glib_wrapper! {
pub struct PtpClock(Object<ffi::GstPtpClock, ffi::GstPtpClockClass>): [
gst::Clock => gst_ffi::GstClock,
gst::Object => gst_ffi::GstObject,
];
match fn {
get_type => || ffi::gst_ptp_clock_get_type(),
}
}
impl PtpClock {
pub fn new<'a, P: Into<Option<&'a str>>>(name: P, domain: u32) -> PtpClock {
assert_initialized_main_thread!();
let name = name.into();
let name = name.to_glib_none();
unsafe {
gst::Clock::from_glib_none(ffi::gst_ptp_clock_new(name.0, domain)).downcast_unchecked()
}
}
pub fn get_property_domain(&self) -> u32 {
unsafe {
let mut value = Value::uninitialized();
gobject_ffi::g_value_init(value.to_glib_none_mut().0, <u32 as StaticType>::static_type().to_glib());
gobject_ffi::g_object_get_property(self.to_glib_none().0, "domain".to_glib_none().0, value.to_glib_none_mut().0);
value.get().unwrap()
}
}
pub fn get_property_grandmaster_clock_id(&self) -> u64 {
unsafe {
let mut value = Value::uninitialized();
gobject_ffi::g_value_init(value.to_glib_none_mut().0, <u64 as StaticType>::static_type().to_glib());
gobject_ffi::g_object_get_property(self.to_glib_none().0, "grandmaster-clock-id".to_glib_none().0, value.to_glib_none_mut().0);
value.get().unwrap()
}
}
pub fn get_property_internal_clock(&self) -> Option<gst::Clock> {
unsafe {
let mut value = Value::uninitialized();
gobject_ffi::g_value_init(value.to_glib_none_mut().0, <gst::Clock as StaticType>::static_type().to_glib());
gobject_ffi::g_object_get_property(self.to_glib_none().0, "internal-clock".to_glib_none().0, value.to_glib_none_mut().0);
value.get()
}
}
pub fn get_property_master_clock_id(&self) -> u64 {
unsafe {
let mut value = Value::uninitialized();
gobject_ffi::g_value_init(value.to_glib_none_mut().0, <u64 as StaticType>::static_type().to_glib());
gobject_ffi::g_object_get_property(self.to_glib_none().0, "master-clock-id".to_glib_none().0, value.to_glib_none_mut().0);
value.get().unwrap()
}
}
pub fn connect_property_domain_notify<F: Fn(&PtpClock) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&PtpClock) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::domain",
transmute(notify_domain_trampoline as usize), Box_::into_raw(f) as *mut _)
}
}
pub fn connect_property_grandmaster_clock_id_notify<F: Fn(&PtpClock) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&PtpClock) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::grandmaster-clock-id",
transmute(notify_grandmaster_clock_id_trampoline as usize), Box_::into_raw(f) as *mut _)
}
}
pub fn connect_property_internal_clock_notify<F: Fn(&PtpClock) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&PtpClock) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::internal-clock",
transmute(notify_internal_clock_trampoline as usize), Box_::into_raw(f) as *mut _)
}
}
pub fn connect_property_master_clock_id_notify<F: Fn(&PtpClock) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&PtpClock) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::master-clock-id",
transmute(notify_master_clock_id_trampoline as usize), Box_::into_raw(f) as *mut _)
}
}
}
unsafe impl Send for PtpClock {}
unsafe impl Sync for PtpClock {}
unsafe extern "C" fn notify_domain_trampoline(this: *mut ffi::GstPtpClock, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) {
callback_guard!();
let f: &&(Fn(&PtpClock) + Send + Sync + 'static) = transmute(f);
f(&from_glib_borrow(this))
}
unsafe extern "C" fn notify_grandmaster_clock_id_trampoline(this: *mut ffi::GstPtpClock, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) {
callback_guard!();
let f: &&(Fn(&PtpClock) + Send + Sync + 'static) = transmute(f);
f(&from_glib_borrow(this))
}
unsafe extern "C" fn notify_internal_clock_trampoline(this: *mut ffi::GstPtpClock, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) {
callback_guard!();
let f: &&(Fn(&PtpClock) + Send + Sync + 'static) = transmute(f);
f(&from_glib_borrow(this))
}
unsafe extern "C" fn notify_master_clock_id_trampoline(this: *mut ffi::GstPtpClock, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) {
callback_guard!();
let f: &&(Fn(&PtpClock) + Send + Sync + 'static) = transmute(f);
f(&from_glib_borrow(this))
}

48
gstreamer-net/src/lib.rs Normal file
View file

@ -0,0 +1,48 @@
// Copyright (C) 2017 Sebastian Dröge <sebastian@centricular.com>
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
extern crate glib_sys as glib_ffi;
extern crate gobject_sys as gobject_ffi;
extern crate gstreamer as gst;
extern crate gstreamer_net_sys as ffi;
extern crate gstreamer_sys as gst_ffi;
#[macro_use]
extern crate glib;
macro_rules! callback_guard {
() => (
let _guard = ::glib::CallbackGuard::new();
)
}
macro_rules! assert_initialized_main_thread {
() => (
if unsafe {::gst_ffi::gst_is_initialized()} != ::glib_ffi::GTRUE {
panic!("GStreamer has not been initialized. Call `gst::init` first.");
}
)
}
pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue, Value};
#[cfg_attr(feature = "cargo-clippy", allow(unreadable_literal))]
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
#[cfg_attr(feature = "cargo-clippy", allow(too_many_arguments))]
#[cfg_attr(feature = "cargo-clippy", allow(match_same_arms))]
mod auto;
pub use auto::*;
// Re-export all the traits in a prelude module, so that applications
// can always "use gst::prelude::*" without getting conflicts
pub mod prelude {
pub use glib::prelude::*;
pub use gst::prelude::*;
pub use auto::traits::*;
}