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