gstreamer_controller/auto/
argb_control_binding.rs1use crate::ffi;
7use glib::{
8 prelude::*,
9 signal::{SignalHandlerId, connect_raw},
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 unsafe {
108 let f: &F = &*(f as *const F);
109 f(ARGBControlBinding::from_glib_borrow(this).unsafe_cast_ref())
110 }
111 }
112 unsafe {
113 let f: Box_<F> = Box_::new(f);
114 connect_raw(
115 self.as_ptr() as *mut _,
116 c"notify::control-source-a".as_ptr() as *const _,
117 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
118 notify_control_source_a_trampoline::<Self, F> as *const (),
119 )),
120 Box_::into_raw(f),
121 )
122 }
123 }
124
125 #[doc(alias = "control-source-b")]
126 fn connect_control_source_b_notify<F: Fn(&Self) + Send + Sync + 'static>(
127 &self,
128 f: F,
129 ) -> SignalHandlerId {
130 unsafe extern "C" fn notify_control_source_b_trampoline<
131 P: IsA<ARGBControlBinding>,
132 F: Fn(&P) + Send + Sync + 'static,
133 >(
134 this: *mut ffi::GstARGBControlBinding,
135 _param_spec: glib::ffi::gpointer,
136 f: glib::ffi::gpointer,
137 ) {
138 unsafe {
139 let f: &F = &*(f as *const F);
140 f(ARGBControlBinding::from_glib_borrow(this).unsafe_cast_ref())
141 }
142 }
143 unsafe {
144 let f: Box_<F> = Box_::new(f);
145 connect_raw(
146 self.as_ptr() as *mut _,
147 c"notify::control-source-b".as_ptr() as *const _,
148 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
149 notify_control_source_b_trampoline::<Self, F> as *const (),
150 )),
151 Box_::into_raw(f),
152 )
153 }
154 }
155
156 #[doc(alias = "control-source-g")]
157 fn connect_control_source_g_notify<F: Fn(&Self) + Send + Sync + 'static>(
158 &self,
159 f: F,
160 ) -> SignalHandlerId {
161 unsafe extern "C" fn notify_control_source_g_trampoline<
162 P: IsA<ARGBControlBinding>,
163 F: Fn(&P) + Send + Sync + 'static,
164 >(
165 this: *mut ffi::GstARGBControlBinding,
166 _param_spec: glib::ffi::gpointer,
167 f: glib::ffi::gpointer,
168 ) {
169 unsafe {
170 let f: &F = &*(f as *const F);
171 f(ARGBControlBinding::from_glib_borrow(this).unsafe_cast_ref())
172 }
173 }
174 unsafe {
175 let f: Box_<F> = Box_::new(f);
176 connect_raw(
177 self.as_ptr() as *mut _,
178 c"notify::control-source-g".as_ptr() as *const _,
179 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
180 notify_control_source_g_trampoline::<Self, F> as *const (),
181 )),
182 Box_::into_raw(f),
183 )
184 }
185 }
186
187 #[doc(alias = "control-source-r")]
188 fn connect_control_source_r_notify<F: Fn(&Self) + Send + Sync + 'static>(
189 &self,
190 f: F,
191 ) -> SignalHandlerId {
192 unsafe extern "C" fn notify_control_source_r_trampoline<
193 P: IsA<ARGBControlBinding>,
194 F: Fn(&P) + Send + Sync + 'static,
195 >(
196 this: *mut ffi::GstARGBControlBinding,
197 _param_spec: glib::ffi::gpointer,
198 f: glib::ffi::gpointer,
199 ) {
200 unsafe {
201 let f: &F = &*(f as *const F);
202 f(ARGBControlBinding::from_glib_borrow(this).unsafe_cast_ref())
203 }
204 }
205 unsafe {
206 let f: Box_<F> = Box_::new(f);
207 connect_raw(
208 self.as_ptr() as *mut _,
209 c"notify::control-source-r".as_ptr() as *const _,
210 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
211 notify_control_source_r_trampoline::<Self, F> as *const (),
212 )),
213 Box_::into_raw(f),
214 )
215 }
216 }
217}
218
219impl<O: IsA<ARGBControlBinding>> ARGBControlBindingExt for O {}