gstreamer_controller/auto/
argb_control_binding.rs
1use 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")]
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 #[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
122pub 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 let f: &F = &*(f as *const F);
182 f(ARGBControlBinding::from_glib_borrow(this).unsafe_cast_ref())
183 }
184 unsafe {
185 let f: Box_<F> = Box_::new(f);
186 connect_raw(
187 self.as_ptr() as *mut _,
188 c"notify::control-source-a".as_ptr() as *const _,
189 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
190 notify_control_source_a_trampoline::<Self, F> as *const (),
191 )),
192 Box_::into_raw(f),
193 )
194 }
195 }
196
197 #[doc(alias = "control-source-b")]
198 fn connect_control_source_b_notify<F: Fn(&Self) + Send + Sync + 'static>(
199 &self,
200 f: F,
201 ) -> SignalHandlerId {
202 unsafe extern "C" fn notify_control_source_b_trampoline<
203 P: IsA<ARGBControlBinding>,
204 F: Fn(&P) + Send + Sync + 'static,
205 >(
206 this: *mut ffi::GstARGBControlBinding,
207 _param_spec: glib::ffi::gpointer,
208 f: glib::ffi::gpointer,
209 ) {
210 let f: &F = &*(f as *const F);
211 f(ARGBControlBinding::from_glib_borrow(this).unsafe_cast_ref())
212 }
213 unsafe {
214 let f: Box_<F> = Box_::new(f);
215 connect_raw(
216 self.as_ptr() as *mut _,
217 c"notify::control-source-b".as_ptr() as *const _,
218 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
219 notify_control_source_b_trampoline::<Self, F> as *const (),
220 )),
221 Box_::into_raw(f),
222 )
223 }
224 }
225
226 #[doc(alias = "control-source-g")]
227 fn connect_control_source_g_notify<F: Fn(&Self) + Send + Sync + 'static>(
228 &self,
229 f: F,
230 ) -> SignalHandlerId {
231 unsafe extern "C" fn notify_control_source_g_trampoline<
232 P: IsA<ARGBControlBinding>,
233 F: Fn(&P) + Send + Sync + 'static,
234 >(
235 this: *mut ffi::GstARGBControlBinding,
236 _param_spec: glib::ffi::gpointer,
237 f: glib::ffi::gpointer,
238 ) {
239 let f: &F = &*(f as *const F);
240 f(ARGBControlBinding::from_glib_borrow(this).unsafe_cast_ref())
241 }
242 unsafe {
243 let f: Box_<F> = Box_::new(f);
244 connect_raw(
245 self.as_ptr() as *mut _,
246 c"notify::control-source-g".as_ptr() as *const _,
247 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
248 notify_control_source_g_trampoline::<Self, F> as *const (),
249 )),
250 Box_::into_raw(f),
251 )
252 }
253 }
254
255 #[doc(alias = "control-source-r")]
256 fn connect_control_source_r_notify<F: Fn(&Self) + Send + Sync + 'static>(
257 &self,
258 f: F,
259 ) -> SignalHandlerId {
260 unsafe extern "C" fn notify_control_source_r_trampoline<
261 P: IsA<ARGBControlBinding>,
262 F: Fn(&P) + Send + Sync + 'static,
263 >(
264 this: *mut ffi::GstARGBControlBinding,
265 _param_spec: glib::ffi::gpointer,
266 f: glib::ffi::gpointer,
267 ) {
268 let f: &F = &*(f as *const F);
269 f(ARGBControlBinding::from_glib_borrow(this).unsafe_cast_ref())
270 }
271 unsafe {
272 let f: Box_<F> = Box_::new(f);
273 connect_raw(
274 self.as_ptr() as *mut _,
275 c"notify::control-source-r".as_ptr() as *const _,
276 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
277 notify_control_source_r_trampoline::<Self, F> as *const (),
278 )),
279 Box_::into_raw(f),
280 )
281 }
282 }
283}
284
285impl<O: IsA<ARGBControlBinding>> ARGBControlBindingExt for O {}