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
73/// Trait containing all [`struct@TimedValueControlSource`] methods.
74///
75/// # Implementors
76///
77/// [`InterpolationControlSource`][struct@crate::InterpolationControlSource], [`TimedValueControlSource`][struct@crate::TimedValueControlSource], [`TriggerControlSource`][struct@crate::TriggerControlSource]
78pub trait TimedValueControlSourceExt: IsA<TimedValueControlSource> + 'static {
79 //#[doc(alias = "gst_timed_value_control_source_find_control_point_iter")]
80 //fn find_control_point_iter(&self, timestamp: impl Into<Option<gst::ClockTime>>) -> /*Ignored*/Option<glib::SequenceIter> {
81 // unsafe { TODO: call ffi:gst_timed_value_control_source_find_control_point_iter() }
82 //}
83
84 //#[doc(alias = "gst_timed_value_control_source_get_all")]
85 //#[doc(alias = "get_all")]
86 //fn all(&self) -> /*Ignored*/Vec<gst::TimedValue> {
87 // unsafe { TODO: call ffi:gst_timed_value_control_source_get_all() }
88 //}
89
90 /// Get the number of control points that are set.
91 ///
92 /// # Returns
93 ///
94 /// the number of control points that are set.
95 #[doc(alias = "gst_timed_value_control_source_get_count")]
96 #[doc(alias = "get_count")]
97 fn count(&self) -> i32 {
98 unsafe { ffi::gst_timed_value_control_source_get_count(self.as_ref().to_glib_none().0) }
99 }
100
101 /// Set the value of given controller-handled property at a certain time.
102 /// ## `timestamp`
103 /// the time the control-change is scheduled for
104 /// ## `value`
105 /// the control-value
106 ///
107 /// # Returns
108 ///
109 /// FALSE if the values couldn't be set, TRUE otherwise.
110 #[doc(alias = "gst_timed_value_control_source_set")]
111 fn set(&self, timestamp: gst::ClockTime, value: f64) -> bool {
112 unsafe {
113 from_glib(ffi::gst_timed_value_control_source_set(
114 self.as_ref().to_glib_none().0,
115 timestamp.into_glib(),
116 value,
117 ))
118 }
119 }
120
121 //#[doc(alias = "gst_timed_value_control_source_set_from_list")]
122 //fn set_from_list(&self, timedvalues: /*Ignored*/&[gst::TimedValue]) -> bool {
123 // unsafe { TODO: call ffi:gst_timed_value_control_source_set_from_list() }
124 //}
125
126 /// Used to remove the value of given controller-handled property at a certain
127 /// time.
128 /// ## `timestamp`
129 /// the time the control-change should be removed from
130 ///
131 /// # Returns
132 ///
133 /// FALSE if the value couldn't be unset (i.e. not found, TRUE otherwise.
134 #[doc(alias = "gst_timed_value_control_source_unset")]
135 fn unset(&self, timestamp: gst::ClockTime) -> bool {
136 unsafe {
137 from_glib(ffi::gst_timed_value_control_source_unset(
138 self.as_ref().to_glib_none().0,
139 timestamp.into_glib(),
140 ))
141 }
142 }
143
144 /// Used to remove all time-stamped values of given controller-handled property
145 #[doc(alias = "gst_timed_value_control_source_unset_all")]
146 fn unset_all(&self) {
147 unsafe {
148 ffi::gst_timed_value_control_source_unset_all(self.as_ref().to_glib_none().0);
149 }
150 }
151
152 /// Emitted right after the new value has been added to `self_`
153 /// ## `timed_value`
154 /// The newly added `GstTimedValue`
155 #[doc(alias = "value-added")]
156 fn connect_value_added<F: Fn(&Self, &ControlPoint) + Send + Sync + 'static>(
157 &self,
158 f: F,
159 ) -> SignalHandlerId {
160 unsafe extern "C" fn value_added_trampoline<
161 P: IsA<TimedValueControlSource>,
162 F: Fn(&P, &ControlPoint) + Send + Sync + 'static,
163 >(
164 this: *mut ffi::GstTimedValueControlSource,
165 timed_value: *mut ffi::GstControlPoint,
166 f: glib::ffi::gpointer,
167 ) {
168 let f: &F = &*(f as *const F);
169 f(
170 TimedValueControlSource::from_glib_borrow(this).unsafe_cast_ref(),
171 &from_glib_borrow(timed_value),
172 )
173 }
174 unsafe {
175 let f: Box_<F> = Box_::new(f);
176 connect_raw(
177 self.as_ptr() as *mut _,
178 c"value-added".as_ptr() as *const _,
179 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
180 value_added_trampoline::<Self, F> as *const (),
181 )),
182 Box_::into_raw(f),
183 )
184 }
185 }
186
187 /// Emitted right after the new value has been set on `timed_signals`
188 /// ## `timed_value`
189 /// The `GstTimedValue` where the value changed
190 #[doc(alias = "value-changed")]
191 fn connect_value_changed<F: Fn(&Self, &ControlPoint) + Send + Sync + 'static>(
192 &self,
193 f: F,
194 ) -> SignalHandlerId {
195 unsafe extern "C" fn value_changed_trampoline<
196 P: IsA<TimedValueControlSource>,
197 F: Fn(&P, &ControlPoint) + Send + Sync + 'static,
198 >(
199 this: *mut ffi::GstTimedValueControlSource,
200 timed_value: *mut ffi::GstControlPoint,
201 f: glib::ffi::gpointer,
202 ) {
203 let f: &F = &*(f as *const F);
204 f(
205 TimedValueControlSource::from_glib_borrow(this).unsafe_cast_ref(),
206 &from_glib_borrow(timed_value),
207 )
208 }
209 unsafe {
210 let f: Box_<F> = Box_::new(f);
211 connect_raw(
212 self.as_ptr() as *mut _,
213 c"value-changed".as_ptr() as *const _,
214 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
215 value_changed_trampoline::<Self, F> as *const (),
216 )),
217 Box_::into_raw(f),
218 )
219 }
220 }
221
222 /// Emitted when `timed_value` is removed from `self_`
223 /// ## `timed_value`
224 /// The removed `GstTimedValue`
225 #[doc(alias = "value-removed")]
226 fn connect_value_removed<F: Fn(&Self, &ControlPoint) + Send + Sync + 'static>(
227 &self,
228 f: F,
229 ) -> SignalHandlerId {
230 unsafe extern "C" fn value_removed_trampoline<
231 P: IsA<TimedValueControlSource>,
232 F: Fn(&P, &ControlPoint) + Send + Sync + 'static,
233 >(
234 this: *mut ffi::GstTimedValueControlSource,
235 timed_value: *mut ffi::GstControlPoint,
236 f: glib::ffi::gpointer,
237 ) {
238 let f: &F = &*(f as *const F);
239 f(
240 TimedValueControlSource::from_glib_borrow(this).unsafe_cast_ref(),
241 &from_glib_borrow(timed_value),
242 )
243 }
244 unsafe {
245 let f: Box_<F> = Box_::new(f);
246 connect_raw(
247 self.as_ptr() as *mut _,
248 c"value-removed".as_ptr() as *const _,
249 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
250 value_removed_trampoline::<Self, F> as *const (),
251 )),
252 Box_::into_raw(f),
253 )
254 }
255 }
256}
257
258impl<O: IsA<TimedValueControlSource>> TimedValueControlSourceExt for O {}