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    #[doc(alias = "GstTimedValueControlSource")]
17    pub struct TimedValueControlSource(Object<ffi::GstTimedValueControlSource, ffi::GstTimedValueControlSourceClass>) @extends gst::ControlSource, gst::Object;
18
19    match fn {
20        type_ => || ffi::gst_timed_value_control_source_get_type(),
21    }
22}
23
24impl TimedValueControlSource {
25    pub const NONE: Option<&'static TimedValueControlSource> = None;
26}
27
28unsafe impl Send for TimedValueControlSource {}
29unsafe impl Sync for TimedValueControlSource {}
30
31mod sealed {
32    pub trait Sealed {}
33    impl<T: super::IsA<super::TimedValueControlSource>> Sealed for T {}
34}
35
36pub trait TimedValueControlSourceExt:
37    IsA<TimedValueControlSource> + sealed::Sealed + 'static
38{
39    //#[doc(alias = "gst_timed_value_control_source_find_control_point_iter")]
40    //fn find_control_point_iter(&self, timestamp: impl Into<Option<gst::ClockTime>>) -> /*Ignored*/Option<glib::SequenceIter> {
41    //    unsafe { TODO: call ffi:gst_timed_value_control_source_find_control_point_iter() }
42    //}
43
44    //#[doc(alias = "gst_timed_value_control_source_get_all")]
45    //#[doc(alias = "get_all")]
46    //fn all(&self) -> /*Ignored*/Vec<gst::TimedValue> {
47    //    unsafe { TODO: call ffi:gst_timed_value_control_source_get_all() }
48    //}
49
50    #[doc(alias = "gst_timed_value_control_source_get_count")]
51    #[doc(alias = "get_count")]
52    fn count(&self) -> i32 {
53        unsafe { ffi::gst_timed_value_control_source_get_count(self.as_ref().to_glib_none().0) }
54    }
55
56    #[doc(alias = "gst_timed_value_control_source_set")]
57    fn set(&self, timestamp: gst::ClockTime, value: f64) -> bool {
58        unsafe {
59            from_glib(ffi::gst_timed_value_control_source_set(
60                self.as_ref().to_glib_none().0,
61                timestamp.into_glib(),
62                value,
63            ))
64        }
65    }
66
67    //#[doc(alias = "gst_timed_value_control_source_set_from_list")]
68    //fn set_from_list(&self, timedvalues: /*Ignored*/&[gst::TimedValue]) -> bool {
69    //    unsafe { TODO: call ffi:gst_timed_value_control_source_set_from_list() }
70    //}
71
72    #[doc(alias = "gst_timed_value_control_source_unset")]
73    fn unset(&self, timestamp: gst::ClockTime) -> bool {
74        unsafe {
75            from_glib(ffi::gst_timed_value_control_source_unset(
76                self.as_ref().to_glib_none().0,
77                timestamp.into_glib(),
78            ))
79        }
80    }
81
82    #[doc(alias = "gst_timed_value_control_source_unset_all")]
83    fn unset_all(&self) {
84        unsafe {
85            ffi::gst_timed_value_control_source_unset_all(self.as_ref().to_glib_none().0);
86        }
87    }
88
89    #[doc(alias = "value-added")]
90    fn connect_value_added<F: Fn(&Self, &ControlPoint) + Send + Sync + 'static>(
91        &self,
92        f: F,
93    ) -> SignalHandlerId {
94        unsafe extern "C" fn value_added_trampoline<
95            P: IsA<TimedValueControlSource>,
96            F: Fn(&P, &ControlPoint) + Send + Sync + 'static,
97        >(
98            this: *mut ffi::GstTimedValueControlSource,
99            timed_value: *mut ffi::GstControlPoint,
100            f: glib::ffi::gpointer,
101        ) {
102            let f: &F = &*(f as *const F);
103            f(
104                TimedValueControlSource::from_glib_borrow(this).unsafe_cast_ref(),
105                &from_glib_borrow(timed_value),
106            )
107        }
108        unsafe {
109            let f: Box_<F> = Box_::new(f);
110            connect_raw(
111                self.as_ptr() as *mut _,
112                b"value-added\0".as_ptr() as *const _,
113                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
114                    value_added_trampoline::<Self, F> as *const (),
115                )),
116                Box_::into_raw(f),
117            )
118        }
119    }
120
121    #[doc(alias = "value-changed")]
122    fn connect_value_changed<F: Fn(&Self, &ControlPoint) + Send + Sync + 'static>(
123        &self,
124        f: F,
125    ) -> SignalHandlerId {
126        unsafe extern "C" fn value_changed_trampoline<
127            P: IsA<TimedValueControlSource>,
128            F: Fn(&P, &ControlPoint) + Send + Sync + 'static,
129        >(
130            this: *mut ffi::GstTimedValueControlSource,
131            timed_value: *mut ffi::GstControlPoint,
132            f: glib::ffi::gpointer,
133        ) {
134            let f: &F = &*(f as *const F);
135            f(
136                TimedValueControlSource::from_glib_borrow(this).unsafe_cast_ref(),
137                &from_glib_borrow(timed_value),
138            )
139        }
140        unsafe {
141            let f: Box_<F> = Box_::new(f);
142            connect_raw(
143                self.as_ptr() as *mut _,
144                b"value-changed\0".as_ptr() as *const _,
145                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
146                    value_changed_trampoline::<Self, F> as *const (),
147                )),
148                Box_::into_raw(f),
149            )
150        }
151    }
152
153    #[doc(alias = "value-removed")]
154    fn connect_value_removed<F: Fn(&Self, &ControlPoint) + Send + Sync + 'static>(
155        &self,
156        f: F,
157    ) -> SignalHandlerId {
158        unsafe extern "C" fn value_removed_trampoline<
159            P: IsA<TimedValueControlSource>,
160            F: Fn(&P, &ControlPoint) + Send + Sync + 'static,
161        >(
162            this: *mut ffi::GstTimedValueControlSource,
163            timed_value: *mut ffi::GstControlPoint,
164            f: glib::ffi::gpointer,
165        ) {
166            let f: &F = &*(f as *const F);
167            f(
168                TimedValueControlSource::from_glib_borrow(this).unsafe_cast_ref(),
169                &from_glib_borrow(timed_value),
170            )
171        }
172        unsafe {
173            let f: Box_<F> = Box_::new(f);
174            connect_raw(
175                self.as_ptr() as *mut _,
176                b"value-removed\0".as_ptr() as *const _,
177                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
178                    value_removed_trampoline::<Self, F> as *const (),
179                )),
180                Box_::into_raw(f),
181            )
182        }
183    }
184}
185
186impl<O: IsA<TimedValueControlSource>> TimedValueControlSourceExt for O {}