lib.rs 11.4 KB
Newer Older
Sebastian Dröge's avatar
Sebastian Dröge committed
1 2
// This file was generated by gir (https://github.com/gtk-rs/gir @ d1e88f9)
// from gir-files (https://github.com/gtk-rs/gir-files @ 63dd366)
3 4
// DO NOT EDIT

5
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]
6 7 8 9 10
#![allow(
    clippy::approx_constant,
    clippy::type_complexity,
    clippy::unreadable_literal
)]
11

12
extern crate gio_sys as gio;
13 14 15
extern crate glib_sys as glib;
extern crate gobject_sys as gobject;
extern crate gstreamer_sys as gst;
16
extern crate libc;
17 18

#[allow(unused_imports)]
19 20 21 22
use libc::{
    c_char, c_double, c_float, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort, c_void,
    intptr_t, size_t, ssize_t, time_t, uintptr_t, FILE,
};
23 24

#[allow(unused_imports)]
25
use glib::{gboolean, gconstpointer, gpointer, GType};
26 27 28 29

// Constants
pub const GST_NET_TIME_PACKET_SIZE: c_int = 16;
pub const GST_PTP_CLOCK_ID_NONE: u64 = 18446744073709551615;
30 31 32 33 34 35 36 37
pub const GST_PTP_STATISTICS_BEST_MASTER_CLOCK_SELECTED: *const c_char =
    b"GstPtpStatisticsBestMasterClockSelected\0" as *const u8 as *const c_char;
pub const GST_PTP_STATISTICS_NEW_DOMAIN_FOUND: *const c_char =
    b"GstPtpStatisticsNewDomainFound\0" as *const u8 as *const c_char;
pub const GST_PTP_STATISTICS_PATH_DELAY_MEASURED: *const c_char =
    b"GstPtpStatisticsPathDelayMeasured\0" as *const u8 as *const c_char;
pub const GST_PTP_STATISTICS_TIME_UPDATED: *const c_char =
    b"GstPtpStatisticsTimeUpdated\0" as *const u8 as *const c_char;
38 39

// Callbacks
40 41
pub type GstPtpStatisticsCallback =
    Option<unsafe extern "C" fn(u8, *const gst::GstStructure, gpointer) -> gboolean>;
42 43 44

// Records
#[repr(C)]
45
#[derive(Copy, Clone)]
46 47 48 49 50 51 52
pub struct GstNetAddressMeta {
    pub meta: gst::GstMeta,
    pub addr: *mut gio::GSocketAddress,
}

impl ::std::fmt::Debug for GstNetAddressMeta {
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
53
        f.debug_struct(&format!("GstNetAddressMeta @ {:?}", self as *const _))
54 55 56
            .field("meta", &self.meta)
            .field("addr", &self.addr)
            .finish()
57 58 59 60
    }
}

#[repr(C)]
61
#[derive(Copy, Clone)]
62 63 64 65 66 67 68
pub struct GstNetClientClockClass {
    pub parent_class: gst::GstSystemClockClass,
    pub _gst_reserved: [gpointer; 4],
}

impl ::std::fmt::Debug for GstNetClientClockClass {
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
69
        f.debug_struct(&format!("GstNetClientClockClass @ {:?}", self as *const _))
70 71
            .field("parent_class", &self.parent_class)
            .finish()
72 73 74 75
    }
}

#[repr(C)]
76
pub struct _GstNetClientClockPrivate(c_void);
77

78
pub type GstNetClientClockPrivate = *mut _GstNetClientClockPrivate;
79 80

#[repr(C)]
81
#[derive(Copy, Clone)]
82 83 84 85 86 87 88
pub struct GstNetControlMessageMeta {
    pub meta: gst::GstMeta,
    pub message: *mut gio::GSocketControlMessage,
}

impl ::std::fmt::Debug for GstNetControlMessageMeta {
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
89 90 91 92 93 94 95
        f.debug_struct(&format!(
            "GstNetControlMessageMeta @ {:?}",
            self as *const _
        ))
        .field("meta", &self.meta)
        .field("message", &self.message)
        .finish()
96 97 98 99
    }
}

#[repr(C)]
100
#[derive(Copy, Clone)]
101 102 103 104 105 106 107
pub struct GstNetTimePacket {
    pub local_time: gst::GstClockTime,
    pub remote_time: gst::GstClockTime,
}

impl ::std::fmt::Debug for GstNetTimePacket {
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
108
        f.debug_struct(&format!("GstNetTimePacket @ {:?}", self as *const _))
109 110 111
            .field("local_time", &self.local_time)
            .field("remote_time", &self.remote_time)
            .finish()
112 113 114 115
    }
}

