Skip to main content

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::{VulkanCommandPool, VulkanDevice, ffi};
7use glib::{prelude::*, translate::*};
8
9glib::wrapper! {
10    #[doc(alias = "GstVulkanQueue")]
11    pub struct VulkanQueue(Object<ffi::GstVulkanQueue, ffi::GstVulkanQueueClass>) @extends gst::Object;
12
13    match fn {
14        type_ => || ffi::gst_vulkan_queue_get_type(),
15    }
16}
17
18impl VulkanQueue {
19    pub const NONE: Option<&'static VulkanQueue> = None;
20
21    //#[doc(alias = "gst_vulkan_queue_flags_to_string")]
22    //pub fn flags_to_string(queue_bits: /*Ignored*/&vulkan::QueueFlags) -> glib::GString {
23    //    unsafe { TODO: call ffi:gst_vulkan_queue_flags_to_string() }
24    //}
25
26    #[doc(alias = "gst_vulkan_queue_handle_context_query")]
27    pub fn handle_context_query(
28        element: &impl IsA<gst::Element>,
29        query: &gst::Query,
30        queue: Option<&impl IsA<VulkanQueue>>,
31    ) -> bool {
32        assert_initialized_main_thread!();
33        unsafe {
34            from_glib(ffi::gst_vulkan_queue_handle_context_query(
35                element.as_ref().to_glib_none().0,
36                query.to_glib_none().0,
37                queue.map(|p| p.as_ref()).to_glib_none().0,
38            ))
39        }
40    }
41
42    //#[doc(alias = "gst_vulkan_queue_run_context_query")]
43    //pub fn run_context_query(element: &impl IsA<gst::Element>, queue: impl IsA<VulkanQueue>) -> bool {
44    //    unsafe { TODO: call ffi:gst_vulkan_queue_run_context_query() }
45    //}
46}
47
48unsafe impl Send for VulkanQueue {}
49unsafe impl Sync for VulkanQueue {}
50
51pub trait VulkanQueueExt: IsA<VulkanQueue> + 'static {
52    #[doc(alias = "gst_vulkan_queue_create_command_pool")]
53    fn create_command_pool(&self) -> Result<VulkanCommandPool, glib::Error> {
54        unsafe {
55            let mut error = std::ptr::null_mut();
56            let ret = ffi::gst_vulkan_queue_create_command_pool(
57                self.as_ref().to_glib_none().0,
58                &mut error,
59            );
60            if error.is_null() {
61                Ok(from_glib_full(ret))
62            } else {
63                Err(from_glib_full(error))
64            }
65        }
66    }
67
68    #[doc(alias = "gst_vulkan_queue_get_device")]
69    #[doc(alias = "get_device")]
70    fn device(&self) -> Option<VulkanDevice> {
71        unsafe {
72            from_glib_full(ffi::gst_vulkan_queue_get_device(
73                self.as_ref().to_glib_none().0,
74            ))
75        }
76    }
77}
78
79impl<O: IsA<VulkanQueue>> VulkanQueueExt for O {}