gstreamer_controller/auto/
interpolation_control_source.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
4// DO NOT EDIT
5
6use 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
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            let f: &F = &*(f as *const F);
65            f(InterpolationControlSource::from_glib_borrow(this).unsafe_cast_ref())
66        }
67        unsafe {
68            let f: Box_<F> = Box_::new(f);
69            connect_raw(
70                self.as_ptr() as *mut _,
71                c"notify::mode".as_ptr() as *const _,
72                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
73                    notify_mode_trampoline::<Self, F> as *const (),
74                )),
75                Box_::into_raw(f),
76            )
77        }
78    }
79}
80
81impl<O: IsA<InterpolationControlSource>> InterpolationControlSourceExt for O {}