gstreamer_controller/auto/
argb_control_binding.rs1use 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
53mod sealed {
54 pub trait Sealed {}
55 impl<T: super::IsA<super::ARGBControlBinding>> Sealed for T {}
56}
57
58pub trait ARGBControlBindingExt: IsA<ARGBControlBinding> + sealed::Sealed + 'static {
59 #[doc(alias = "control-source-a")]
60 fn control_source_a(&self) -> Option<gst::ControlSource> {
61 ObjectExt::property(self.as_ref(), "control-source-a")
62 }
63
64 #[doc(alias = "control-source-a")]
65 fn set_control_source_a<P: IsA<gst::ControlSource>>(&self, control_source_a: Option<&P>) {
66 ObjectExt::set_property(self.as_ref(), "control-source-a", control_source_a)
67 }
68
69 #[doc(alias = "control-source-b")]
70 fn control_source_b(&self) -> Option<gst::ControlSource> {
71 ObjectExt::property(self.as_ref(), "control-source-b")
72 }
73
74 #[doc(alias = "control-source-b")]
75 fn set_control_source_b<P: IsA<gst::ControlSource>>(&self, control_source_b: Option<&P>) {
76 ObjectExt::set_property(self.as_ref(), "control-source-b", control_source_b)
77 }
78
79 #[doc(alias = "control-source-g")]
80 fn control_source_g(&self) -> Option<gst::ControlSource> {
81 ObjectExt::property(self.as_ref(), "control-source-g")
82 }
83
84 #[doc(alias = "control-source-g")]
85 fn set_control_source_g<P: IsA<gst::ControlSource>>(&self, control_source_g: Option<&P>) {
86 ObjectExt::set_property(self.as_ref(), "control-source-g", control_source_g)
87 }
88
89 #[doc(alias = "control-source-r")]
90 fn control_source_r(&self) -> Option<gst::ControlSource> {
91 ObjectExt::property(self.as_ref(), "control-source-r")
92 }
93
94 #[doc(alias = "control-source-r")]
95 fn set_control_source_r<P: IsA<gst::ControlSource>>(&self, control_source_r: Option<&P>) {
96 ObjectExt::set_property(self.as_ref(), "control-source-r", control_source_r)
97 }
98
99 #[doc(alias = "control-source-a")]
100 fn connect_control_source_a_notify<F: Fn(&Self) + Send + Sync + 'static>(
101 &self,
102 f: F,
103 ) -> SignalHandlerId {
104 unsafe extern "C" fn notify_control_source_a_trampoline<
105 P: IsA<ARGBControlBinding>,
106 F: Fn(&P) + Send + Sync + 'static,
107 >(
108 this: *mut ffi::GstARGBControlBinding,
109 _param_spec: glib::ffi::gpointer,
110 f: glib::ffi::gpointer,
111 ) {
112 let f: &F = &*(f as *const F);
113 f(ARGBControlBinding::from_glib_borrow(this).unsafe_cast_ref())
114 }
115 unsafe {
116 let f: Box_<F> = Box_::new(f);
117 connect_raw(
118 self.as_ptr() as *mut _,
119 b"notify::control-source-a\0".as_ptr() as *const _,
120 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
121 notify_control_source_a_trampoline::<Self, F> as *const (),
122 )),
123 Box_::into_raw(f),
124 )
125 }
126 }
127
128 #[doc(alias = "control-source-b")]
129 fn connect_control_source_b_notify<F: Fn(&Self) + Send + Sync + 'static>(
130 &self,
131 f: F,
132 ) -> SignalHandlerId {
133 unsafe extern "C" fn notify_control_source_b_trampoline<
134 P: IsA<ARGBControlBinding>,
135 F: Fn(&P) + Send + Sync + 'static,
136 >(
137 this: *mut ffi::GstARGBControlBinding,
138 _param_spec: glib::ffi::gpointer,
139 f: glib::ffi::gpointer,
140 ) {
141 let f: &F = &*(f as *const F);
142 f(ARGBControlBinding::from_glib_borrow(this).unsafe_cast_ref())
143 }
144 unsafe {
145 let f: Box_<F> = Box_::new(f);
146 connect_raw(
147 self.as_ptr() as *mut _,
148 b"notify::control-source-b\0".as_ptr() as *const _,
149 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
150 notify_control_source_b_trampoline::<Self, F> as *const (),
151 )),
152 Box_::into_raw(f),
153 )
154 }
155 }
156
157 #[doc(alias = "control-source-g")]
158 fn connect_control_source_g_notify<F: Fn(&Self) + Send + Sync + 'static>(
159 &self,
160 f: F,
161 ) -> SignalHandlerId {
162 unsafe extern "C" fn notify_control_source_g_trampoline<
163 P: IsA<ARGBControlBinding>,
164 F: Fn(&P) + Send + Sync + 'static,
165 >(
166 this: *mut ffi::GstARGBControlBinding,
167 _param_spec: glib::ffi::gpointer,
168 f: glib::ffi::gpointer,
169 ) {
170 let f: &F = &*(f as *const F);
171 f(ARGBControlBinding::from_glib_borrow(this).unsafe_cast_ref())
172 }
173 unsafe {
174 let f: Box_<F> = Box_::new(f);
175 connect_raw(
176 self.as_ptr() as *mut _,
177 b"notify::control-source-g\0".as_ptr() as *const _,
178 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
179 notify_control_source_g_trampoline::<Self, F> as *const (),
180 )),
181 Box_::into_raw(f),
182 )
183 }
184 }
185
186 #[doc(alias = "control-source-r")]
187 fn connect_control_source_r_notify<F: Fn(&Self) + Send + Sync + 'static>(
188 &self,
189 f: F,
190 ) -> SignalHandlerId {
191 unsafe extern "C" fn notify_control_source_r_trampoline<
192 P: IsA<ARGBControlBinding>,
193 F: Fn(&P) + Send + Sync + 'static,
194 >(
195 this: *mut ffi::GstARGBControlBinding,
196 _param_spec: glib::ffi::gpointer,
197 f: glib::ffi::gpointer,
198 ) {
199 let f: &F = &*(f as *const F);
200 f(ARGBControlBinding::from_glib_borrow(this).unsafe_cast_ref())
201 }
202 unsafe {
203 let f: Box_<F> = Box_::new(f);
204 connect_raw(
205 self.as_ptr() as *mut _,
206 b"notify::control-source-r\0".as_ptr() as *const _,
207 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
208 notify_control_source_r_trampoline::<Self, F> as *const (),
209 )),
210 Box_::into_raw(f),
211 )
212 }
213 }
214}
215
216impl<O: IsA<ARGBControlBinding>> ARGBControlBindingExt for O {}