#[repr(C)]
116
#[derive(Copy, Clone)]
117 118 119 120 121 122 123
pub struct GstNetTimeProviderClass {
    pub parent_class: gst::GstObjectClass,
    pub _gst_reserved: [gpointer; 4],
}

impl ::std::fmt::Debug for GstNetTimeProviderClass {
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
124
        f.debug_struct(&format!("GstNetTimeProviderClass @ {:?}", self as *const _))
125 126 127
            .field("parent_class", &self.parent_class)
            .field("_gst_reserved", &self._gst_reserved)
            .finish()
128 129 130 131
    }
}

#[repr(C)]
132
pub struct _GstNetTimeProviderPrivate(c_void);
133

134
pub type GstNetTimeProviderPrivate = *mut _GstNetTimeProviderPrivate;
135 136

#[repr(C)]
137
#[derive(Copy, Clone)]
138 139 140 141 142 143 144
pub struct GstNtpClockClass {
    pub parent_class: gst::GstSystemClockClass,
    pub _gst_reserved: [gpointer; 4],
}

impl ::std::fmt::Debug for GstNtpClockClass {
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
145
        f.debug_struct(&format!("GstNtpClockClass @ {:?}", self as *const _))
146 147
            .field("parent_class", &self.parent_class)
            .finish()
148 149 150 151
    }
}

#[repr(C)]
152
#[derive(Copy, Clone)]
153 154 155 156 157 158 159
pub struct GstPtpClockClass {
    pub parent_class: gst::GstSystemClockClass,
    pub _gst_reserved: [gpointer; 4],
}

impl ::std::fmt::Debug for GstPtpClockClass {
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
160
        f.debug_struct(&format!("GstPtpClockClass @ {:?}", self as *const _))
161 162
            .field("parent_class", &self.parent_class)
            .finish()
163 164 165 166
    }
}

#[repr(C)]
167
pub struct _GstPtpClockPrivate(c_void);
168

169
pub type GstPtpClockPrivate = *mut _GstPtpClockPrivate;
170 171 172

// Classes
#[repr(C)]
173
#[derive(Copy, Clone)]
174 175 176 177 178 179 180 181 182
pub struct GstNetClientClock {
    pub clock: gst::GstSystemClock,
    pub priv_: *mut GstNetClientClockPrivate,
    pub _gst_reserved: [gpointer; 4],
}

impl ::std::fmt::Debug for GstNetClientClock {
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        f.debug_struct(&format!("GstNetClientClock @ {:?}", self as *const _))
183 184
            .field("clock", &self.clock)
            .finish()
185 186 187 188
    }
}

#[repr(C)]
189
#[derive(Copy, Clone)]
190 191 192 193 194 195 196 197 198
pub struct GstNetTimeProvider {
    pub parent: gst::GstObject,
    pub priv_: *mut GstNetTimeProviderPrivate,
    pub _gst_reserved: [gpointer; 4],
}

impl ::std::fmt::Debug for GstNetTimeProvider {
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        f.debug_struct(&format!("GstNetTimeProvider @ {:?}", self as *const _))
199 200
            .field("parent", &self.parent)
            .finish()
201 202 203 204
    }
}

#[repr(C)]
205
#[derive(Copy, Clone)]
206 207 208 209 210 211 212 213 214
pub struct GstNtpClock {
    pub clock: gst::GstSystemClock,
    pub priv_: *mut GstNetClientClockPrivate,
    pub _gst_reserved: [gpointer; 4],
}

impl ::std::fmt::Debug for GstNtpClock {
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        f.debug_struct(&format!("GstNtpClock @ {:?}", self as *const _))
215 216
            .field("clock", &self.clock)
            .finish()
217 218 219 220
    }
}

#[repr(C)]
221
#[derive(Copy, Clone)]
222 223 224 225 226 227 228 229 230
pub struct GstPtpClock {
    pub clock: gst::GstSystemClock,
    pub priv_: *mut GstPtpClockPrivate,
    pub _gst_reserved: [gpointer; 4],
}

impl ::std::fmt::Debug for GstPtpClock {
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        f.debug_struct(&format!("GstPtpClock @ {:?}", self as *const _))
231 232
            .field("clock", &self.clock)
            .finish()
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251
    }
}

