gstreamer_controller/auto/
argb_control_binding.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;
7use glib::{
8    prelude::*,
9    signal::{connect_raw, SignalHandlerId},
10    translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15    #[doc(alias = "GstARGBControlBinding")]
16    pub struct ARGBControlBinding(Object<ffi::GstARGBControlBinding, ffi::GstARGBControlBindingClass>) @extends gst::ControlBinding, gst::Object;
17
18    match fn {
19        type_ => || ffi::gst_argb_control_binding_get_type(),
20    }
21}
22
23impl ARGBControlBinding {
24    pub const NONE: Option<&'static ARGBControlBinding> = None;
25
26    #[doc(alias = "gst_argb_control_binding_new")]
27    pub fn new(
28        object: &impl IsA<gst::Object>,
29        property_name: &str,
30        cs_a: &impl IsA<gst::ControlSource>,
31        cs_r: &impl IsA<gst::ControlSource>,
32        cs_g: &impl IsA<gst::ControlSource>,
33        cs_b: &impl IsA<gst::ControlSource>,
34    ) -> ARGBControlBinding {
35        assert_initialized_main_thread!();
36        unsafe {
37            gst::ControlBinding::from_glib_none(ffi::gst_argb_control_binding_new(
38                object.as_ref().to_glib_none().0,
39                property_name.to_glib_none().0,
40                cs_a.as_ref().to_glib_none().0,
41                cs_r.as_ref().to_glib_none().0,
42                cs_g.as_ref().to_glib_none().0,
43                cs_b.as_ref().to_glib_none().0,
44            ))
45            .unsafe_cast()
46        }
47    }
48}
49
50unsafe impl Send for ARGBControlBinding {}
51unsafe impl Sync for ARGBControlBinding {}
52
53pub trait ARGBControlBindingExt: IsA<ARGBControlBinding> + 'static {
54    #[doc(alias = "control-source-a")]
55    fn control_source_a(&self) -> Option<gst::ControlSource> {
56        ObjectExt::property(self.as_ref(), "control-source-a")
57    }
58
59    #[doc(alias = "control-source-a")]
60    fn set_control_source_a<P: IsA<gst::ControlSource>>(&self, control_source_a: Option<&P>) {
61        ObjectExt::set_property(self.as_ref(), "control-source-a", control_source_a)
62    }
63
64    #[doc(alias = "control-source-b")]
65    fn control_source_b(&self) -> Option<gst::ControlSource> {
66        ObjectExt::property(self.as_ref(), "control-source-b")
67    }
68
69    #[doc(alias = "control-source-b")]
70    fn set_control_source_b<P: IsA<gst::ControlSource>>(&self, control_source_b: Option<&P>) {
71        ObjectExt::set_property(self.as_ref(), "control-source-b", control_source_b)
72    }
73
74    #[doc(alias = "control-source-g")]
75    fn control_source_g(&self) -> Option<gst::ControlSource> {
76        ObjectExt::property(self.as_ref(), "control-source-g")
77    }
78
79    #[doc(alias = "control-source-g")]
80    fn set_control_source_g<P: IsA<gst::ControlSource>>(&self, control_source_g: Option<&P>) {
81        ObjectExt::set_property(self.as_ref(), "control-source-g", control_source_g)
82    }
83
84    #[doc(alias = "control-source-r")]
85    fn control_source_r(&self) -> Option<gst::ControlSource> {
86        ObjectExt::property(self.as_ref(), "control-source-r")
87    }
88
89    #[doc(alias = "control-source-r")]
90    fn set_control_source_r<P: IsA<gst::ControlSource>>(&self, control_source_r: Option<&P>) {
91        ObjectExt::set_property(self.as_ref(), "control-source-r", control_source_r)
92    }
93
94    #[doc(alias = "control-source-a")]
95    fn connect_control_source_a_notify<F: Fn(&Self) + Send + Sync + 'static>(
96        &self,
97        f: F,
98    ) -> SignalHandlerId {
99        unsafe extern "C" fn notify_control_source_a_trampoline<
100            P: IsA<ARGBControlBinding>,
101            F: Fn(&P) + Send + Sync + 'static,
102        >(
103            this: *mut ffi::GstARGBControlBinding,
104            _param_spec: glib::ffi::gpointer,
105            f: glib::ffi::gpointer,
106        ) {
107            let f: &F = &*(f as *const F);
108            f(ARGBControlBinding::from_glib_borrow(this).unsafe_cast_ref())
109        }
110        unsafe {
111            let f: Box_<F> = Box_::new(f);
112            connect_raw(
113                self.as_ptr() as *mut _,
114                c"notify::control-source-a".as_ptr() as *const _,
115                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
116                    notify_control_source_a_trampoline::<Self, F> as *const (),
117                )),
118                Box_::into_raw(f),
119            )
120        }
121    }
122
123    #[doc(alias = "control-source-b")]
124    fn connect_control_source_b_notify<F: Fn(&Self) + Send + Sync + 'static>(
125        &self,
126        f: F,
127    ) -> SignalHandlerId {
128        unsafe extern "C" fn notify_control_source_b_trampoline<
129            P: IsA<ARGBControlBinding>,
130            F: Fn(&P) + Send + Sync + 'static,
131        >(
132            this: *mut ffi::GstARGBControlBinding,
133            _param_spec: glib::ffi::gpointer,
134            f: glib::ffi::gpointer,
135        ) {
136            let f: &F = &*(f as *const F);
137            f(ARGBControlBinding::from_glib_borrow(this).unsafe_cast_ref())
138        }
139        unsafe {
140            let f: Box_<F> = Box_::new(f);
141            connect_raw(
142                self.as_ptr() as *mut _,
143                c"notify::control-source-b".as_ptr() as *const _,
144                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
145                    notify_control_source_b_trampoline::<Self, F> as *const (),
146                )),
147                Box_::into_raw(f),
148            )
149        }
150    }
151
152    #[doc(alias = "control-source-g")]
153    fn connect_control_source_g_notify<F: Fn(&Self) + Send + Sync + 'static>(
154        &self,
155        f: F,
156    ) -> SignalHandlerId {
157        unsafe extern "C" fn notify_control_source_g_trampoline<
158            P: IsA<ARGBControlBinding>,
159            F: Fn(&P) + Send + Sync + 'static,
160        >(
161            this: *mut ffi::GstARGBControlBinding,
162            _param_spec: glib::ffi::gpointer,
163            f: glib::ffi::gpointer,
164        ) {
165            let f: &F = &*(f as *const F);
166            f(ARGBControlBinding::from_glib_borrow(this).unsafe_cast_ref())
167        }
168        unsafe {
169            let f: Box_<F> = Box_::new(f);
170            connect_raw(
171                self.as_ptr() as *mut _,
172                c"notify::control-source-g".as_ptr() as *const _,
173                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
174                    notify_control_source_g_trampoline::<Self, F> as *const (),
175                )),
176                Box_::into_raw(f),
177            )
178        }
179    }
180
181    #[doc(alias = "control-source-r")]
182    fn connect_control_source_r_notify<F: Fn(&Self) + Send + Sync + 'static>(
183        &self,
184        f: F,
185    ) -> SignalHandlerId {
186        unsafe extern "C" fn notify_control_source_r_trampoline<
187            P: IsA<ARGBControlBinding>,
188            F: Fn(&P) + Send + Sync + 'static,
189        >(
190            this: *mut ffi::GstARGBControlBinding,
191            _param_spec: glib::ffi::gpointer,
192            f: glib::ffi::gpointer,
193        ) {
194            let f: &F = &*(f as *const F);
195            f(ARGBControlBinding::from_glib_borrow(this).unsafe_cast_ref())
196        }
197        unsafe {
198            let f: Box_<F> = Box_::new(f);
199            connect_raw(
200                self.as_ptr() as *mut _,
201                c"notify::control-source-r".as_ptr() as *const _,
202                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
203                    notify_control_source_r_trampoline::<Self, F> as *const (),
204                )),
205                Box_::into_raw(f),
206            )
207        }
208    }
209}
210
211impl<O: IsA<ARGBControlBinding>> ARGBControlBindingExt for O {}