1use crate::{GLContext, GLStereoDownmix, 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 = "GstGLViewConvert")]
16 pub struct GLViewConvert(Object<ffi::GstGLViewConvert, ffi::GstGLViewConvertClass>) @extends gst::Object;
17
18 match fn {
19 type_ => || ffi::gst_gl_view_convert_get_type(),
20 }
21}
22
23impl GLViewConvert {
24 #[doc(alias = "gst_gl_view_convert_new")]
25 pub fn new() -> GLViewConvert {
26 assert_initialized_main_thread!();
27 unsafe { from_glib_full(ffi::gst_gl_view_convert_new()) }
28 }
29
30 #[doc(alias = "gst_gl_view_convert_perform")]
31 pub fn perform(&self, inbuf: &gst::Buffer) -> Option<gst::Buffer> {
32 unsafe {
33 from_glib_full(ffi::gst_gl_view_convert_perform(
34 self.to_glib_none().0,
35 inbuf.to_glib_none().0,
36 ))
37 }
38 }
39
40 #[doc(alias = "gst_gl_view_convert_reset")]
41 pub fn reset(&self) {
42 unsafe {
43 ffi::gst_gl_view_convert_reset(self.to_glib_none().0);
44 }
45 }
46
47 #[doc(alias = "gst_gl_view_convert_set_caps")]
48 pub fn set_caps(
49 &self,
50 in_caps: &gst::Caps,
51 out_caps: &gst::Caps,
52 ) -> Result<(), glib::error::BoolError> {
53 unsafe {
54 glib::result_from_gboolean!(
55 ffi::gst_gl_view_convert_set_caps(
56 self.to_glib_none().0,
57 in_caps.to_glib_none().0,
58 out_caps.to_glib_none().0
59 ),
60 "Failed to set caps"
61 )
62 }
63 }
64
65 #[doc(alias = "gst_gl_view_convert_set_context")]
66 pub fn set_context(&self, context: &impl IsA<GLContext>) {
67 unsafe {
68 ffi::gst_gl_view_convert_set_context(
69 self.to_glib_none().0,
70 context.as_ref().to_glib_none().0,
71 );
72 }
73 }
74
75 #[doc(alias = "gst_gl_view_convert_transform_caps")]
76 pub fn transform_caps(
77 &self,
78 direction: gst::PadDirection,
79 caps: &gst::Caps,
80 filter: &gst::Caps,
81 ) -> gst::Caps {
82 unsafe {
83 from_glib_full(ffi::gst_gl_view_convert_transform_caps(
84 self.to_glib_none().0,
85 direction.into_glib(),
86 caps.to_glib_none().0,
87 filter.to_glib_none().0,
88 ))
89 }
90 }
91
92 #[doc(alias = "downmix-mode")]
93 pub fn downmix_mode(&self) -> GLStereoDownmix {
94 ObjectExt::property(self, "downmix-mode")
95 }
96
97 #[doc(alias = "downmix-mode")]
98 pub fn set_downmix_mode(&self, downmix_mode: GLStereoDownmix) {
99 ObjectExt::set_property(self, "downmix-mode", downmix_mode)
100 }
101
102 #[doc(alias = "input-flags-override")]
103 pub fn input_flags_override(&self) -> gst_video::VideoMultiviewFlags {
104 ObjectExt::property(self, "input-flags-override")
105 }
106
107 #[doc(alias = "input-flags-override")]
108 pub fn set_input_flags_override(&self, input_flags_override: gst_video::VideoMultiviewFlags) {
109 ObjectExt::set_property(self, "input-flags-override", input_flags_override)
110 }
111
112 #[doc(alias = "input-mode-override")]
113 pub fn input_mode_override(&self) -> gst_video::VideoMultiviewMode {
114 ObjectExt::property(self, "input-mode-override")
115 }
116
117 #[doc(alias = "input-mode-override")]
118 pub fn set_input_mode_override(&self, input_mode_override: gst_video::VideoMultiviewMode) {
119 ObjectExt::set_property(self, "input-mode-override", input_mode_override)
120 }
121
122 #[doc(alias = "output-flags-override")]
123 pub fn output_flags_override(&self) -> gst_video::VideoMultiviewFlags {
124 ObjectExt::property(self, "output-flags-override")
125 }
126
127 #[doc(alias = "output-flags-override")]
128 pub fn set_output_flags_override(&self, output_flags_override: gst_video::VideoMultiviewFlags) {
129 ObjectExt::set_property(self, "output-flags-override", output_flags_override)
130 }
131
132 #[doc(alias = "output-mode-override")]
133 pub fn output_mode_override(&self) -> gst_video::VideoMultiviewMode {
134 ObjectExt::property(self, "output-mode-override")
135 }
136
137 #[doc(alias = "output-mode-override")]
138 pub fn set_output_mode_override(&self, output_mode_override: gst_video::VideoMultiviewMode) {
139 ObjectExt::set_property(self, "output-mode-override", output_mode_override)
140 }
141
142 #[doc(alias = "downmix-mode")]
143 pub fn connect_downmix_mode_notify<F: Fn(&Self) + Send + Sync + 'static>(
144 &self,
145 f: F,
146 ) -> SignalHandlerId {
147 unsafe extern "C" fn notify_downmix_mode_trampoline<
148 F: Fn(&GLViewConvert) + Send + Sync + 'static,
149 >(
150 this: *mut ffi::GstGLViewConvert,
151 _param_spec: glib::ffi::gpointer,
152 f: glib::ffi::gpointer,
153 ) {
154 unsafe {
155 let f: &F = &*(f as *const F);
156 f(&from_glib_borrow(this))
157 }
158 }
159 unsafe {
160 let f: Box_<F> = Box_::new(f);
161 connect_raw(
162 self.as_ptr() as *mut _,
163 c"notify::downmix-mode".as_ptr(),
164 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
165 notify_downmix_mode_trampoline::<F> as *const (),
166 )),
167 Box_::into_raw(f),
168 )
169 }
170 }
171
172 #[doc(alias = "input-flags-override")]
173 pub fn connect_input_flags_override_notify<F: Fn(&Self) + Send + Sync + 'static>(
174 &self,
175 f: F,
176 ) -> SignalHandlerId {
177 unsafe extern "C" fn notify_input_flags_override_trampoline<
178 F: Fn(&GLViewConvert) + Send + Sync + 'static,
179 >(
180 this: *mut ffi::GstGLViewConvert,
181 _param_spec: glib::ffi::gpointer,
182 f: glib::ffi::gpointer,
183 ) {
184 unsafe {
185 let f: &F = &*(f as *const F);
186 f(&from_glib_borrow(this))
187 }
188 }
189 unsafe {
190 let f: Box_<F> = Box_::new(f);
191 connect_raw(
192 self.as_ptr() as *mut _,
193 c"notify::input-flags-override".as_ptr(),
194 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
195 notify_input_flags_override_trampoline::<F> as *const (),
196 )),
197 Box_::into_raw(f),
198 )
199 }
200 }
201
202 #[doc(alias = "input-mode-override")]
203 pub fn connect_input_mode_override_notify<F: Fn(&Self) + Send + Sync + 'static>(
204 &self,
205 f: F,
206 ) -> SignalHandlerId {
207 unsafe extern "C" fn notify_input_mode_override_trampoline<
208 F: Fn(&GLViewConvert) + Send + Sync + 'static,
209 >(
210 this: *mut ffi::GstGLViewConvert,
211 _param_spec: glib::ffi::gpointer,
212 f: glib::ffi::gpointer,
213 ) {
214 unsafe {
215 let f: &F = &*(f as *const F);
216 f(&from_glib_borrow(this))
217 }
218 }
219 unsafe {
220 let f: Box_<F> = Box_::new(f);
221 connect_raw(
222 self.as_ptr() as *mut _,
223 c"notify::input-mode-override".as_ptr(),
224 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
225 notify_input_mode_override_trampoline::<F> as *const (),
226 )),
227 Box_::into_raw(f),
228 )
229 }
230 }
231
232 #[doc(alias = "output-flags-override")]
233 pub fn connect_output_flags_override_notify<F: Fn(&Self) + Send + Sync + 'static>(
234 &self,
235 f: F,
236 ) -> SignalHandlerId {
237 unsafe extern "C" fn notify_output_flags_override_trampoline<
238 F: Fn(&GLViewConvert) + Send + Sync + 'static,
239 >(
240 this: *mut ffi::GstGLViewConvert,
241 _param_spec: glib::ffi::gpointer,
242 f: glib::ffi::gpointer,
243 ) {
244 unsafe {
245 let f: &F = &*(f as *const F);
246 f(&from_glib_borrow(this))
247 }
248 }
249 unsafe {
250 let f: Box_<F> = Box_::new(f);
251 connect_raw(
252 self.as_ptr() as *mut _,
253 c"notify::output-flags-override".as_ptr(),
254 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
255 notify_output_flags_override_trampoline::<F> as *const (),
256 )),
257 Box_::into_raw(f),
258 )
259 }
260 }
261
262 #[doc(alias = "output-mode-override")]
263 pub fn connect_output_mode_override_notify<F: Fn(&Self) + Send + Sync + 'static>(
264 &self,
265 f: F,
266 ) -> SignalHandlerId {
267 unsafe extern "C" fn notify_output_mode_override_trampoline<
268 F: Fn(&GLViewConvert) + Send + Sync + 'static,
269 >(
270 this: *mut ffi::GstGLViewConvert,
271 _param_spec: glib::ffi::gpointer,
272 f: glib::ffi::gpointer,
273 ) {
274 unsafe {
275 let f: &F = &*(f as *const F);
276 f(&from_glib_borrow(this))
277 }
278 }
279 unsafe {
280 let f: Box_<F> = Box_::new(f);
281 connect_raw(
282 self.as_ptr() as *mut _,
283 c"notify::output-mode-override".as_ptr(),
284 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
285 notify_output_mode_override_trampoline::<F> as *const (),
286 )),
287 Box_::into_raw(f),
288 )
289 }
290 }
291}
292
293impl Default for GLViewConvert {
294 fn default() -> Self {
295 Self::new()
296 }
297}
298
299unsafe impl Send for GLViewConvert {}
300unsafe impl Sync for GLViewConvert {}