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 /// [`InterpolationControlSource`][crate::InterpolationControlSource] is a [`gst::ControlSource`][crate::gst::ControlSource], that interpolates values between user-given
16 /// control points. It supports several interpolation modes and property types.
17 ///
18 /// To use [`InterpolationControlSource`][crate::InterpolationControlSource] get a new instance by calling
19 /// [`new()`][Self::new()], bind it to a `GParamSpec` and set some
20 /// control points by calling [`TimedValueControlSourceExt::set()`][crate::prelude::TimedValueControlSourceExt::set()].
21 ///
22 /// All functions are MT-safe.
23 ///
24 /// ## Properties
25 ///
26 ///
27 /// #### `mode`
28 /// Readable | Writeable
29 /// <details><summary><h4>Object</h4></summary>
30 ///
31 ///
32 /// #### `name`
33 /// Readable | Writeable | Construct
34 ///
35 ///
36 /// #### `parent`
37 /// The parent of the object. Please note, that when changing the 'parent'
38 /// property, we don't emit `GObject::notify` and [`deep-notify`][struct@crate::gst::Object#deep-notify]
39 /// signals due to locking issues. In some cases one can use
40 /// `GstBin::element-added` or `GstBin::element-removed` signals on the parent to
41 /// achieve a similar effect.
42 ///
43 /// Readable | Writeable
44 /// </details>
45 ///
46 /// # Implements
47 ///
48 /// [`InterpolationControlSourceExt`][trait@crate::prelude::InterpolationControlSourceExt], [`TimedValueControlSourceExt`][trait@crate::prelude::TimedValueControlSourceExt], [`trait@gst::prelude::ControlSourceExt`], [`trait@gst::prelude::ObjectExt`]
49 #[doc(alias = "GstInterpolationControlSource")]
50 pub struct InterpolationControlSource(Object<ffi::GstInterpolationControlSource, ffi::GstInterpolationControlSourceClass>) @extends TimedValueControlSource, gst::ControlSource, gst::Object;
51
52 match fn {
53 type_ => || ffi::gst_interpolation_control_source_get_type(),
54 }
55}
56
57impl InterpolationControlSource {
58 pub const NONE: Option<&'static InterpolationControlSource> = None;
59
60 /// This returns a new, unbound [`InterpolationControlSource`][crate::InterpolationControlSource].
61 ///
62 /// # Returns
63 ///
64 /// a new, unbound [`InterpolationControlSource`][crate::InterpolationControlSource].
65 #[doc(alias = "gst_interpolation_control_source_new")]
66 pub fn new() -> InterpolationControlSource {
67 assert_initialized_main_thread!();
68 unsafe {
69 gst::ControlSource::from_glib_full(ffi::gst_interpolation_control_source_new())
70 .unsafe_cast()
71 }
72 }
73}
74
75impl Default for InterpolationControlSource {
76 fn default() -> Self {
77 Self::new()
78 }
79}
80
81unsafe impl Send for InterpolationControlSource {}
82unsafe impl Sync for InterpolationControlSource {}
83
84/// Trait containing all [`struct@InterpolationControlSource`] methods.
85///
86/// # Implementors
87///
88/// [`InterpolationControlSource`][struct@crate::InterpolationControlSource]
89pub trait InterpolationControlSourceExt: IsA<InterpolationControlSource> + 'static {
90 fn mode(&self) -> InterpolationMode {
91 ObjectExt::property(self.as_ref(), "mode")
92 }
93
94 fn set_mode(&self, mode: InterpolationMode) {
95 ObjectExt::set_property(self.as_ref(), "mode", mode)
96 }
97
98 #[doc(alias = "mode")]
99 fn connect_mode_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
100 unsafe extern "C" fn notify_mode_trampoline<
101 P: IsA<InterpolationControlSource>,
102 F: Fn(&P) + Send + Sync + 'static,
103 >(
104 this: *mut ffi::GstInterpolationControlSource,
105 _param_spec: glib::ffi::gpointer,
106 f: glib::ffi::gpointer,
107 ) {
108 let f: &F = &*(f as *const F);
109 f(InterpolationControlSource::from_glib_borrow(this).unsafe_cast_ref())
110 }
111 unsafe {
112 let f: Box_<F> = Box_::new(f);
113 connect_raw(
114 self.as_ptr() as *mut _,
115 c"notify::mode".as_ptr() as *const _,
116 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
117 notify_mode_trampoline::<Self, F> as *const (),
118 )),
119 Box_::into_raw(f),
120 )
121 }
122 }
123}
124
125impl<O: IsA<InterpolationControlSource>> InterpolationControlSourceExt for O {}