gstreamer_gl/auto/
gl_view_convert.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
4// DO NOT EDIT
5
6use crate::{ffi, GLContext, GLStereoDownmix};
7use glib::{
8    prelude::*,
9    signal::{connect_raw, SignalHandlerId},
10    translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15    /// Convert stereoscopic/multiview video using fragment shaders.
16    ///
17    /// ## Properties
18    ///
19    ///
20    /// #### `downmix-mode`
21    ///  Readable | Writeable
22    ///
23    ///
24    /// #### `input-flags-override`
25    ///  Readable | Writeable
26    ///
27    ///
28    /// #### `input-mode-override`
29    ///  Readable | Writeable
30    ///
31    ///
32    /// #### `output-flags-override`
33    ///  Readable | Writeable
34    ///
35    ///
36    /// #### `output-mode-override`
37    ///  Readable | Writeable
38    /// <details><summary><h4>Object</h4></summary>
39    ///
40    ///
41    /// #### `name`
42    ///  Readable | Writeable | Construct
43    ///
44    ///
45    /// #### `parent`
46    ///  The parent of the object. Please note, that when changing the 'parent'
47    /// property, we don't emit [`notify`][struct@crate::glib::Object#notify] and [`deep-notify`][struct@crate::gst::Object#deep-notify]
48    /// signals due to locking issues. In some cases one can use
49    /// `GstBin::element-added` or `GstBin::element-removed` signals on the parent to
50    /// achieve a similar effect.
51    ///
52    /// Readable | Writeable
53    /// </details>
54    ///
55    /// # Implements
56    ///
57    /// [`trait@gst::prelude::ObjectExt`], [`trait@glib::ObjectExt`]
58    #[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    ///
68    /// # Returns
69    ///
70    /// a new [`GLViewConvert`][crate::GLViewConvert]
71    #[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    /// Converts the data contained by `inbuf` using the formats specified by the
78    /// [`gst::Caps`][crate::gst::Caps] passed to [`set_caps()`][Self::set_caps()]
79    /// ## `inbuf`
80    /// the [`GLMemory`][crate::GLMemory] filled [`gst::Buffer`][crate::gst::Buffer] to convert
81    ///
82    /// # Returns
83    ///
84    /// a converted [`gst::Buffer`][crate::gst::Buffer] or [`None`]
85    #[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    /// Reset `self` to the default state. Further operation will require
96    /// setting the caps with [`set_caps()`][Self::set_caps()].
97    #[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    /// Initializes `self` with the information required for conversion.
105    /// ## `in_caps`
106    /// input [`gst::Caps`][crate::gst::Caps]
107    /// ## `out_caps`
108    /// output [`gst::Caps`][crate::gst::Caps]
109    #[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    /// Set `context` on `self`
128    /// ## `context`
129    /// the [`GLContext`][crate::GLContext] to set
130    #[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    /// Provides an implementation of `GstBaseTransformClass.transform_caps()`
141    /// ## `direction`
142    /// a [`gst::PadDirection`][crate::gst::PadDirection]
143    /// ## `caps`
144    /// the [`gst::Caps`][crate::gst::Caps] to transform
145    /// ## `filter`
146    /// a set of filter [`gst::Caps`][crate::gst::Caps]
147    ///
148    /// # Returns
149    ///
150    /// the converted [`gst::Caps`][crate::gst::Caps]
151    #[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            let f: &F = &*(f as *const F);
231            f(&from_glib_borrow(this))
232        }
233        unsafe {
234            let f: Box_<F> = Box_::new(f);
235            connect_raw(
236                self.as_ptr() as *mut _,
237                c"notify::downmix-mode".as_ptr() as *const _,
238                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
239                    notify_downmix_mode_trampoline::<F> as *const (),
240                )),
241                Box_::into_raw(f),
242            )
243        }
244    }
245
246    #[doc(alias = "input-flags-override")]
247    pub fn connect_input_flags_override_notify<F: Fn(&Self) + Send + Sync + 'static>(
248        &self,
249        f: F,
250    ) -> SignalHandlerId {
251        unsafe extern "C" fn notify_input_flags_override_trampoline<
252            F: Fn(&GLViewConvert) + Send + Sync + 'static,
253        >(
254            this: *mut ffi::GstGLViewConvert,
255            _param_spec: glib::ffi::gpointer,
256            f: glib::ffi::gpointer,
257        ) {
258            let f: &F = &*(f as *const F);
259            f(&from_glib_borrow(this))
260        }
261        unsafe {
262            let f: Box_<F> = Box_::new(f);
263            connect_raw(
264                self.as_ptr() as *mut _,
265                c"notify::input-flags-override".as_ptr() as *const _,
266                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
267                    notify_input_flags_override_trampoline::<F> as *const (),
268                )),
269                Box_::into_raw(f),
270            )
271        }
272    }
273
274    #[doc(alias = "input-mode-override")]
275    pub fn connect_input_mode_override_notify<F: Fn(&Self) + Send + Sync + 'static>(
276        &self,
277        f: F,
278    ) -> SignalHandlerId {
279        unsafe extern "C" fn notify_input_mode_override_trampoline<
280            F: Fn(&GLViewConvert) + Send + Sync + 'static,
281        >(
282            this: *mut ffi::GstGLViewConvert,
283            _param_spec: glib::ffi::gpointer,
284            f: glib::ffi::gpointer,
285        ) {
286            let f: &F = &*(f as *const F);
287            f(&from_glib_borrow(this))
288        }
289        unsafe {
290            let f: Box_<F> = Box_::new(f);
291            connect_raw(
292                self.as_ptr() as *mut _,
293                c"notify::input-mode-override".as_ptr() as *const _,
294                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
295                    notify_input_mode_override_trampoline::<F> as *const (),
296                )),
297                Box_::into_raw(f),
298            )
299        }
300    }
301
302    #[doc(alias = "output-flags-override")]
303    pub fn connect_output_flags_override_notify<F: Fn(&Self) + Send + Sync + 'static>(
304        &self,
305        f: F,
306    ) -> SignalHandlerId {
307        unsafe extern "C" fn notify_output_flags_override_trampoline<
308            F: Fn(&GLViewConvert) + Send + Sync + 'static,
309        >(
310            this: *mut ffi::GstGLViewConvert,
311            _param_spec: glib::ffi::gpointer,
312            f: glib::ffi::gpointer,
313        ) {
314            let f: &F = &*(f as *const F);
315            f(&from_glib_borrow(this))
316        }
317        unsafe {
318            let f: Box_<F> = Box_::new(f);
319            connect_raw(
320                self.as_ptr() as *mut _,
321                c"notify::output-flags-override".as_ptr() as *const _,
322                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
323                    notify_output_flags_override_trampoline::<F> as *const (),
324                )),
325                Box_::into_raw(f),
326            )
327        }
328    }
329
330    #[doc(alias = "output-mode-override")]
331    pub fn connect_output_mode_override_notify<F: Fn(&Self) + Send + Sync + 'static>(
332        &self,
333        f: F,
334    ) -> SignalHandlerId {
335        unsafe extern "C" fn notify_output_mode_override_trampoline<
336            F: Fn(&GLViewConvert) + Send + Sync + 'static,
337        >(
338            this: *mut ffi::GstGLViewConvert,
339            _param_spec: glib::ffi::gpointer,
340            f: glib::ffi::gpointer,
341        ) {
342            let f: &F = &*(f as *const F);
343            f(&from_glib_borrow(this))
344        }
345        unsafe {
346            let f: Box_<F> = Box_::new(f);
347            connect_raw(
348                self.as_ptr() as *mut _,
349                c"notify::output-mode-override".as_ptr() as *const _,
350                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
351                    notify_output_mode_override_trampoline::<F> as *const (),
352                )),
353                Box_::into_raw(f),
354            )
355        }
356    }
357}
358
359impl Default for GLViewConvert {
360    fn default() -> Self {
361        Self::new()
362    }
363}
364
365unsafe impl Send for GLViewConvert {}
366unsafe impl Sync for GLViewConvert {}