2018-04-23 17:34:22 +00:00
|
|
|
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
|
|
|
// from gir-files (https://github.com/gtk-rs/gir-files)
|
2021-04-01 13:58:41 +00:00
|
|
|
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
2017-12-16 12:48:29 +00:00
|
|
|
// DO NOT EDIT
|
|
|
|
|
2023-01-03 18:56:00 +00:00
|
|
|
use glib::{
|
|
|
|
prelude::*,
|
|
|
|
signal::{connect_raw, SignalHandlerId},
|
|
|
|
translate::*,
|
|
|
|
};
|
|
|
|
use std::{boxed::Box as Box_, mem::transmute};
|
2017-12-16 12:48:29 +00:00
|
|
|
|
2020-12-17 22:34:53 +00:00
|
|
|
glib::wrapper! {
|
2021-06-02 07:47:51 +00:00
|
|
|
#[doc(alias = "GstNetTimeProvider")]
|
2020-11-22 09:45:06 +00:00
|
|
|
pub struct NetTimeProvider(Object<ffi::GstNetTimeProvider, ffi::GstNetTimeProviderClass>) @extends gst::Object;
|
2017-12-16 12:48:29 +00:00
|
|
|
|
|
|
|
match fn {
|
2021-04-19 19:55:01 +00:00
|
|
|
type_ => || ffi::gst_net_time_provider_get_type(),
|
2017-12-16 12:48:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl NetTimeProvider {
|
2022-04-07 08:22:39 +00:00
|
|
|
#[doc(alias = "gst_net_time_provider_new")]
|
2022-10-18 15:16:11 +00:00
|
|
|
pub fn new(
|
|
|
|
clock: &impl IsA<gst::Clock>,
|
|
|
|
address: Option<&str>,
|
|
|
|
port: i32,
|
|
|
|
) -> Result<NetTimeProvider, glib::BoolError> {
|
2022-04-07 08:22:39 +00:00
|
|
|
assert_initialized_main_thread!();
|
|
|
|
unsafe {
|
2022-10-18 15:16:11 +00:00
|
|
|
Option::<_>::from_glib_full(ffi::gst_net_time_provider_new(
|
2022-04-07 08:22:39 +00:00
|
|
|
clock.as_ref().to_glib_none().0,
|
|
|
|
address.to_glib_none().0,
|
|
|
|
port,
|
|
|
|
))
|
2022-10-18 15:16:11 +00:00
|
|
|
.ok_or_else(|| glib::bool_error!("Failed to create NetTimeProvider"))
|
2022-04-07 08:22:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-11 19:38:18 +00:00
|
|
|
pub fn is_active(&self) -> bool {
|
2021-11-06 17:31:52 +00:00
|
|
|
glib::ObjectExt::property(self, "active")
|
2017-12-16 12:48:29 +00:00
|
|
|
}
|
|
|
|
|
2021-04-11 19:38:18 +00:00
|
|
|
pub fn set_active(&self, active: bool) {
|
2021-11-06 17:31:52 +00:00
|
|
|
glib::ObjectExt::set_property(self, "active", &active)
|
2017-12-16 12:48:29 +00:00
|
|
|
}
|
|
|
|
|
2021-04-11 19:38:18 +00:00
|
|
|
pub fn address(&self) -> Option<glib::GString> {
|
2021-11-06 17:31:52 +00:00
|
|
|
glib::ObjectExt::property(self, "address")
|
2017-12-16 12:48:29 +00:00
|
|
|
}
|
|
|
|
|
2021-04-11 19:38:18 +00:00
|
|
|
pub fn clock(&self) -> Option<gst::Clock> {
|
2021-11-06 17:31:52 +00:00
|
|
|
glib::ObjectExt::property(self, "clock")
|
2017-12-16 12:48:29 +00:00
|
|
|
}
|
|
|
|
|
2021-04-11 19:38:18 +00:00
|
|
|
pub fn port(&self) -> i32 {
|
2021-11-06 17:31:52 +00:00
|
|
|
glib::ObjectExt::property(self, "port")
|
2017-12-16 12:48:29 +00:00
|
|
|
}
|
|
|
|
|
2021-05-03 18:35:37 +00:00
|
|
|
#[doc(alias = "qos-dscp")]
|
2021-04-11 19:38:18 +00:00
|
|
|
pub fn qos_dscp(&self) -> i32 {
|
2021-11-06 17:31:52 +00:00
|
|
|
glib::ObjectExt::property(self, "qos-dscp")
|
2018-03-15 08:12:01 +00:00
|
|
|
}
|
|
|
|
|
2021-05-03 18:35:37 +00:00
|
|
|
#[doc(alias = "qos-dscp")]
|
2021-04-11 19:38:18 +00:00
|
|
|
pub fn set_qos_dscp(&self, qos_dscp: i32) {
|
2021-11-06 17:31:52 +00:00
|
|
|
glib::ObjectExt::set_property(self, "qos-dscp", &qos_dscp)
|
2018-03-15 08:12:01 +00:00
|
|
|
}
|
|
|
|
|
2021-05-03 18:35:37 +00:00
|
|
|
#[doc(alias = "active")]
|
2021-05-26 22:02:42 +00:00
|
|
|
pub fn connect_active_notify<F: Fn(&Self) + Send + Sync + 'static>(
|
2019-06-18 10:12:00 +00:00
|
|
|
&self,
|
|
|
|
f: F,
|
|
|
|
) -> SignalHandlerId {
|
|
|
|
unsafe extern "C" fn notify_active_trampoline<
|
|
|
|
F: Fn(&NetTimeProvider) + Send + Sync + 'static,
|
|
|
|
>(
|
2020-11-22 09:45:06 +00:00
|
|
|
this: *mut ffi::GstNetTimeProvider,
|
|
|
|
_param_spec: glib::ffi::gpointer,
|
|
|
|
f: glib::ffi::gpointer,
|
2019-06-18 10:12:00 +00:00
|
|
|
) {
|
2019-06-18 10:10:46 +00:00
|
|
|
let f: &F = &*(f as *const F);
|
|
|
|
f(&from_glib_borrow(this))
|
|
|
|
}
|
2017-12-16 12:48:29 +00:00
|
|
|
unsafe {
|
2019-01-29 13:53:44 +00:00
|
|
|
let f: Box_<F> = Box_::new(f);
|
2019-06-18 10:12:00 +00:00
|
|
|
connect_raw(
|
|
|
|
self.as_ptr() as *mut _,
|
|
|
|
b"notify::active\0".as_ptr() as *const _,
|
2020-04-13 16:11:33 +00:00
|
|
|
Some(transmute::<_, unsafe extern "C" fn()>(
|
|
|
|
notify_active_trampoline::<F> as *const (),
|
|
|
|
)),
|
2019-06-18 10:12:00 +00:00
|
|
|
Box_::into_raw(f),
|
|
|
|
)
|
2017-12-16 12:48:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-03 18:35:37 +00:00
|
|
|
#[doc(alias = "qos-dscp")]
|
2021-05-26 22:02:42 +00:00
|
|
|
pub fn connect_qos_dscp_notify<F: Fn(&Self) + Send + Sync + 'static>(
|
2019-06-18 10:12:00 +00:00
|
|
|
&self,
|
|
|
|
f: F,
|
|
|
|
) -> SignalHandlerId {
|
|
|
|
unsafe extern "C" fn notify_qos_dscp_trampoline<
|
|
|
|
F: Fn(&NetTimeProvider) + Send + Sync + 'static,
|
|
|
|
>(
|
2020-11-22 09:45:06 +00:00
|
|
|
this: *mut ffi::GstNetTimeProvider,
|
|
|
|
_param_spec: glib::ffi::gpointer,
|
|
|
|
f: glib::ffi::gpointer,
|
2019-06-18 10:12:00 +00:00
|
|
|
) {
|
2019-06-18 10:10:46 +00:00
|
|
|
let f: &F = &*(f as *const F);
|
|
|
|
f(&from_glib_borrow(this))
|
|
|
|
}
|
2018-03-15 08:12:01 +00:00
|
|
|
unsafe {
|
2019-01-29 13:53:44 +00:00
|
|
|
let f: Box_<F> = Box_::new(f);
|
2019-06-18 10:12:00 +00:00
|
|
|
connect_raw(
|
|
|
|
self.as_ptr() as *mut _,
|
|
|
|
b"notify::qos-dscp\0".as_ptr() as *const _,
|
2020-04-13 16:11:33 +00:00
|
|
|
Some(transmute::<_, unsafe extern "C" fn()>(
|
|
|
|
notify_qos_dscp_trampoline::<F> as *const (),
|
|
|
|
)),
|
2019-06-18 10:12:00 +00:00
|
|
|
Box_::into_raw(f),
|
|
|
|
)
|
2018-03-15 08:12:01 +00:00
|
|
|
}
|
|
|
|
}
|
2017-12-16 12:48:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
unsafe impl Send for NetTimeProvider {}
|
|
|
|
unsafe impl Sync for NetTimeProvider {}
|