gstreamer_vulkan/auto/
vulkan_full_screen_quad.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, VulkanCommandBuffer, VulkanFence, VulkanHandle, VulkanQueue};
7use glib::{prelude::*, translate::*};
8
9glib::wrapper! {
10    ///
11    ///
12    /// # Implements
13    ///
14    /// [`VulkanFullScreenQuadExt`][trait@crate::prelude::VulkanFullScreenQuadExt], [`trait@gst::prelude::ObjectExt`], [`trait@glib::ObjectExt`]
15    #[doc(alias = "GstVulkanFullScreenQuad")]
16    pub struct VulkanFullScreenQuad(Object<ffi::GstVulkanFullScreenQuad, ffi::GstVulkanFullScreenQuadClass>) @extends gst::Object;
17
18    match fn {
19        type_ => || ffi::gst_vulkan_full_screen_quad_get_type(),
20    }
21}
22
23impl VulkanFullScreenQuad {
24    pub const NONE: Option<&'static VulkanFullScreenQuad> = None;
25
26    /// ## `queue`
27    /// a [`VulkanQueue`][crate::VulkanQueue]
28    ///
29    /// # Returns
30    ///
31    /// a new [`VulkanFullScreenQuad`][crate::VulkanFullScreenQuad]
32    #[doc(alias = "gst_vulkan_full_screen_quad_new")]
33    pub fn new(queue: &impl IsA<VulkanQueue>) -> VulkanFullScreenQuad {
34        skip_assert_initialized!();
35        unsafe {
36            from_glib_full(ffi::gst_vulkan_full_screen_quad_new(
37                queue.as_ref().to_glib_none().0,
38            ))
39        }
40    }
41}
42
43unsafe impl Send for VulkanFullScreenQuad {}
44unsafe impl Sync for VulkanFullScreenQuad {}
45
46/// Trait containing all [`struct@VulkanFullScreenQuad`] methods.
47///
48/// # Implementors
49///
50/// [`VulkanFullScreenQuad`][struct@crate::VulkanFullScreenQuad]
51pub trait VulkanFullScreenQuadExt: IsA<VulkanFullScreenQuad> + 'static {
52    /// Helper function for creation and submission of a command buffer that draws
53    /// a full screen quad. If you need to add other things to the command buffer,
54    /// create the command buffer manually and call
55    /// [`prepare_draw()`][Self::prepare_draw()],
56    /// [`fill_command_buffer()`][Self::fill_command_buffer()] and
57    /// [`submit()`][Self::submit()] instead.
58    ///
59    /// # Returns
60    ///
61    /// whether the draw was successful
62    #[doc(alias = "gst_vulkan_full_screen_quad_draw")]
63    fn draw(&self) -> Result<(), glib::Error> {
64        unsafe {
65            let mut error = std::ptr::null_mut();
66            let is_ok =
67                ffi::gst_vulkan_full_screen_quad_draw(self.as_ref().to_glib_none().0, &mut error);
68            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
69            if error.is_null() {
70                Ok(())
71            } else {
72                Err(from_glib_full(error))
73            }
74        }
75    }
76
77    /// Enables blending of the input image to the output image.
78    ///
79    /// See also: `gst_vulkan_full_screen_quad_set_blend_operation()` and
80    /// `gst_vulkan_full_screen_quad_set_blend_factors()`.
81    /// ## `enable_blend`
82    /// whether to enable blending
83    #[doc(alias = "gst_vulkan_full_screen_quad_enable_blend")]
84    fn enable_blend(&self, enable_blend: bool) {
85        unsafe {
86            ffi::gst_vulkan_full_screen_quad_enable_blend(
87                self.as_ref().to_glib_none().0,
88                enable_blend.into_glib(),
89            );
90        }
91    }
92
93    /// ## `enable_clear`
94    /// whether to clear the framebuffer on load
95    #[doc(alias = "gst_vulkan_full_screen_quad_enable_clear")]
96    fn enable_clear(&self, enable_clear: bool) {
97        unsafe {
98            ffi::gst_vulkan_full_screen_quad_enable_clear(
99                self.as_ref().to_glib_none().0,
100                enable_clear.into_glib(),
101            );
102        }
103    }
104
105    /// `cmd` must be locked with `gst_vulkan_command_buffer_lock()`.
106    /// ## `cmd`
107    /// the [`VulkanCommandBuffer`][crate::VulkanCommandBuffer] to fill with commands
108    ///
109    /// # Returns
110    ///
111    /// whether `cmd` could be filled with the necessary commands
112    #[doc(alias = "gst_vulkan_full_screen_quad_fill_command_buffer")]
113    fn fill_command_buffer(
114        &self,
115        cmd: &mut VulkanCommandBuffer,
116        fence: &mut VulkanFence,
117    ) -> Result<(), glib::Error> {
118        unsafe {
119            let mut error = std::ptr::null_mut();
120            let is_ok = ffi::gst_vulkan_full_screen_quad_fill_command_buffer(
121                self.as_ref().to_glib_none().0,
122                cmd.to_glib_none_mut().0,
123                fence.to_glib_none_mut().0,
124                &mut error,
125            );
126            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
127            if error.is_null() {
128                Ok(())
129            } else {
130                Err(from_glib_full(error))
131            }
132        }
133    }
134
135    #[doc(alias = "gst_vulkan_full_screen_quad_get_last_fence")]
136    #[doc(alias = "get_last_fence")]
137    fn last_fence(&self) -> VulkanFence {
138        unsafe {
139            from_glib_full(ffi::gst_vulkan_full_screen_quad_get_last_fence(
140                self.as_ref().to_glib_none().0,
141            ))
142        }
143    }
144
145    ///
146    /// # Returns
147    ///
148    /// The currently configured
149    ///  [`VulkanQueue`][crate::VulkanQueue]
150    #[doc(alias = "gst_vulkan_full_screen_quad_get_queue")]
151    #[doc(alias = "get_queue")]
152    fn queue(&self) -> Option<VulkanQueue> {
153        unsafe {
154            from_glib_full(ffi::gst_vulkan_full_screen_quad_get_queue(
155                self.as_ref().to_glib_none().0,
156            ))
157        }
158    }
159
160    /// ## `fence`
161    /// a [`VulkanFence`][crate::VulkanFence] that will be signalled after submission
162    ///
163    /// # Returns
164    ///
165    /// whether the necessary information could be generated for drawing a
166    /// frame.
167    #[doc(alias = "gst_vulkan_full_screen_quad_prepare_draw")]
168    fn prepare_draw(&self, fence: &mut VulkanFence) -> Result<(), glib::Error> {
169        unsafe {
170            let mut error = std::ptr::null_mut();
171            let is_ok = ffi::gst_vulkan_full_screen_quad_prepare_draw(
172                self.as_ref().to_glib_none().0,
173                fence.to_glib_none_mut().0,
174                &mut error,
175            );
176            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
177            if error.is_null() {
178                Ok(())
179            } else {
180                Err(from_glib_full(error))
181            }
182        }
183    }
184
185    //#[doc(alias = "gst_vulkan_full_screen_quad_set_blend_factors")]
186    //fn set_blend_factors(&self, src_blend_factor: /*Ignored*/&vulkan::BlendFactor, dst_blend_factor: /*Ignored*/&vulkan::BlendFactor, src_alpha_blend_factor: /*Ignored*/&vulkan::BlendFactor, dst_alpha_blend_factor: /*Ignored*/&vulkan::BlendFactor) {
187    //    unsafe { TODO: call ffi:gst_vulkan_full_screen_quad_set_blend_factors() }
188    //}
189
190    //#[doc(alias = "gst_vulkan_full_screen_quad_set_blend_operation")]
191    //fn set_blend_operation(&self, colour_blend_op: /*Ignored*/&vulkan::BlendOp, alpha_blend_op: /*Ignored*/&vulkan::BlendOp) {
192    //    unsafe { TODO: call ffi:gst_vulkan_full_screen_quad_set_blend_operation() }
193    //}
194
195    /// See also [`set_vertex_buffer()`][Self::set_vertex_buffer()]
196    /// ## `indices`
197    /// the index data. Must be a `GstVulkanBufferMemory`
198    /// ## `n_indices`
199    /// number of indices in `indices`
200    ///
201    /// # Returns
202    ///
203    /// whether the index data could be set
204    #[doc(alias = "gst_vulkan_full_screen_quad_set_index_buffer")]
205    fn set_index_buffer(&self, indices: &gst::Memory, n_indices: usize) -> Result<(), glib::Error> {
206        unsafe {
207            let mut error = std::ptr::null_mut();
208            let is_ok = ffi::gst_vulkan_full_screen_quad_set_index_buffer(
209                self.as_ref().to_glib_none().0,
210                indices.to_glib_none().0,
211                n_indices,
212                &mut error,
213            );
214            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
215            if error.is_null() {
216                Ok(())
217            } else {
218                Err(from_glib_full(error))
219            }
220        }
221    }
222
223    /// ## `in_info`
224    /// the input [`gst_video::VideoInfo`][crate::gst_video::VideoInfo] to set
225    /// ## `out_info`
226    /// the output [`gst_video::VideoInfo`][crate::gst_video::VideoInfo] to set
227    ///
228    /// # Returns
229    ///
230    /// whether the information could be successfully set
231    #[doc(alias = "gst_vulkan_full_screen_quad_set_info")]
232    fn set_info(&self, in_info: &gst_video::VideoInfo, out_info: &gst_video::VideoInfo) -> bool {
233        unsafe {
234            from_glib(ffi::gst_vulkan_full_screen_quad_set_info(
235                self.as_ref().to_glib_none().0,
236                in_info.to_glib_none().0,
237                out_info.to_glib_none().0,
238            ))
239        }
240    }
241
242    /// ## `buffer`
243    /// the input [`gst::Buffer`][crate::gst::Buffer] to set
244    ///
245    /// # Returns
246    ///
247    /// whether the input buffer could be changed
248    #[doc(alias = "gst_vulkan_full_screen_quad_set_input_buffer")]
249    fn set_input_buffer(&self, buffer: Option<&gst::Buffer>) -> Result<(), glib::Error> {
250        unsafe {
251            let mut error = std::ptr::null_mut();
252            let is_ok = ffi::gst_vulkan_full_screen_quad_set_input_buffer(
253                self.as_ref().to_glib_none().0,
254                buffer.to_glib_none().0,
255                &mut error,
256            );
257            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
258            if error.is_null() {
259                Ok(())
260            } else {
261                Err(from_glib_full(error))
262            }
263        }
264    }
265
266    /// ## `buffer`
267    /// the output [`gst::Buffer`][crate::gst::Buffer] to set
268    ///
269    /// # Returns
270    ///
271    /// whether the input buffer could be changed
272    #[doc(alias = "gst_vulkan_full_screen_quad_set_output_buffer")]
273    fn set_output_buffer(&self, buffer: Option<&gst::Buffer>) -> Result<(), glib::Error> {
274        unsafe {
275            let mut error = std::ptr::null_mut();
276            let is_ok = ffi::gst_vulkan_full_screen_quad_set_output_buffer(
277                self.as_ref().to_glib_none().0,
278                buffer.to_glib_none().0,
279                &mut error,
280            );
281            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
282            if error.is_null() {
283                Ok(())
284            } else {
285                Err(from_glib_full(error))
286            }
287        }
288    }
289
290    /// ## `vert`
291    /// the vertex shader to set
292    /// ## `frag`
293    /// the fragment shader to set
294    ///
295    /// # Returns
296    ///
297    /// whether the shaders could be set
298    #[doc(alias = "gst_vulkan_full_screen_quad_set_shaders")]
299    fn set_shaders(&self, vert: &VulkanHandle, frag: &VulkanHandle) -> bool {
300        unsafe {
301            from_glib(ffi::gst_vulkan_full_screen_quad_set_shaders(
302                self.as_ref().to_glib_none().0,
303                vert.to_glib_none().0,
304                frag.to_glib_none().0,
305            ))
306        }
307    }
308
309    /// ## `uniforms`
310    /// the uniform data to set. Must be a `GstVulkanBufferMemory`
311    ///
312    /// # Returns
313    ///
314    /// whether the shaders could be set
315    #[doc(alias = "gst_vulkan_full_screen_quad_set_uniform_buffer")]
316    fn set_uniform_buffer(&self, uniforms: &gst::Memory) -> Result<(), glib::Error> {
317        unsafe {
318            let mut error = std::ptr::null_mut();
319            let is_ok = ffi::gst_vulkan_full_screen_quad_set_uniform_buffer(
320                self.as_ref().to_glib_none().0,
321                uniforms.to_glib_none().0,
322                &mut error,
323            );
324            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
325            if error.is_null() {
326                Ok(())
327            } else {
328                Err(from_glib_full(error))
329            }
330        }
331    }
332
333    /// ## `vertices`
334    /// the vertex data. Must be a `GstVulkanBufferMemory`
335    ///
336    /// # Returns
337    ///
338    /// whether the index data could be set
339    #[doc(alias = "gst_vulkan_full_screen_quad_set_vertex_buffer")]
340    fn set_vertex_buffer(&self, vertices: &gst::Memory) -> Result<(), glib::Error> {
341        unsafe {
342            let mut error = std::ptr::null_mut();
343            let is_ok = ffi::gst_vulkan_full_screen_quad_set_vertex_buffer(
344                self.as_ref().to_glib_none().0,
345                vertices.to_glib_none().0,
346                &mut error,
347            );
348            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
349            if error.is_null() {
350                Ok(())
351            } else {
352                Err(from_glib_full(error))
353            }
354        }
355    }
356
357    /// ## `cmd`
358    /// a [`VulkanCommandBuffer`][crate::VulkanCommandBuffer] to submit
359    /// ## `fence`
360    /// a [`VulkanFence`][crate::VulkanFence] to signal on completion
361    ///
362    /// # Returns
363    ///
364    /// whether `cmd` could be submitted to the queue
365    #[doc(alias = "gst_vulkan_full_screen_quad_submit")]
366    fn submit(&self, cmd: VulkanCommandBuffer, fence: &mut VulkanFence) -> Result<(), glib::Error> {
367        unsafe {
368            let mut error = std::ptr::null_mut();
369            let is_ok = ffi::gst_vulkan_full_screen_quad_submit(
370                self.as_ref().to_glib_none().0,
371                cmd.into_glib_ptr(),
372                fence.to_glib_none_mut().0,
373                &mut error,
374            );
375            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
376            if error.is_null() {
377                Ok(())
378            } else {
379                Err(from_glib_full(error))
380            }
381        }
382    }
383}
384
385impl<O: IsA<VulkanFullScreenQuad>> VulkanFullScreenQuadExt for O {}