gstreamer_vulkan/auto/
vulkan_queue.rs1use 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_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 }
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 {}