gstreamer_vulkan/vulkan_queue.rs
1use crate::VulkanQueue;
2use crate::ffi;
3
4use glib::{prelude::*, translate::*};
5
6// rustdoc-stripper-ignore-next
7/// Represents a locked vulkan queue that can be submitted too. The queue is unlock when this struct is dropped.
8#[derive(Debug)]
9pub struct VulkanQueueSubmitGuard<'a> {
10 obj: &'a VulkanQueue,
11}
12
13impl Drop for VulkanQueueSubmitGuard<'_> {
14 fn drop(&mut self) {
15 unsafe {
16 ffi::gst_vulkan_queue_submit_unlock(self.obj.to_glib_none().0);
17 }
18 }
19}
20impl PartialEq for VulkanQueueSubmitGuard<'_> {
21 fn eq(&self, other: &Self) -> bool {
22 self.obj == other.obj
23 }
24}
25impl Eq for VulkanQueueSubmitGuard<'_> {}
26
27pub trait VulkanQueueExtManual: IsA<VulkanQueue> + 'static {
28 // rustdoc-stripper-ignore-next
29 /// Locks the vulkan queue for submission. A struct similar to `MutexGuard` is retured that unlocks the queue once dropped.
30 #[doc(alias = "gst_vulkan_queue_submit_lock")]
31 fn submit_lock<'a>(&'a self) -> VulkanQueueSubmitGuard<'a> {
32 unsafe {
33 ffi::gst_vulkan_queue_submit_lock(self.as_ref().to_glib_none().0);
34 }
35 VulkanQueueSubmitGuard {
36 obj: self.upcast_ref(),
37 }
38 }
39}
40impl<O: IsA<VulkanQueue>> VulkanQueueExtManual for O {}