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
122mod sealed {
123 pub trait Sealed {}
124 impl<T: super::IsA<super::ARGBControlBinding>> Sealed for T {}
125}
126
127pub trait ARGBControlBindingExt: IsA<ARGBControlBinding> + sealed::Sealed + 'static {
133 #[doc(alias = "control-source-a")]
134 fn control_source_a(&self) -> Option<gst::ControlSource> {
135 ObjectExt::property(self.as_ref(), "control-source-a")
136 }
137
138 #[doc(alias = "control-source-a")]
139 fn set_control_source_a<P: IsA<gst::ControlSource>>(&self, control_source_a: Option<&P>) {
140 ObjectExt::set_property(self.as_ref(), "control-source-a", control_source_a)
141 }
142
143 #[doc(alias = "control-source-b")]
144 fn control_source_b(&self) -> Option<gst::ControlSource> {
145 ObjectExt::property(self.as_ref(), "control-source-b")
146 }
147
148 #[doc(alias = "control-source-b")]
149 fn set_control_source_b<P: IsA<gst::ControlSource>>(&self, control_source_b: Option<&P>) {
150 ObjectExt::set_property(self.as_ref(), "control-source-b", control_source_b)
151 }
152
153 #[doc(alias = "control-source-g")]
154 fn control_source_g(&self) -> Option<gst::ControlSource> {
155 ObjectExt::property(self.as_ref(), "control-source-g")
156 }
157
158 #[doc(alias = "control-source-g")]
159 fn set_control_source_g<P: IsA<gst::ControlSource>>(&self, control_source_g: Option<&P>) {
160 ObjectExt::set_property(self.as_ref(), "control-source-g", control_source_g)
161 }
162
163 #[doc(alias = "control-source-r")]
164 fn control_source_r(&self) -> Option<gst::ControlSource> {
165 ObjectExt::property(self.as_ref(), "control-source-r")
166 }
167
168 #[doc(alias = "control-source-r")]
169 fn set_control_source_r<P: IsA<gst::ControlSource>>(&self, control_source_r: Option<&P>) {
170 ObjectExt::set_property(self.as_ref(), "control-source-r", control_source_r)
171 }
172
173 #[doc(alias = "control-source-a")]
174 fn connect_control_source_a_notify<F: Fn(&Self) + Send + Sync + 'static>(
175 &self,
176 f: F,
177 ) -> SignalHandlerId {
178 unsafe extern "C" fn notify_control_source_a_trampoline<
179 P: IsA<ARGBControlBinding>,
180 F: Fn(&P) + Send + Sync + 'static,
181 >(
182 this: *mut ffi::GstARGBControlBinding,
183 _param_spec: glib::ffi::gpointer,
184 f: glib::ffi::gpointer,
185 ) {
186 let f: &F = &*(f as *const F);
187 f(ARGBControlBinding::from_glib_borrow(this).unsafe_cast_ref())
188 }
189 unsafe {
190 let f: Box_<F> = Box_::new(f);
191 connect_raw(
192 self.as_ptr() as *mut _,
193 b"notify::control-source-a\0".as_ptr() as *const _,
194 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
195 notify_control_source_a_trampoline::<Self, F> as *const (),
196 )),
197 Box_::into_raw(f),
198 )
199 }
200 }
201
202 #[doc(alias = "control-source-b")]
203 fn connect_control_source_b_notify<F: Fn(&Self) + Send + Sync + 'static>(
204 &self,
205 f: F,
206 ) -> SignalHandlerId {
207 unsafe extern "C" fn notify_control_source_b_trampoline<
208 P: IsA<ARGBControlBinding>,
209 F: Fn(&P) + Send + Sync + 'static,
210 >(
211 this: *mut ffi::GstARGBControlBinding,
212 _param_spec: glib::ffi::gpointer,
213 f: glib::ffi::gpointer,
214 ) {
215 let f: &F = &*(f as *const F);
216 f(ARGBControlBinding::from_glib_borrow(this).unsafe_cast_ref())
217 }
218 unsafe {
219 let f: Box_<F> = Box_::new(f);
220 connect_raw(
221 self.as_ptr() as *mut _,
222 b"notify::control-source-b\0".as_ptr() as *const _,
223 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
224 notify_control_source_b_trampoline::<Self, F> as *const (),
225 )),
226 Box_::into_raw(f),
227 )
228 }
229 }
230
231 #[doc(alias = "control-source-g")]
232 fn connect_control_source_g_notify<F: Fn(&Self) + Send + Sync + 'static>(
233 &self,
234 f: F,
235 ) -> SignalHandlerId {
236 unsafe extern "C" fn notify_control_source_g_trampoline<
237 P: IsA<ARGBControlBinding>,
238 F: Fn(&P) + Send + Sync + 'static,
239 >(
240 this: *mut ffi::GstARGBControlBinding,
241 _param_spec: glib::ffi::gpointer,
242 f: glib::ffi::gpointer,
243 ) {
244 let f: &F = &*(f as *const F);
245 f(ARGBControlBinding::from_glib_borrow(this).unsafe_cast_ref())
246 }
247 unsafe {
248 let f: Box_<F> = Box_::new(f);
249 connect_raw(
250 self.as_ptr() as *mut _,
251 b"notify::control-source-g\0".as_ptr() as *const _,
252 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
253 notify_control_source_g_trampoline::<Self, F> as *const (),
254 )),
255 Box_::into_raw(f),
256 )
257 }
258 }
259
260 #[doc(alias = "control-source-r")]
261 fn connect_control_source_r_notify<F: Fn(&Self) + Send + Sync + 'static>(
262 &self,
263 f: F,
264 ) -> SignalHandlerId {
265 unsafe extern "C" fn notify_control_source_r_trampoline<
266 P: IsA<ARGBControlBinding>,
267 F: Fn(&P) + Send + Sync + 'static,
268 >(
269 this: *mut ffi::GstARGBControlBinding,
270 _param_spec: glib::ffi::gpointer,
271 f: glib::ffi::gpointer,
272 ) {
273 let f: &F = &*(f as *const F);
274 f(ARGBControlBinding::from_glib_borrow(this).unsafe_cast_ref())
275 }
276 unsafe {
277 let f: Box_<F> = Box_::new(f);
278 connect_raw(
279 self.as_ptr() as *mut _,
280 b"notify::control-source-r\0".as_ptr() as *const _,
281 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
282 notify_control_source_r_trampoline::<Self, F> as *const (),
283 )),
284 Box_::into_raw(f),
285 )
286 }
287 }
288}
289
290impl<O: IsA<ARGBControlBinding>> ARGBControlBindingExt for O {}