extern "C" {

    //=========================================================================
    // GstNetAddressMeta
    //=========================================================================
    pub fn gst_net_address_meta_get_info() -> *const gst::GstMetaInfo;

    //=========================================================================
    // GstNetControlMessageMeta
    //=========================================================================
    pub fn gst_net_control_message_meta_get_info() -> *const gst::GstMetaInfo;

    //=========================================================================
    // GstNetTimePacket
    //=========================================================================
    pub fn gst_net_time_packet_get_type() -> GType;
252
    pub fn gst_net_time_packet_new(buffer: *const u8) -> *mut GstNetTimePacket;
253 254
    pub fn gst_net_time_packet_copy(packet: *const GstNetTimePacket) -> *mut GstNetTimePacket;
    pub fn gst_net_time_packet_free(packet: *mut GstNetTimePacket);
255 256 257 258 259 260
    pub fn gst_net_time_packet_send(
        packet: *const GstNetTimePacket,
        socket: *mut gio::GSocket,
        dest_address: *mut gio::GSocketAddress,
        error: *mut *mut glib::GError,
    ) -> gboolean;
261
    pub fn gst_net_time_packet_serialize(packet: *const GstNetTimePacket) -> *mut u8;
262 263 264 265 266
    pub fn gst_net_time_packet_receive(
        socket: *mut gio::GSocket,
        src_address: *mut *mut gio::GSocketAddress,
        error: *mut *mut glib::GError,
    ) -> *mut GstNetTimePacket;
267 268 269 270 271

    //=========================================================================
    // GstNetClientClock
    //=========================================================================
    pub fn gst_net_client_clock_get_type() -> GType;
272 273 274 275 276 277
    pub fn gst_net_client_clock_new(
        name: *const c_char,
        remote_address: *const c_char,
        remote_port: c_int,
        base_time: gst::GstClockTime,
    ) -> *mut gst::GstClock;
278 279 280 281 282

    //=========================================================================
    // GstNetTimeProvider
    //=========================================================================
    pub fn gst_net_time_provider_get_type() -> GType;
283 284 285 286 287
    pub fn gst_net_time_provider_new(
        clock: *mut gst::GstClock,
        address: *const c_char,
        port: c_int,
    ) -> *mut GstNetTimeProvider;
288 289 290 291 292 293

    //=========================================================================
    // GstNtpClock
    //=========================================================================
    pub fn gst_ntp_clock_get_type() -> GType;
    #[cfg(any(feature = "v1_6", feature = "dox"))]
294 295 296 297 298 299
    pub fn gst_ntp_clock_new(
        name: *const c_char,
        remote_address: *const c_char,
        remote_port: c_int,
        base_time: gst::GstClockTime,
    ) -> *mut gst::GstClock;
300 301 302 303 304 305 306 307 308 309 310

    //=========================================================================
    // GstPtpClock
    //=========================================================================
    pub fn gst_ptp_clock_get_type() -> GType;
    #[cfg(any(feature = "v1_6", feature = "dox"))]
    pub fn gst_ptp_clock_new(name: *const c_char, domain: c_uint) -> *mut gst::GstClock;

    //=========================================================================
    // Other functions
    //=========================================================================
311 312 313 314 315 316 317 318
    pub fn gst_buffer_add_net_address_meta(
        buffer: *mut gst::GstBuffer,
        addr: *mut gio::GSocketAddress,
    ) -> *mut GstNetAddressMeta;
    pub fn gst_buffer_add_net_control_message_meta(
        buffer: *mut gst::GstBuffer,
        message: *mut gio::GSocketControlMessage,
    ) -> *mut GstNetControlMessageMeta;
319 320 321 322 323 324 325 326 327 328 329 330
    pub fn gst_buffer_get_net_address_meta(buffer: *mut gst::GstBuffer) -> *mut GstNetAddressMeta;
    pub fn gst_net_address_meta_api_get_type() -> GType;
    pub fn gst_net_control_message_meta_api_get_type() -> GType;
    #[cfg(any(feature = "v1_6", feature = "dox"))]
    pub fn gst_ptp_deinit();
    #[cfg(any(feature = "v1_6", feature = "dox"))]
    pub fn gst_ptp_init(clock_id: u64, interfaces: *mut *mut c_char) -> gboolean;
    #[cfg(any(feature = "v1_6", feature = "dox"))]
    pub fn gst_ptp_is_initialized() -> gboolean;
    #[cfg(any(feature = "v1_6", feature = "dox"))]
    pub fn gst_ptp_is_supported() -> gboolean;
    #[cfg(any(feature = "v1_6", feature = "dox"))]
331 332 333 334 335
    pub fn gst_ptp_statistics_callback_add(
        callback: GstPtpStatisticsCallback,
        user_data: gpointer,
        destroy_data: glib::GDestroyNotify,
    ) -> c_ulong;
336 337 338 339
    #[cfg(any(feature = "v1_6", feature = "dox"))]
    pub fn gst_ptp_statistics_callback_remove(id: c_ulong);

}