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")]
59 pub struct GLViewConvert(Object<ffi::GstGLViewConvert, ffi::GstGLViewConvertClass>) @extends gst::Object;
60
61 match fn {
62 type_ => || ffi::gst_gl_view_convert_get_type(),
63 }
64}
65
66impl GLViewConvert {
67 #[doc(alias = "gst_gl_view_convert_new")]
72 pub fn new() -> GLViewConvert {
73 assert_initialized_main_thread!();
74 unsafe { from_glib_full(ffi::gst_gl_view_convert_new()) }
75 }
76
77 #[doc(alias = "gst_gl_view_convert_perform")]
86 pub fn perform(&self, inbuf: &gst::Buffer) -> Option<gst::Buffer> {
87 unsafe {
88 from_glib_full(ffi::gst_gl_view_convert_perform(
89 self.to_glib_none().0,
90 inbuf.to_glib_none().0,
91 ))
92 }
93 }
94
95 #[doc(alias = "gst_gl_view_convert_reset")]
98 pub fn reset(&self) {
99 unsafe {
100 ffi::gst_gl_view_convert_reset(self.to_glib_none().0);
101 }
102 }
103
104 #[doc(alias = "gst_gl_view_convert_set_caps")]
110 pub fn set_caps(
111 &self,
112 in_caps: &gst::Caps,
113 out_caps: &gst::Caps,
114 ) -> Result<(), glib::error::BoolError> {
115 unsafe {
116 glib::result_from_gboolean!(
117 ffi::gst_gl_view_convert_set_caps(
118 self.to_glib_none().0,
119 in_caps.to_glib_none().0,
120 out_caps.to_glib_none().0
121 ),
122 "Failed to set caps"
123 )
124 }
125 }
126
127 #[doc(alias = "gst_gl_view_convert_set_context")]
131 pub fn set_context(&self, context: &impl IsA<GLContext>) {
132 unsafe {
133 ffi::gst_gl_view_convert_set_context(
134 self.to_glib_none().0,
135 context.as_ref().to_glib_none().0,
136 );
137 }
138 }
139
140 #[doc(alias = "gst_gl_view_convert_transform_caps")]
152 pub fn transform_caps(
153 &self,
154 direction: gst::PadDirection,
155 caps: &gst::Caps,
156 filter: &gst::Caps,
157 ) -> gst::Caps {
158 unsafe {
159 from_glib_full(ffi::gst_gl_view_convert_transform_caps(
160 self.to_glib_none().0,
161 direction.into_glib(),
162 caps.to_glib_none().0,
163 filter.to_glib_none().0,
164 ))
165 }
166 }
167
168 #[doc(alias = "downmix-mode")]
169 pub fn downmix_mode(&self) -> GLStereoDownmix {
170 ObjectExt::property(self, "downmix-mode")
171 }
172
173 #[doc(alias = "downmix-mode")]
174 pub fn set_downmix_mode(&self, downmix_mode: GLStereoDownmix) {
175 ObjectExt::set_property(self, "downmix-mode", downmix_mode)
176 }
177
178 #[doc(alias = "input-flags-override")]
179 pub fn input_flags_override(&self) -> gst_video::VideoMultiviewFlags {
180 ObjectExt::property(self, "input-flags-override")
181 }
182
183 #[doc(alias = "input-flags-override")]
184 pub fn set_input_flags_override(&self, input_flags_override: gst_video::VideoMultiviewFlags) {
185 ObjectExt::set_property(self, "input-flags-override", input_flags_override)
186 }
187
188 #[doc(alias = "input-mode-override")]
189 pub fn input_mode_override(&self) -> gst_video::VideoMultiviewMode {
190 ObjectExt::property(self, "input-mode-override")
191 }
192
193 #[doc(alias = "input-mode-override")]
194 pub fn set_input_mode_override(&self, input_mode_override: gst_video::VideoMultiviewMode) {
195 ObjectExt::set_property(self, "input-mode-override", input_mode_override)
196 }
197
198 #[doc(alias = "output-flags-override")]
199 pub fn output_flags_override(&self) -> gst_video::VideoMultiviewFlags {
200 ObjectExt::property(self, "output-flags-override")
201 }
202
203 #[doc(alias = "output-flags-override")]
204 pub fn set_output_flags_override(&self, output_flags_override: gst_video::VideoMultiviewFlags) {
205 ObjectExt::set_property(self, "output-flags-override", output_flags_override)
206 }
207
208 #[doc(alias = "output-mode-override")]
209 pub fn output_mode_override(&self) -> gst_video::VideoMultiviewMode {
210 ObjectExt::property(self, "output-mode-override")
211 }
212
213 #[doc(alias = "output-mode-override")]
214 pub fn set_output_mode_override(&self, output_mode_override: gst_video::VideoMultiviewMode) {
215 ObjectExt::set_property(self, "output-mode-override", output_mode_override)
216 }
217
218 #[doc(alias = "downmix-mode")]
219 pub fn connect_downmix_mode_notify<F: Fn(&Self) + Send + Sync + 'static>(
220 &self,
221 f: F,
222 ) -> SignalHandlerId {
223 unsafe extern "C" fn notify_downmix_mode_trampoline<
224 F: Fn(&GLViewConvert) + Send + Sync + 'static,
225 >(
226 this: *mut ffi::GstGLViewConvert,
227 _param_spec: glib::ffi::gpointer,
228 f: glib::ffi::gpointer,
229 ) {
230 unsafe {
231 let f: &F = &*(f as *const F);
232 f(&from_glib_borrow(this))
233 }
234 }
235 unsafe {
236 let f: Box_<F> = Box_::new(f);
237 connect_raw(
238 self.as_ptr() as *mut _,
239 c"notify::downmix-mode".as_ptr(),
240 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
241 notify_downmix_mode_trampoline::<F> as *const (),
242 )),
243 Box_::into_raw(f),
244 )
245 }
246 }
247
248 #[doc(alias = "input-flags-override")]
249 pub fn connect_input_flags_override_notify<F: Fn(&Self) + Send + Sync + 'static>(
250 &self,
251 f: F,
252 ) -> SignalHandlerId {
253 unsafe extern "C" fn notify_input_flags_override_trampoline<
254 F: Fn(&GLViewConvert) + Send + Sync + 'static,
255 >(
256 this: *mut ffi::GstGLViewConvert,
257 _param_spec: glib::ffi::gpointer,
258 f: glib::ffi::gpointer,
259 ) {
260 unsafe {
261 let f: &F = &*(f as *const F);
262 f(&from_glib_borrow(this))
263 }
264 }
265 unsafe {
266 let f: Box_<F> = Box_::new(f);
267 connect_raw(
268 self.as_ptr() as *mut _,
269 c"notify::input-flags-override".as_ptr(),
270 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
271 notify_input_flags_override_trampoline::<F> as *const (),
272 )),
273 Box_::into_raw(f),
274 )
275 }
276 }
277
278 #[doc(alias = "input-mode-override")]
279 pub fn connect_input_mode_override_notify<F: Fn(&Self) + Send + Sync + 'static>(
280 &self,
281 f: F,
282 ) -> SignalHandlerId {
283 unsafe extern "C" fn notify_input_mode_override_trampoline<
284 F: Fn(&GLViewConvert) + Send + Sync + 'static,
285 >(
286 this: *mut ffi::GstGLViewConvert,
287 _param_spec: glib::ffi::gpointer,
288 f: glib::ffi::gpointer,
289 ) {
290 unsafe {
291 let f: &F = &*(f as *const F);
292 f(&from_glib_borrow(this))
293 }
294 }
295 unsafe {
296 let f: Box_<F> = Box_::new(f);
297 connect_raw(
298 self.as_ptr() as *mut _,
299 c"notify::input-mode-override".as_ptr(),
300 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
301 notify_input_mode_override_trampoline::<F> as *const (),
302 )),
303 Box_::into_raw(f),
304 )
305 }
306 }
307
308 #[doc(alias = "output-flags-override")]
309 pub fn connect_output_flags_override_notify<F: Fn(&Self) + Send + Sync + 'static>(
310 &self,
311 f: F,
312 ) -> SignalHandlerId {
313 unsafe extern "C" fn notify_output_flags_override_trampoline<
314 F: Fn(&GLViewConvert) + Send + Sync + 'static,
315 >(
316 this: *mut ffi::GstGLViewConvert,
317 _param_spec: glib::ffi::gpointer,
318 f: glib::ffi::gpointer,
319 ) {
320 unsafe {
321 let f: &F = &*(f as *const F);
322 f(&from_glib_borrow(this))
323 }
324 }
325 unsafe {
326 let f: Box_<F> = Box_::new(f);
327 connect_raw(
328 self.as_ptr() as *mut _,
329 c"notify::output-flags-override".as_ptr(),
330 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
331 notify_output_flags_override_trampoline::<F> as *const (),
332 )),
333 Box_::into_raw(f),
334 )
335 }
336 }
337
338 #[doc(alias = "output-mode-override")]
339 pub fn connect_output_mode_override_notify<F: Fn(&Self) + Send + Sync + 'static>(
340 &self,
341 f: F,
342 ) -> SignalHandlerId {
343 unsafe extern "C" fn notify_output_mode_override_trampoline<
344 F: Fn(&GLViewConvert) + Send + Sync + 'static,
345 >(
346 this: *mut ffi::GstGLViewConvert,
347 _param_spec: glib::ffi::gpointer,
348 f: glib::ffi::gpointer,
349 ) {
350 unsafe {
351 let f: &F = &*(f as *const F);
352 f(&from_glib_borrow(this))
353 }
354 }
355 unsafe {
356 let f: Box_<F> = Box_::new(f);
357 connect_raw(
358 self.as_ptr() as *mut _,
359 c"notify::output-mode-override".as_ptr(),
360 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
361 notify_output_mode_override_trampoline::<F> as *const (),
362 )),
363 Box_::into_raw(f),
364 )
365 }
366 }
367}
368
369impl Default for GLViewConvert {
370 fn default() -> Self {
371 Self::new()
372 }
373}
374
375unsafe impl Send for GLViewConvert {}
376unsafe impl Sync for GLViewConvert {}