gstreamer_vulkan/auto/vulkan_operation.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};
7use glib::{prelude::*, translate::*};
8
9glib::wrapper! {
10 /// When using the operation `cmd_buf`, you should lock it using
11 /// `gst_vulkan_command_buffer_lock()`, but you have to unlock it, with
12 /// `gst_vulkan_command_buffer_unlock()`, when calling any of [`VulkanOperation`][crate::VulkanOperation]
13 /// methods.
14 ///
15 /// ## Properties
16 ///
17 ///
18 /// #### `command-pool`
19 /// Readable | Writeable | Construct Only
20 /// <details><summary><h4>Object</h4></summary>
21 ///
22 ///
23 /// #### `name`
24 /// Readable | Writeable | Construct
25 ///
26 ///
27 /// #### `parent`
28 /// The parent of the object. Please note, that when changing the 'parent'
29 /// property, we don't emit [`notify`][struct@crate::glib::Object#notify] and [`deep-notify`][struct@crate::gst::Object#deep-notify]
30 /// signals due to locking issues. In some cases one can use
31 /// `GstBin::element-added` or `GstBin::element-removed` signals on the parent to
32 /// achieve a similar effect.
33 ///
34 /// Readable | Writeable
35 /// </details>
36 ///
37 /// # Implements
38 ///
39 /// [`VulkanOperationExt`][trait@crate::prelude::VulkanOperationExt], [`trait@gst::prelude::ObjectExt`], [`trait@glib::ObjectExt`]
40 #[doc(alias = "GstVulkanOperation")]
41 pub struct VulkanOperation(Object<ffi::GstVulkanOperation, ffi::GstVulkanOperationClass>) @extends gst::Object;
42
43 match fn {
44 type_ => || ffi::gst_vulkan_operation_get_type(),
45 }
46}
47
48impl VulkanOperation {
49 pub const NONE: Option<&'static VulkanOperation> = None;
50
51 /// ## `cmd_pool`
52 /// a [`VulkanCommandPool`][crate::VulkanCommandPool]
53 ///
54 /// # Returns
55 ///
56 /// a newly allocated [`VulkanOperation`][crate::VulkanOperation]
57 #[doc(alias = "gst_vulkan_operation_new")]
58 pub fn new(cmd_pool: &impl IsA<VulkanCommandPool>) -> VulkanOperation {
59 skip_assert_initialized!();
60 unsafe {
61 from_glib_full(ffi::gst_vulkan_operation_new(
62 cmd_pool.as_ref().to_glib_none().0,
63 ))
64 }
65 }
66}
67
68unsafe impl Send for VulkanOperation {}
69unsafe impl Sync for VulkanOperation {}
70
71/// Trait containing all [`struct@VulkanOperation`] methods.
72///
73/// # Implementors
74///
75/// [`VulkanOperation`][struct@crate::VulkanOperation]
76pub trait VulkanOperationExt: IsA<VulkanOperation> + 'static {
77 /// Add `frame` as an operation dependency by adding the timeline semaphores in
78 /// each memory of `frame` into either the wait semaphore array. The signal array
79 /// hold the same semaphores but increasing their current value.
80 /// ## `frame`
81 /// a Vulkan Image [`gst::Buffer`][crate::gst::Buffer]
82 /// ## `wait_stage`
83 /// pipeline stage to wait (VkPipelineStageFlags or
84 /// VkPipelineStageFlags2)
85 /// ## `signal_stage`
86 /// pipeline stage to signal (VkPipelineStageFlags or
87 /// VkPipelineStageFlags2)
88 ///
89 /// # Returns
90 ///
91 /// whether the `frame` was added as dependency.
92 #[doc(alias = "gst_vulkan_operation_add_dependency_frame")]
93 fn add_dependency_frame(
94 &self,
95 frame: &gst::Buffer,
96 wait_stage: u64,
97 signal_stage: u64,
98 ) -> bool {
99 unsafe {
100 from_glib(ffi::gst_vulkan_operation_add_dependency_frame(
101 self.as_ref().to_glib_none().0,
102 frame.to_glib_none().0,
103 wait_stage,
104 signal_stage,
105 ))
106 }
107 }
108
109 //#[doc(alias = "gst_vulkan_operation_add_extra_image_barriers")]
110 //fn add_extra_image_barriers(&self, extra_barriers: /*Unknown conversion*//*Unimplemented*/Array TypeId { ns_id: 0, id: 25 }) {
111 // unsafe { TODO: call ffi:gst_vulkan_operation_add_extra_image_barriers() }
112 //}
113
114 //#[doc(alias = "gst_vulkan_operation_add_frame_barrier")]
115 //fn add_frame_barrier(&self, frame: &gst::Buffer, src_stage: u64, dst_stage: u64, new_access: u64, new_layout: /*Ignored*/&vulkan::ImageLayout, new_queue: Option<&impl IsA<VulkanQueue>>) -> bool {
116 // unsafe { TODO: call ffi:gst_vulkan_operation_add_frame_barrier() }
117 //}
118
119 //#[cfg(feature = "v1_26")]
120 //#[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
121 //#[doc(alias = "gst_vulkan_operation_begin_query")]
122 //fn begin_query(&self, base: /*Ignored*/&mut vulkan::BaseInStructure, id: u32) -> bool {
123 // unsafe { TODO: call ffi:gst_vulkan_operation_begin_query() }
124 //}
125
126 /// Discards barriers, and all the semaphore arrays populated by
127 /// [`add_dependency_frame()`][Self::add_dependency_frame()].
128 #[doc(alias = "gst_vulkan_operation_discard_dependencies")]
129 fn discard_dependencies(&self) {
130 unsafe {
131 ffi::gst_vulkan_operation_discard_dependencies(self.as_ref().to_glib_none().0);
132 }
133 }
134
135 //#[doc(alias = "gst_vulkan_operation_enable_query")]
136 //fn enable_query(&self, query_type: u32, n_queries: u32, pnext: /*Unimplemented*/Option<Basic: Pointer>) -> Result<(), glib::Error> {
137 // unsafe { TODO: call ffi:gst_vulkan_operation_enable_query() }
138 //}
139
140 /// Ends a query operation with `id` in the current command buffer. A query with
141 /// `id` has had started with `gst_vulkan_operation_begin_query()`
142 /// ## `id`
143 /// query id
144 ///
145 /// # Returns
146 ///
147 /// whether the end command was set
148 #[doc(alias = "gst_vulkan_operation_end_query")]
149 fn end_query(&self, id: u32) -> bool {
150 unsafe {
151 from_glib(ffi::gst_vulkan_operation_end_query(
152 self.as_ref().to_glib_none().0,
153 id,
154 ))
155 }
156 }
157
158 //#[doc(alias = "gst_vulkan_operation_get_query")]
159 //#[doc(alias = "get_query")]
160 //fn query(&self, data: /*Unimplemented*/&mut Option<Basic: Pointer>) -> Result<(), glib::Error> {
161 // unsafe { TODO: call ffi:gst_vulkan_operation_get_query() }
162 //}
163
164 //#[doc(alias = "gst_vulkan_operation_new_extra_image_barriers")]
165 //fn new_extra_image_barriers(&self) -> /*Unknown conversion*//*Unimplemented*/Array TypeId { ns_id: 0, id: 25 } {
166 // unsafe { TODO: call ffi:gst_vulkan_operation_new_extra_image_barriers() }
167 //}
168
169 //#[doc(alias = "gst_vulkan_operation_pipeline_barrier2")]
170 //fn pipeline_barrier2(&self, dependency_info: /*Unimplemented*/Option<Basic: Pointer>) -> bool {
171 // unsafe { TODO: call ffi:gst_vulkan_operation_pipeline_barrier2() }
172 //}
173
174 /// Resets the operation to a clean state.
175 #[doc(alias = "gst_vulkan_operation_reset")]
176 fn reset(&self) {
177 unsafe {
178 ffi::gst_vulkan_operation_reset(self.as_ref().to_glib_none().0);
179 }
180 }
181
182 //#[doc(alias = "gst_vulkan_operation_retrieve_image_barriers")]
183 //fn retrieve_image_barriers(&self) -> /*Unknown conversion*//*Unimplemented*/Array TypeId { ns_id: 0, id: 25 } {
184 // unsafe { TODO: call ffi:gst_vulkan_operation_retrieve_image_barriers() }
185 //}
186
187 //#[doc(alias = "gst_vulkan_operation_update_frame")]
188 //fn update_frame(&self, frame: &gst::Buffer, dst_stage: u64, new_access: u64, new_layout: /*Ignored*/&vulkan::ImageLayout, new_queue: Option<&impl IsA<VulkanQueue>>) {
189 // unsafe { TODO: call ffi:gst_vulkan_operation_update_frame() }
190 //}
191
192 ///
193 /// # Returns
194 ///
195 /// whether the operations are using synchronization2 extension.
196 #[doc(alias = "gst_vulkan_operation_use_sync2")]
197 fn use_sync2(&self) -> bool {
198 unsafe {
199 from_glib(ffi::gst_vulkan_operation_use_sync2(
200 self.as_ref().to_glib_none().0,
201 ))
202 }
203 }
204
205 /// Waits for the operation's fence to signal.
206 ///
207 /// # Returns
208 ///
209 /// whether the operation succeed.
210 #[doc(alias = "gst_vulkan_operation_wait")]
211 fn wait(&self) -> bool {
212 unsafe {
213 from_glib(ffi::gst_vulkan_operation_wait(
214 self.as_ref().to_glib_none().0,
215 ))
216 }
217 }
218
219 #[doc(alias = "command-pool")]
220 fn command_pool(&self) -> Option<VulkanCommandPool> {
221 ObjectExt::property(self.as_ref(), "command-pool")
222 }
223}
224
225impl<O: IsA<VulkanOperation>> VulkanOperationExt for O {}