gstreamer_controller/auto/timed_value_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, ControlPoint};
7use glib::{
8 object::ObjectType as _,
9 prelude::*,
10 signal::{connect_raw, SignalHandlerId},
11 translate::*,
12};
13use std::boxed::Box as Box_;
14
15glib::wrapper! {
16 /// Base class for [`gst::ControlSource`][crate::gst::ControlSource] that use time-stamped values.
17 ///
18 /// When overriding bind, chain up first to give this bind implementation a
19 /// chance to setup things.
20 ///
21 /// All functions are MT-safe.
22 ///
23 /// This is an Abstract Base Class, you cannot instantiate it.
24 ///
25 /// ## Signals
26 ///
27 ///
28 /// #### `value-added`
29 /// Emitted right after the new value has been added to `self_`
30 ///
31 ///
32 ///
33 ///
34 /// #### `value-changed`
35 /// Emitted right after the new value has been set on `timed_signals`
36 ///
37 ///
38 ///
39 ///
40 /// #### `value-removed`
41 /// Emitted when `timed_value` is removed from `self_`
42 ///
43 ///
44 /// <details><summary><h4>Object</h4></summary>
45 ///
46 ///
47 /// #### `deep-notify`
48 /// The deep notify signal is used to be notified of property changes. It is
49 /// typically attached to the toplevel bin to receive notifications from all
50 /// the elements contained in that bin.
51 ///
52 /// Detailed
53 /// </details>
54 ///
55 /// # Implements
56 ///
57 /// [`TimedValueControlSourceExt`][trait@crate::prelude::TimedValueControlSourceExt], [`trait@gst::prelude::ControlSourceExt`], [`trait@gst::prelude::ObjectExt`]
58 #[doc(alias = "GstTimedValueControlSource")]
59 pub struct TimedValueControlSource(Object<ffi::GstTimedValueControlSource, ffi::GstTimedValueControlSourceClass>) @extends gst::ControlSource, gst::Object;
60
61 match fn {
62 type_ => || ffi::gst_timed_value_control_source_get_type(),
63 }
64}
65
66impl TimedValueControlSource {
67 pub const NONE: Option<&'static TimedValueControlSource> = None;
68}
69
70unsafe impl Send for TimedValueControlSource {}
71unsafe impl Sync for TimedValueControlSource {}
72
73mod sealed {
74 pub trait Sealed {}
75 impl<T: super::IsA<super::TimedValueControlSource>> Sealed for T {}
76}
77
78/// Trait containing all [`struct@TimedValueControlSource`] methods.
79///
80/// # Implementors
81///
82/// [`InterpolationControlSource`][struct@crate::InterpolationControlSource], [`TimedValueControlSource`][struct@crate::TimedValueControlSource], [`TriggerControlSource`][struct@crate::TriggerControlSource]
83pub trait TimedValueControlSourceExt:
84 IsA<TimedValueControlSource> + sealed::Sealed + 'static
85{
86 //#[doc(alias = "gst_timed_value_control_source_find_control_point_iter")]
87 //fn find_control_point_iter(&self, timestamp: impl Into<Option<gst::ClockTime>>) -> /*Ignored*/Option<glib::SequenceIter> {
88 // unsafe { TODO: call ffi:gst_timed_value_control_source_find_control_point_iter() }
89 //}
90
91 //#[doc(alias = "gst_timed_value_control_source_get_all")]
92 //#[doc(alias = "get_all")]
93 //fn all(&self) -> /*Ignored*/Vec<gst::TimedValue> {
94 // unsafe { TODO: call ffi:gst_timed_value_control_source_get_all() }
95 //}
96
97 /// Get the number of control points that are set.
98 ///
99 /// # Returns
100 ///
101 /// the number of control points that are set.
102 #[doc(alias = "gst_timed_value_control_source_get_count")]
103 #[doc(alias = "get_count")]
104 fn count(&self) -> i32 {
105 unsafe { ffi::gst_timed_value_control_source_get_count(self.as_ref().to_glib_none().0) }
106 }
107
108 /// Set the value of given controller-handled property at a certain time.
109 /// ## `timestamp`
110 /// the time the control-change is scheduled for
111 /// ## `value`
112 /// the control-value
113 ///
114 /// # Returns
115 ///
116 /// FALSE if the values couldn't be set, TRUE otherwise.
117 #[doc(alias = "gst_timed_value_control_source_set")]
118 fn set(&self, timestamp: gst::ClockTime, value: f64) -> bool {
119 unsafe {
120 from_glib(ffi::gst_timed_value_control_source_set(
121 self.as_ref().to_glib_none().0,
122 timestamp.into_glib(),
123 value,
124 ))
125 }
126 }
127
128 //#[doc(alias = "gst_timed_value_control_source_set_from_list")]
129 //fn set_from_list(&self, timedvalues: /*Ignored*/&[gst::TimedValue]) -> bool {
130 // unsafe { TODO: call ffi:gst_timed_value_control_source_set_from_list() }
131 //}
132
133 /// Used to remove the value of given controller-handled property at a certain
134 /// time.
135 /// ## `timestamp`
136 /// the time the control-change should be removed from
137 ///
138 /// # Returns
139 ///
140 /// FALSE if the value couldn't be unset (i.e. not found, TRUE otherwise.
141 #[doc(alias = "gst_timed_value_control_source_unset")]
142 fn unset(&self, timestamp: gst::ClockTime) -> bool {
143 unsafe {
144 from_glib(ffi::gst_timed_value_control_source_unset(
145 self.as_ref().to_glib_none().0,
146 timestamp.into_glib(),
147 ))
148 }
149 }
150
151 /// Used to remove all time-stamped values of given controller-handled property
152 #[doc(alias = "gst_timed_value_control_source_unset_all")]
153 fn unset_all(&self) {
154 unsafe {
155 ffi::gst_timed_value_control_source_unset_all(self.as_ref().to_glib_none().0);
156 }
157 }
158
159 /// Emitted right after the new value has been added to `self_`
160 /// ## `timed_value`
161 /// The newly added `GstTimedValue`
162 #[doc(alias = "value-added")]
163 fn connect_value_added<F: Fn(&Self, &ControlPoint) + Send + Sync + 'static>(
164 &self,
165 f: F,
166 ) -> SignalHandlerId {
167 unsafe extern "C" fn value_added_trampoline<
168 P: IsA<TimedValueControlSource>,
169 F: Fn(&P, &ControlPoint) + Send + Sync + 'static,
170 >(
171 this: *mut ffi::GstTimedValueControlSource,
172 timed_value: *mut ffi::GstControlPoint,
173 f: glib::ffi::gpointer,
174 ) {
175 let f: &F = &*(f as *const F);
176 f(
177 TimedValueControlSource::from_glib_borrow(this).unsafe_cast_ref(),
178 &from_glib_borrow(timed_value),
179 )
180 }
181 unsafe {
182 let f: Box_<F> = Box_::new(f);
183 connect_raw(
184 self.as_ptr() as *mut _,
185 b"value-added\0".as_ptr() as *const _,
186 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
187 value_added_trampoline::<Self, F> as *const (),
188 )),
189 Box_::into_raw(f),
190 )
191 }
192 }
193
194 /// Emitted right after the new value has been set on `timed_signals`
195 /// ## `timed_value`
196 /// The `GstTimedValue` where the value changed
197 #[doc(alias = "value-changed")]
198 fn connect_value_changed<F: Fn(&Self, &ControlPoint) + Send + Sync + 'static>(
199 &self,
200 f: F,
201 ) -> SignalHandlerId {
202 unsafe extern "C" fn value_changed_trampoline<
203 P: IsA<TimedValueControlSource>,
204 F: Fn(&P, &ControlPoint) + Send + Sync + 'static,
205 >(
206 this: *mut ffi::GstTimedValueControlSource,
207 timed_value: *mut ffi::GstControlPoint,
208 f: glib::ffi::gpointer,
209 ) {
210 let f: &F = &*(f as *const F);
211 f(
212 TimedValueControlSource::from_glib_borrow(this).unsafe_cast_ref(),
213 &from_glib_borrow(timed_value),
214 )
215 }
216 unsafe {
217 let f: Box_<F> = Box_::new(f);
218 connect_raw(
219 self.as_ptr() as *mut _,
220 b"value-changed\0".as_ptr() as *const _,
221 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
222 value_changed_trampoline::<Self, F> as *const (),
223 )),
224 Box_::into_raw(f),
225 )
226 }
227 }
228
229 /// Emitted when `timed_value` is removed from `self_`
230 /// ## `timed_value`
231 /// The removed `GstTimedValue`
232 #[doc(alias = "value-removed")]
233 fn connect_value_removed<F: Fn(&Self, &ControlPoint) + Send + Sync + 'static>(
234 &self,
235 f: F,
236 ) -> SignalHandlerId {
237 unsafe extern "C" fn value_removed_trampoline<
238 P: IsA<TimedValueControlSource>,
239 F: Fn(&P, &ControlPoint) + Send + Sync + 'static,
240 >(
241 this: *mut ffi::GstTimedValueControlSource,
242 timed_value: *mut ffi::GstControlPoint,
243 f: glib::ffi::gpointer,
244 ) {
245 let f: &F = &*(f as *const F);
246 f(
247 TimedValueControlSource::from_glib_borrow(this).unsafe_cast_ref(),
248 &from_glib_borrow(timed_value),
249 )
250 }
251 unsafe {
252 let f: Box_<F> = Box_::new(f);
253 connect_raw(
254 self.as_ptr() as *mut _,
255 b"value-removed\0".as_ptr() as *const _,
256 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
257 value_removed_trampoline::<Self, F> as *const (),
258 )),
259 Box_::into_raw(f),
260 )
261 }
262 }
263}
264
265impl<O: IsA<TimedValueControlSource>> TimedValueControlSourceExt for O {}