gstreamer_controller/auto/
interpolation_control_source.rs1use crate::{InterpolationMode, TimedValueControlSource, ffi};
7use glib::{
8 prelude::*,
9 signal::{SignalHandlerId, connect_raw},
10 translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15 #[doc(alias = "GstInterpolationControlSource")]
16 pub struct InterpolationControlSource(Object<ffi::GstInterpolationControlSource, ffi::GstInterpolationControlSourceClass>) @extends TimedValueControlSource, gst::ControlSource, gst::Object;
17
18 match fn {
19 type_ => || ffi::gst_interpolation_control_source_get_type(),
20 }
21}
22
23impl InterpolationControlSource {
24 pub const NONE: Option<&'static InterpolationControlSource> = None;
25
26 #[doc(alias = "gst_interpolation_control_source_new")]
27 pub fn new() -> InterpolationControlSource {
28 assert_initialized_main_thread!();
29 unsafe {
30 gst::ControlSource::from_glib_full(ffi::gst_interpolation_control_source_new())
31 .unsafe_cast()
32 }
33 }
34}
35
36impl Default for InterpolationControlSource {
37 fn default() -> Self {
38 Self::new()
39 }
40}
41
42unsafe impl Send for InterpolationControlSource {}
43unsafe impl Sync for InterpolationControlSource {}
44
45pub trait InterpolationControlSourceExt: IsA<InterpolationControlSource> + 'static {
46 fn mode(&self) -> InterpolationMode {
47 ObjectExt::property(self.as_ref(), "mode")
48 }
49
50 fn set_mode(&self, mode: InterpolationMode) {
51 ObjectExt::set_property(self.as_ref(), "mode", mode)
52 }
53
54 #[doc(alias = "mode")]
55 fn connect_mode_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
56 unsafe extern "C" fn notify_mode_trampoline<
57 P: IsA<InterpolationControlSource>,
58 F: Fn(&P) + Send + Sync + 'static,
59 >(
60 this: *mut ffi::GstInterpolationControlSource,
61 _param_spec: glib::ffi::gpointer,
62 f: glib::ffi::gpointer,
63 ) {
64 unsafe {
65 let f: &F = &*(f as *const F);
66 f(InterpolationControlSource::from_glib_borrow(this).unsafe_cast_ref())
67 }
68 }
69 unsafe {
70 let f: Box_<F> = Box_::new(f);
71 connect_raw(
72 self.as_ptr() as *mut _,
73 c"notify::mode".as_ptr(),
74 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
75 notify_mode_trampoline::<Self, F> as *const (),
76 )),
77 Box_::into_raw(f),
78 )
79 }
80 }
81}
82
83impl<O: IsA<InterpolationControlSource>> InterpolationControlSourceExt for O {}