gstreamer_vulkan/auto/vulkan_queue.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, VulkanCommandPool, VulkanDevice};
7use glib::{prelude::*, translate::*};
8
9glib::wrapper! {
10    ///
11    ///
12    /// # Implements
13    ///
14    /// [`VulkanQueueExt`][trait@crate::prelude::VulkanQueueExt], [`trait@gst::prelude::ObjectExt`], [`trait@glib::ObjectExt`]
15    #[doc(alias = "GstVulkanQueue")]
16    pub struct VulkanQueue(Object<ffi::GstVulkanQueue, ffi::GstVulkanQueueClass>) @extends gst::Object;
17
18    match fn {
19        type_ => || ffi::gst_vulkan_queue_get_type(),
20    }
21}
22
23impl VulkanQueue {
24    pub const NONE: Option<&'static VulkanQueue> = None;
25
26    //#[doc(alias = "gst_vulkan_queue_flags_to_string")]
27    //pub fn flags_to_string(queue_bits: /*Ignored*/&vulkan::QueueFlags) -> glib::GString {
28    //    unsafe { TODO: call ffi:gst_vulkan_queue_flags_to_string() }
29    //}
30
31    /// If a [`VulkanQueue`][crate::VulkanQueue] is requested in `query`, sets `queue` as the reply.
32    ///
33    /// Intended for use with element query handlers to respond to `GST_QUERY_CONTEXT`
34    /// for a [`VulkanQueue`][crate::VulkanQueue].
35    /// ## `element`
36    /// a [`gst::Element`][crate::gst::Element]
37    /// ## `query`
38    /// a [`gst::Query`][crate::gst::Query] of type `GST_QUERY_CONTEXT`
39    /// ## `queue`
40    /// the [`VulkanQueue`][crate::VulkanQueue]
41    ///
42    /// # Returns
43    ///
44    /// whether `query` was responded to with `queue`
45    #[doc(alias = "gst_vulkan_queue_handle_context_query")]
46    pub fn handle_context_query(
47        element: &impl IsA<gst::Element>,
48        query: &gst::Query,
49        queue: Option<&impl IsA<VulkanQueue>>,
50    ) -> bool {
51        assert_initialized_main_thread!();
52        unsafe {
53            from_glib(ffi::gst_vulkan_queue_handle_context_query(
54                element.as_ref().to_glib_none().0,
55                query.to_glib_none().0,
56                queue.map(|p| p.as_ref()).to_glib_none().0,
57            ))
58        }
59    }
60
61    //#[doc(alias = "gst_vulkan_queue_run_context_query")]
62    //pub fn run_context_query(element: &impl IsA<gst::Element>, queue: impl IsA<VulkanQueue>) -> bool {
63    //    unsafe { TODO: call ffi:gst_vulkan_queue_run_context_query() }
64    //}
65}
66
67unsafe impl Send for VulkanQueue {}
68unsafe impl Sync for VulkanQueue {}
69
70/// Trait containing all [`struct@VulkanQueue`] methods.
71///
72/// # Implementors
73///
74/// [`VulkanQueue`][struct@crate::VulkanQueue]
75pub trait VulkanQueueExt: IsA<VulkanQueue> + 'static {
76    ///
77    /// # Returns
78    ///
79    /// a new [`VulkanCommandPool`][crate::VulkanCommandPool] or [`None`]
80    #[doc(alias = "gst_vulkan_queue_create_command_pool")]
81    fn create_command_pool(&self) -> Result<VulkanCommandPool, glib::Error> {
82        unsafe {
83            let mut error = std::ptr::null_mut();
84            let ret = ffi::gst_vulkan_queue_create_command_pool(
85                self.as_ref().to_glib_none().0,
86                &mut error,
87            );
88            if error.is_null() {
89                Ok(from_glib_full(ret))
90            } else {
91                Err(from_glib_full(error))
92            }
93        }
94    }
95
96    ///
97    /// # Returns
98    ///
99    /// the [`VulkanDevice`][crate::VulkanDevice] for `self`
100    #[doc(alias = "gst_vulkan_queue_get_device")]
101    #[doc(alias = "get_device")]
102    fn device(&self) -> Option<VulkanDevice> {
103        unsafe {
104            from_glib_full(ffi::gst_vulkan_queue_get_device(
105                self.as_ref().to_glib_none().0,
106            ))
107        }
108    }
109}
110
111impl<O: IsA<VulkanQueue>> VulkanQueueExt for O {}