gstreamer-rs/gstreamer-controller/src/auto/trigger_control_source.rs

93 lines
2.8 KiB
Rust
Raw Normal View History

2020-06-09 01:06:49 +00:00
// 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)
2020-06-09 01:06:49 +00:00
// DO NOT EDIT
2020-11-21 18:48:08 +00:00
use crate::TimedValueControlSource;
use glib::{
prelude::*,
signal::{connect_raw, SignalHandlerId},
translate::*,
};
use std::{boxed::Box as Box_, mem::transmute};
2020-06-09 01:06:49 +00:00
2020-12-17 22:34:53 +00:00
glib::wrapper! {
#[doc(alias = "GstTriggerControlSource")]
2020-11-21 18:48:08 +00:00
pub struct TriggerControlSource(Object<ffi::GstTriggerControlSource, ffi::GstTriggerControlSourceClass>) @extends TimedValueControlSource, gst::ControlSource, gst::Object;
2020-06-09 01:06:49 +00:00
match fn {
type_ => || ffi::gst_trigger_control_source_get_type(),
2020-06-09 01:06:49 +00:00
}
}
impl TriggerControlSource {
2021-11-16 14:02:58 +00:00
pub const NONE: Option<&'static TriggerControlSource> = None;
2020-12-08 13:00:17 +00:00
#[doc(alias = "gst_trigger_control_source_new")]
2020-06-09 01:06:49 +00:00
pub fn new() -> TriggerControlSource {
assert_initialized_main_thread!();
unsafe {
2020-11-21 18:48:08 +00:00
gst::ControlSource::from_glib_full(ffi::gst_trigger_control_source_new()).unsafe_cast()
2020-06-09 01:06:49 +00:00
}
}
}
impl Default for TriggerControlSource {
fn default() -> Self {
Self::new()
}
}
unsafe impl Send for TriggerControlSource {}
unsafe impl Sync for TriggerControlSource {}
pub trait TriggerControlSourceExt: 'static {
2021-04-11 19:38:18 +00:00
fn tolerance(&self) -> i64;
2020-06-09 01:06:49 +00:00
2021-04-11 19:38:18 +00:00
fn set_tolerance(&self, tolerance: i64);
2020-06-09 01:06:49 +00:00
#[doc(alias = "tolerance")]
fn connect_tolerance_notify<F: Fn(&Self) + Send + Sync + 'static>(
2020-06-09 01:06:49 +00:00
&self,
f: F,
) -> SignalHandlerId;
}
impl<O: IsA<TriggerControlSource>> TriggerControlSourceExt for O {
2021-04-11 19:38:18 +00:00
fn tolerance(&self) -> i64 {
2021-11-06 17:31:52 +00:00
glib::ObjectExt::property(self.as_ref(), "tolerance")
2020-06-09 01:06:49 +00:00
}
2021-04-11 19:38:18 +00:00
fn set_tolerance(&self, tolerance: i64) {
glib::ObjectExt::set_property(self.as_ref(), "tolerance", tolerance)
2020-06-09 01:06:49 +00:00
}
fn connect_tolerance_notify<F: Fn(&Self) + Send + Sync + 'static>(
2020-06-09 01:06:49 +00:00
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn notify_tolerance_trampoline<
P: IsA<TriggerControlSource>,
F: Fn(&P) + Send + Sync + 'static,
>(
2020-11-21 18:48:08 +00:00
this: *mut ffi::GstTriggerControlSource,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
2020-06-09 01:06:49 +00:00
let f: &F = &*(f as *const F);
2021-06-21 21:07:45 +00:00
f(TriggerControlSource::from_glib_borrow(this).unsafe_cast_ref())
2020-06-09 01:06:49 +00:00
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::tolerance\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
notify_tolerance_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
}