forked from mirrors/gstreamer-rs
137 lines
4.3 KiB
Rust
137 lines
4.3 KiB
Rust
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
|
// from gir-files (https://github.com/gtk-rs/gir-files)
|
|
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
|
// DO NOT EDIT
|
|
|
|
use glib::{
|
|
prelude::*,
|
|
signal::{connect_raw, SignalHandlerId},
|
|
translate::*,
|
|
};
|
|
use std::{boxed::Box as Box_, mem::transmute};
|
|
|
|
glib::wrapper! {
|
|
#[doc(alias = "GstPtpClock")]
|
|
pub struct PtpClock(Object<ffi::GstPtpClock, ffi::GstPtpClockClass>) @extends gst::Clock, gst::Object;
|
|
|
|
match fn {
|
|
type_ => || ffi::gst_ptp_clock_get_type(),
|
|
}
|
|
}
|
|
|
|
impl PtpClock {
|
|
#[doc(alias = "gst_ptp_clock_new")]
|
|
pub fn new(name: &str, domain: u32) -> PtpClock {
|
|
assert_initialized_main_thread!();
|
|
unsafe {
|
|
gst::Clock::from_glib_full(ffi::gst_ptp_clock_new(name.to_glib_none().0, domain))
|
|
.unsafe_cast()
|
|
}
|
|
}
|
|
|
|
pub fn domain(&self) -> u32 {
|
|
ObjectExt::property(self, "domain")
|
|
}
|
|
|
|
#[doc(alias = "grandmaster-clock-id")]
|
|
pub fn grandmaster_clock_id(&self) -> u64 {
|
|
ObjectExt::property(self, "grandmaster-clock-id")
|
|
}
|
|
|
|
#[doc(alias = "internal-clock")]
|
|
pub fn internal_clock(&self) -> Option<gst::Clock> {
|
|
ObjectExt::property(self, "internal-clock")
|
|
}
|
|
|
|
#[doc(alias = "master-clock-id")]
|
|
pub fn master_clock_id(&self) -> u64 {
|
|
ObjectExt::property(self, "master-clock-id")
|
|
}
|
|
|
|
#[doc(alias = "grandmaster-clock-id")]
|
|
pub fn connect_grandmaster_clock_id_notify<F: Fn(&Self) + Send + Sync + 'static>(
|
|
&self,
|
|
f: F,
|
|
) -> SignalHandlerId {
|
|
unsafe extern "C" fn notify_grandmaster_clock_id_trampoline<
|
|
F: Fn(&PtpClock) + Send + Sync + 'static,
|
|
>(
|
|
this: *mut ffi::GstPtpClock,
|
|
_param_spec: glib::ffi::gpointer,
|
|
f: glib::ffi::gpointer,
|
|
) {
|
|
let f: &F = &*(f as *const F);
|
|
f(&from_glib_borrow(this))
|
|
}
|
|
unsafe {
|
|
let f: Box_<F> = Box_::new(f);
|
|
connect_raw(
|
|
self.as_ptr() as *mut _,
|
|
b"notify::grandmaster-clock-id\0".as_ptr() as *const _,
|
|
Some(transmute::<_, unsafe extern "C" fn()>(
|
|
notify_grandmaster_clock_id_trampoline::<F> as *const (),
|
|
)),
|
|
Box_::into_raw(f),
|
|
)
|
|
}
|
|
}
|
|
|
|
#[doc(alias = "internal-clock")]
|
|
pub fn connect_internal_clock_notify<F: Fn(&Self) + Send + Sync + 'static>(
|
|
&self,
|
|
f: F,
|
|
) -> SignalHandlerId {
|
|
unsafe extern "C" fn notify_internal_clock_trampoline<
|
|
F: Fn(&PtpClock) + Send + Sync + 'static,
|
|
>(
|
|
this: *mut ffi::GstPtpClock,
|
|
_param_spec: glib::ffi::gpointer,
|
|
f: glib::ffi::gpointer,
|
|
) {
|
|
let f: &F = &*(f as *const F);
|
|
f(&from_glib_borrow(this))
|
|
}
|
|
unsafe {
|
|
let f: Box_<F> = Box_::new(f);
|
|
connect_raw(
|
|
self.as_ptr() as *mut _,
|
|
b"notify::internal-clock\0".as_ptr() as *const _,
|
|
Some(transmute::<_, unsafe extern "C" fn()>(
|
|
notify_internal_clock_trampoline::<F> as *const (),
|
|
)),
|
|
Box_::into_raw(f),
|
|
)
|
|
}
|
|
}
|
|
|
|
#[doc(alias = "master-clock-id")]
|
|
pub fn connect_master_clock_id_notify<F: Fn(&Self) + Send + Sync + 'static>(
|
|
&self,
|
|
f: F,
|
|
) -> SignalHandlerId {
|
|
unsafe extern "C" fn notify_master_clock_id_trampoline<
|
|
F: Fn(&PtpClock) + Send + Sync + 'static,
|
|
>(
|
|
this: *mut ffi::GstPtpClock,
|
|
_param_spec: glib::ffi::gpointer,
|
|
f: glib::ffi::gpointer,
|
|
) {
|
|
let f: &F = &*(f as *const F);
|
|
f(&from_glib_borrow(this))
|
|
}
|
|
unsafe {
|
|
let f: Box_<F> = Box_::new(f);
|
|
connect_raw(
|
|
self.as_ptr() as *mut _,
|
|
b"notify::master-clock-id\0".as_ptr() as *const _,
|
|
Some(transmute::<_, unsafe extern "C" fn()>(
|
|
notify_master_clock_id_trampoline::<F> as *const (),
|
|
)),
|
|
Box_::into_raw(f),
|
|
)
|
|
}
|
|
}
|
|
}
|
|
|
|
unsafe impl Send for PtpClock {}
|
|
unsafe impl Sync for PtpClock {}
|