1#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]
7#![allow(
8 clippy::approx_constant,
9 clippy::type_complexity,
10 clippy::unreadable_literal,
11 clippy::upper_case_acronyms
12)]
13#![cfg_attr(docsrs, feature(doc_cfg))]
14
15use gio_sys as gio;
16use glib_sys as glib;
17use gstreamer_sys as gst;
18
19#[cfg(unix)]
20#[allow(unused_imports)]
21use libc::{dev_t, gid_t, pid_t, socklen_t, uid_t};
22#[allow(unused_imports)]
23use libc::{intptr_t, off_t, size_t, ssize_t, time_t, uintptr_t, FILE};
24#[allow(unused_imports)]
25use std::ffi::{
26 c_char, c_double, c_float, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort, c_void,
27};
28
29#[allow(unused_imports)]
30use glib::{gboolean, gconstpointer, gpointer, GType};
31
32pub const GST_NET_TIME_PACKET_SIZE: c_int = 16;
34pub const GST_PTP_CLOCK_ID_NONE: u64 = 18446744073709551615;
35pub const GST_PTP_STATISTICS_BEST_MASTER_CLOCK_SELECTED: &[u8] =
36 b"GstPtpStatisticsBestMasterClockSelected\0";
37pub const GST_PTP_STATISTICS_NEW_DOMAIN_FOUND: &[u8] = b"GstPtpStatisticsNewDomainFound\0";
38pub const GST_PTP_STATISTICS_PATH_DELAY_MEASURED: &[u8] = b"GstPtpStatisticsPathDelayMeasured\0";
39pub const GST_PTP_STATISTICS_TIME_UPDATED: &[u8] = b"GstPtpStatisticsTimeUpdated\0";
40
41pub type GstPtpStatisticsCallback =
43 Option<unsafe extern "C" fn(u8, *const gst::GstStructure, gpointer) -> gboolean>;
44
45#[derive(Copy, Clone)]
47#[repr(C)]
48pub struct GstNetAddressMeta {
49 pub meta: gst::GstMeta,
50 pub addr: *mut gio::GSocketAddress,
51}
52
53impl ::std::fmt::Debug for GstNetAddressMeta {
54 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
55 f.debug_struct(&format!("GstNetAddressMeta @ {self:p}"))
56 .field("meta", &self.meta)
57 .field("addr", &self.addr)
58 .finish()
59 }
60}
61
62#[derive(Copy, Clone)]
63#[repr(C)]
64pub struct GstNetClientClockClass {
65 pub parent_class: gst::GstSystemClockClass,
66 pub _gst_reserved: [gpointer; 4],
67}
68
69impl ::std::fmt::Debug for GstNetClientClockClass {
70 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
71 f.debug_struct(&format!("GstNetClientClockClass @ {self:p}"))
72 .field("parent_class", &self.parent_class)
73 .finish()
74 }
75}
76
77#[repr(C)]
78#[allow(dead_code)]
79pub struct _GstNetClientClockPrivate {
80 _data: [u8; 0],
81 _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
82}
83
84pub type GstNetClientClockPrivate = _GstNetClientClockPrivate;
85
86#[derive(Copy, Clone)]
87#[repr(C)]
88pub struct GstNetControlMessageMeta {
89 pub meta: gst::GstMeta,
90 pub message: *mut gio::GSocketControlMessage,
91}
92
93impl ::std::fmt::Debug for GstNetControlMessageMeta {
94 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
95 f.debug_struct(&format!("GstNetControlMessageMeta @ {self:p}"))
96 .field("meta", &self.meta)
97 .field("message", &self.message)
98 .finish()
99 }
100}
101
102#[derive(Copy, Clone)]
103#[repr(C)]
104pub struct GstNetTimePacket {
105 pub local_time: gst::GstClockTime,
106 pub remote_time: gst::GstClockTime,
107}
108
109impl ::std::fmt::Debug for GstNetTimePacket {
110 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
111 f.debug_struct(&format!("GstNetTimePacket @ {self:p}"))
112 .field("local_time", &self.local_time)
113 .field("remote_time", &self.remote_time)
114 .finish()
115 }
116}
117
118#[derive(Copy, Clone)]
119#[repr(C)]
120pub struct GstNetTimeProviderClass {
121 pub parent_class: gst::GstObjectClass,
122 pub _gst_reserved: [gpointer; 4],
123}
124
125impl ::std::fmt::Debug for GstNetTimeProviderClass {
126 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
127 f.debug_struct(&format!("GstNetTimeProviderClass @ {self:p}"))
128 .field("parent_class", &self.parent_class)
129 .field("_gst_reserved", &self._gst_reserved)
130 .finish()
131 }
132}
133
134#[repr(C)]
135#[allow(dead_code)]
136pub struct _GstNetTimeProviderPrivate {
137 _data: [u8; 0],
138 _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
139}
140
141pub type GstNetTimeProviderPrivate = _GstNetTimeProviderPrivate;
142
143#[derive(Copy, Clone)]
144#[repr(C)]
145pub struct GstNtpClockClass {
146 pub parent_class: gst::GstSystemClockClass,
147 pub _gst_reserved: [gpointer; 4],
148}
149
150impl ::std::fmt::Debug for GstNtpClockClass {
151 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
152 f.debug_struct(&format!("GstNtpClockClass @ {self:p}"))
153 .field("parent_class", &self.parent_class)
154 .finish()
155 }
156}
157
158#[derive(Copy, Clone)]
159#[repr(C)]
160pub struct GstPtpClockClass {
161 pub parent_class: gst::GstSystemClockClass,
162 pub _gst_reserved: [gpointer; 4],
163}
164
165impl ::std::fmt::Debug for GstPtpClockClass {
166 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
167 f.debug_struct(&format!("GstPtpClockClass @ {self:p}"))
168 .field("parent_class", &self.parent_class)
169 .finish()
170 }
171}
172
173#[repr(C)]
174#[allow(dead_code)]
175pub struct _GstPtpClockPrivate {
176 _data: [u8; 0],
177 _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
178}
179
180pub type GstPtpClockPrivate = _GstPtpClockPrivate;
181
182#[derive(Copy, Clone)]
184#[repr(C)]
185pub struct GstNetClientClock {
186 pub clock: gst::GstSystemClock,
187 pub priv_: *mut GstNetClientClockPrivate,
188 pub _gst_reserved: [gpointer; 4],
189}
190
191impl ::std::fmt::Debug for GstNetClientClock {
192 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
193 f.debug_struct(&format!("GstNetClientClock @ {self:p}"))
194 .field("clock", &self.clock)
195 .finish()
196 }
197}
198
199#[derive(Copy, Clone)]
200#[repr(C)]
201pub struct GstNetTimeProvider {
202 pub parent: gst::GstObject,
203 pub priv_: *mut GstNetTimeProviderPrivate,
204 pub _gst_reserved: [gpointer; 4],
205}
206
207impl ::std::fmt::Debug for GstNetTimeProvider {
208 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
209 f.debug_struct(&format!("GstNetTimeProvider @ {self:p}"))
210 .field("parent", &self.parent)
211 .finish()
212 }
213}
214
215#[derive(Copy, Clone)]
216#[repr(C)]
217pub struct GstNtpClock {
218 pub clock: gst::GstSystemClock,
219 pub priv_: *mut GstNetClientClockPrivate,
220 pub _gst_reserved: [gpointer; 4],
221}
222
223impl ::std::fmt::Debug for GstNtpClock {
224 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
225 f.debug_struct(&format!("GstNtpClock @ {self:p}"))
226 .field("clock", &self.clock)
227 .finish()
228 }
229}
230
231#[derive(Copy, Clone)]
232#[repr(C)]
233pub struct GstPtpClock {
234 pub clock: gst::GstSystemClock,
235 pub priv_: *mut GstPtpClockPrivate,
236 pub _gst_reserved: [gpointer; 4],
237}
238
239impl ::std::fmt::Debug for GstPtpClock {
240 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
241 f.debug_struct(&format!("GstPtpClock @ {self:p}"))
242 .field("clock", &self.clock)
243 .finish()
244 }
245}
246
247extern "C" {
248
249 pub fn gst_net_address_meta_get_info() -> *const gst::GstMetaInfo;
253
254 pub fn gst_net_control_message_meta_get_info() -> *const gst::GstMetaInfo;
258
259 pub fn gst_net_time_packet_get_type() -> GType;
263 pub fn gst_net_time_packet_new(buffer: *const [u8; 16]) -> *mut GstNetTimePacket;
264 pub fn gst_net_time_packet_copy(packet: *const GstNetTimePacket) -> *mut GstNetTimePacket;
265 pub fn gst_net_time_packet_free(packet: *mut GstNetTimePacket);
266 pub fn gst_net_time_packet_send(
267 packet: *const GstNetTimePacket,
268 socket: *mut gio::GSocket,
269 dest_address: *mut gio::GSocketAddress,
270 error: *mut *mut glib::GError,
271 ) -> gboolean;
272 pub fn gst_net_time_packet_serialize(packet: *const GstNetTimePacket) -> *mut [u8; 16];
273 pub fn gst_net_time_packet_receive(
274 socket: *mut gio::GSocket,
275 src_address: *mut *mut gio::GSocketAddress,
276 error: *mut *mut glib::GError,
277 ) -> *mut GstNetTimePacket;
278
279 pub fn gst_net_client_clock_get_type() -> GType;
283 pub fn gst_net_client_clock_new(
284 name: *const c_char,
285 remote_address: *const c_char,
286 remote_port: c_int,
287 base_time: gst::GstClockTime,
288 ) -> *mut gst::GstClock;
289
290 pub fn gst_net_time_provider_get_type() -> GType;
294 pub fn gst_net_time_provider_new(
295 clock: *mut gst::GstClock,
296 address: *const c_char,
297 port: c_int,
298 ) -> *mut GstNetTimeProvider;
299
300 pub fn gst_ntp_clock_get_type() -> GType;
304 pub fn gst_ntp_clock_new(
305 name: *const c_char,
306 remote_address: *const c_char,
307 remote_port: c_int,
308 base_time: gst::GstClockTime,
309 ) -> *mut gst::GstClock;
310
311 pub fn gst_ptp_clock_get_type() -> GType;
315 pub fn gst_ptp_clock_new(name: *const c_char, domain: c_uint) -> *mut gst::GstClock;
316
317 pub fn gst_buffer_add_net_address_meta(
321 buffer: *mut gst::GstBuffer,
322 addr: *mut gio::GSocketAddress,
323 ) -> *mut GstNetAddressMeta;
324 pub fn gst_buffer_add_net_control_message_meta(
325 buffer: *mut gst::GstBuffer,
326 message: *mut gio::GSocketControlMessage,
327 ) -> *mut GstNetControlMessageMeta;
328 pub fn gst_buffer_get_net_address_meta(buffer: *mut gst::GstBuffer) -> *mut GstNetAddressMeta;
329 pub fn gst_net_address_meta_api_get_type() -> GType;
330 pub fn gst_net_control_message_meta_api_get_type() -> GType;
331 #[cfg(feature = "v1_18")]
332 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
333 pub fn gst_net_utils_set_socket_tos(socket: *mut gio::GSocket, qos_dscp: c_int) -> gboolean;
334 pub fn gst_ptp_deinit();
335 pub fn gst_ptp_init(clock_id: u64, interfaces: *mut *mut c_char) -> gboolean;
336 #[cfg(feature = "v1_24")]
337 #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
338 pub fn gst_ptp_init_full(config: *const gst::GstStructure) -> gboolean;
339 pub fn gst_ptp_is_initialized() -> gboolean;
340 pub fn gst_ptp_is_supported() -> gboolean;
341 pub fn gst_ptp_statistics_callback_add(
342 callback: GstPtpStatisticsCallback,
343 user_data: gpointer,
344 destroy_data: glib::GDestroyNotify,
345 ) -> c_ulong;
346 pub fn gst_ptp_statistics_callback_remove(id: c_ulong);
347
348}