Skip to main content

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