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