gstreamer_controller/auto/
interpolation_control_source.rs1use crate::{ffi, InterpolationMode, TimedValueControlSource};
7use glib::{
8 prelude::*,
9 signal::{connect_raw, SignalHandlerId},
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
45mod sealed {
46 pub trait Sealed {}
47 impl<T: super::IsA<super::InterpolationControlSource>> Sealed for T {}
48}
49
50pub trait InterpolationControlSourceExt:
51 IsA<InterpolationControlSource> + sealed::Sealed + 'static
52{
53 fn mode(&self) -> InterpolationMode {
54 ObjectExt::property(self.as_ref(), "mode")
55 }
56
57 fn set_mode(&self, mode: InterpolationMode) {
58 ObjectExt::set_property(self.as_ref(), "mode", mode)
59 }
60
61 #[doc(alias = "mode")]
62 fn connect_mode_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
63 unsafe extern "C" fn notify_mode_trampoline<
64 P: IsA<InterpolationControlSource>,
65 F: Fn(&P) + Send + Sync + 'static,
66 >(
67 this: *mut ffi::GstInterpolationControlSource,
68 _param_spec: glib::ffi::gpointer,
69 f: glib::ffi::gpointer,
70 ) {
71 let f: &F = &*(f as *const F);
72 f(InterpolationControlSource::from_glib_borrow(this).unsafe_cast_ref())
73 }
74 unsafe {
75 let f: Box_<F> = Box_::new(f);
76 connect_raw(
77 self.as_ptr() as *mut _,
78 b"notify::mode\0".as_ptr() as *const _,
79 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
80 notify_mode_trampoline::<Self, F> as *const (),
81 )),
82 Box_::into_raw(f),
83 )
84 }
85 }
86}
87
88impl<O: IsA<InterpolationControlSource>> InterpolationControlSourceExt for O {}