Skip to main content

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::{SignalHandlerId, connect_raw},
10    translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15    /// A value mapping object that attaches multiple control sources to a guint
16    /// gobject properties representing a color. A control value of 0.0 will turn the
17    /// color component off and a value of 1.0 will be the color level.
18    ///
19    /// ## Properties
20    ///
21    ///
22    /// #### `control-source-a`
23    ///  Readable | Writeable | Construct
24    ///
25    ///
26    /// #### `control-source-b`
27    ///  Readable | Writeable | Construct
28    ///
29    ///
30    /// #### `control-source-g`
31    ///  Readable | Writeable | Construct
32    ///
33    ///
34    /// #### `control-source-r`
35    ///  Readable | Writeable | Construct
36    /// <details><summary><h4>ControlBinding</h4></summary>
37    ///
38    ///
39    /// #### `name`
40    ///  Readable | Writeable | Construct Only
41    ///
42    ///
43    /// #### `object`
44    ///  Readable | Writeable | Construct Only
45    /// </details>
46    /// <details><summary><h4>Object</h4></summary>
47    ///
48    ///
49    /// #### `name`
50    ///  Readable | Writeable | Construct
51    ///
52    ///
53    /// #### `parent`
54    ///  The parent of the object. Please note, that when changing the 'parent'
55    /// property, we don't emit `GObject::notify` and [`deep-notify`][struct@crate::gst::Object#deep-notify]
56    /// signals due to locking issues. In some cases one can use
57    /// `GstBin::element-added` or `GstBin::element-removed` signals on the parent to
58    /// achieve a similar effect.
59    ///
60    /// Readable | Writeable
61    /// </details>
62    ///
63    /// # Implements
64    ///
65    /// [`ARGBControlBindingExt`][trait@crate::prelude::ARGBControlBindingExt], [`trait@gst::prelude::ControlBindingExt`], [`trait@gst::prelude::ObjectExt`]
66    #[doc(alias = "GstARGBControlBinding")]
67    pub struct ARGBControlBinding(Object<ffi::GstARGBControlBinding, ffi::GstARGBControlBindingClass>) @extends gst::ControlBinding, gst::Object;
68
69    match fn {
70        type_ => || ffi::gst_argb_control_binding_get_type(),
71    }
72}
73
74impl ARGBControlBinding {
75    pub const NONE: Option<&'static ARGBControlBinding> = None;
76
77    /// Create a new control-binding that attaches the given [`gst::ControlSource`][crate::gst::ControlSource] to the
78    /// `GObject` property.
79    /// ## `object`
80    /// the object of the property
81    /// ## `property_name`
82    /// the property-name to attach the control source
83    /// ## `cs_a`
84    /// the control source for the alpha channel
85    /// ## `cs_r`
86    /// the control source for the red channel
87    /// ## `cs_g`
88    /// the control source for the green channel
89    /// ## `cs_b`
90    /// the control source for the blue channel
91    ///
92    /// # Returns
93    ///
94    /// the new [`ARGBControlBinding`][crate::ARGBControlBinding]
95    #[doc(alias = "gst_argb_control_binding_new")]
96    pub fn new(
97        object: &impl IsA<gst::Object>,
98        property_name: &str,
99        cs_a: &impl IsA<gst::ControlSource>,
100        cs_r: &impl IsA<gst::ControlSource>,
101        cs_g: &impl IsA<gst::ControlSource>,
102        cs_b: &impl IsA<gst::ControlSource>,
103    ) -> ARGBControlBinding {
104        assert_initialized_main_thread!();
105        unsafe {
106            gst::ControlBinding::from_glib_none(ffi::gst_argb_control_binding_new(
107                object.as_ref().to_glib_none().0,
108                property_name.to_glib_none().0,
109                cs_a.as_ref().to_glib_none().0,
110                cs_r.as_ref().to_glib_none().0,
111                cs_g.as_ref().to_glib_none().0,
112                cs_b.as_ref().to_glib_none().0,
113            ))
114            .unsafe_cast()
115        }
116    }
117}
118
119unsafe impl Send for ARGBControlBinding {}
120unsafe impl Sync for ARGBControlBinding {}
121
122/// Trait containing all [`struct@ARGBControlBinding`] methods.
123///
124/// # Implementors
125///
126/// [`ARGBControlBinding`][struct@crate::ARGBControlBinding]
127pub trait ARGBControlBindingExt: IsA<ARGBControlBinding> + 'static {
128    #[doc(alias = "control-source-a")]
129    fn control_source_a(&self) -> Option<gst::ControlSource> {
130        ObjectExt::property(self.as_ref(), "control-source-a")
131    }
132
133    #[doc(alias = "control-source-a")]
134    fn set_control_source_a<P: IsA<gst::ControlSource>>(&self, control_source_a: Option<&P>) {
135        ObjectExt::set_property(self.as_ref(), "control-source-a", control_source_a)
136    }
137
138    #[doc(alias = "control-source-b")]
139    fn control_source_b(&self) -> Option<gst::ControlSource> {
140        ObjectExt::property(self.as_ref(), "control-source-b")
141    }
142
143    #[doc(alias = "control-source-b")]
144    fn set_control_source_b<P: IsA<gst::ControlSource>>(&self, control_source_b: Option<&P>) {
145        ObjectExt::set_property(self.as_ref(), "control-source-b", control_source_b)
146    }
147
148    #[doc(alias = "control-source-g")]
149    fn control_source_g(&self) -> Option<gst::ControlSource> {
150        ObjectExt::property(self.as_ref(), "control-source-g")
151    }
152
153    #[doc(alias = "control-source-g")]
154    fn set_control_source_g<P: IsA<gst::ControlSource>>(&self, control_source_g: Option<&P>) {
155        ObjectExt::set_property(self.as_ref(), "control-source-g", control_source_g)
156    }
157
158    #[doc(alias = "control-source-r")]
159    fn control_source_r(&self) -> Option<gst::ControlSource> {
160        ObjectExt::property(self.as_ref(), "control-source-r")
161    }
162
163    #[doc(alias = "control-source-r")]
164    fn set_control_source_r<P: IsA<gst::ControlSource>>(&self, control_source_r: Option<&P>) {
165        ObjectExt::set_property(self.as_ref(), "control-source-r", control_source_r)
166    }
167
168    #[doc(alias = "control-source-a")]
169    fn connect_control_source_a_notify<F: Fn(&Self) + Send + Sync + 'static>(
170        &self,
171        f: F,
172    ) -> SignalHandlerId {
173        unsafe extern "C" fn notify_control_source_a_trampoline<
174            P: IsA<ARGBControlBinding>,
175            F: Fn(&P) + Send + Sync + 'static,
176        >(
177            this: *mut ffi::GstARGBControlBinding,
178            _param_spec: glib::ffi::gpointer,
179            f: glib::ffi::gpointer,
180        ) {
181            unsafe {
182                let f: &F = &*(f as *const F);
183                f(ARGBControlBinding::from_glib_borrow(this).unsafe_cast_ref())
184            }
185        }
186        unsafe {
187            let f: Box_<F> = Box_::new(f);
188            connect_raw(
189                self.as_ptr() as *mut _,
190                c"notify::control-source-a".as_ptr(),
191                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
192                    notify_control_source_a_trampoline::<Self, F> as *const (),
193                )),
194                Box_::into_raw(f),
195            )
196        }
197    }
198
199    #[doc(alias = "control-source-b")]
200    fn connect_control_source_b_notify<F: Fn(&Self) + Send + Sync + 'static>(
201        &self,
202        f: F,
203    ) -> SignalHandlerId {
204        unsafe extern "C" fn notify_control_source_b_trampoline<
205            P: IsA<ARGBControlBinding>,
206            F: Fn(&P) + Send + Sync + 'static,
207        >(
208            this: *mut ffi::GstARGBControlBinding,
209            _param_spec: glib::ffi::gpointer,
210            f: glib::ffi::gpointer,
211        ) {
212            unsafe {
213                let f: &F = &*(f as *const F);
214                f(ARGBControlBinding::from_glib_borrow(this).unsafe_cast_ref())
215            }
216        }
217        unsafe {
218            let f: Box_<F> = Box_::new(f);
219            connect_raw(
220                self.as_ptr() as *mut _,
221                c"notify::control-source-b".as_ptr(),
222                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
223                    notify_control_source_b_trampoline::<Self, F> as *const (),
224                )),
225                Box_::into_raw(f),
226            )
227        }
228    }
229
230    #[doc(alias = "control-source-g")]
231    fn connect_control_source_g_notify<F: Fn(&Self) + Send + Sync + 'static>(
232        &self,
233        f: F,
234    ) -> SignalHandlerId {
235        unsafe extern "C" fn notify_control_source_g_trampoline<
236            P: IsA<ARGBControlBinding>,
237            F: Fn(&P) + Send + Sync + 'static,
238        >(
239            this: *mut ffi::GstARGBControlBinding,
240            _param_spec: glib::ffi::gpointer,
241            f: glib::ffi::gpointer,
242        ) {
243            unsafe {
244                let f: &F = &*(f as *const F);
245                f(ARGBControlBinding::from_glib_borrow(this).unsafe_cast_ref())
246            }
247        }
248        unsafe {
249            let f: Box_<F> = Box_::new(f);
250            connect_raw(
251                self.as_ptr() as *mut _,
252                c"notify::control-source-g".as_ptr(),
253                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
254                    notify_control_source_g_trampoline::<Self, F> as *const (),
255                )),
256                Box_::into_raw(f),
257            )
258        }
259    }
260
261    #[doc(alias = "control-source-r")]
262    fn connect_control_source_r_notify<F: Fn(&Self) + Send + Sync + 'static>(
263        &self,
264        f: F,
265    ) -> SignalHandlerId {
266        unsafe extern "C" fn notify_control_source_r_trampoline<
267            P: IsA<ARGBControlBinding>,
268            F: Fn(&P) + Send + Sync + 'static,
269        >(
270            this: *mut ffi::GstARGBControlBinding,
271            _param_spec: glib::ffi::gpointer,
272            f: glib::ffi::gpointer,
273        ) {
274            unsafe {
275                let f: &F = &*(f as *const F);
276                f(ARGBControlBinding::from_glib_borrow(this).unsafe_cast_ref())
277            }
278        }
279        unsafe {
280            let f: Box_<F> = Box_::new(f);
281            connect_raw(
282                self.as_ptr() as *mut _,
283                c"notify::control-source-r".as_ptr(),
284                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
285                    notify_control_source_r_trampoline::<Self, F> as *const (),
286                )),
287                Box_::into_raw(f),
288            )
289        }
290    }
291}
292
293impl<O: IsA<ARGBControlBinding>> ARGBControlBindingExt for O {}