gstreamer_vulkan/auto/
vulkan_trash.rs1use crate::{VulkanDevice, VulkanFence, ffi};
7use glib::translate::*;
8use std::boxed::Box as Box_;
9
10glib::wrapper! {
11 #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
12 pub struct VulkanTrash(Boxed<ffi::GstVulkanTrash>);
13
14 match fn {
15 copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::gst_vulkan_trash_get_type(), ptr as *mut _) as *mut ffi::GstVulkanTrash,
16 free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::gst_vulkan_trash_get_type(), ptr as *mut _),
17 type_ => || ffi::gst_vulkan_trash_get_type(),
18 }
19}
20
21impl VulkanTrash {
22 #[doc(alias = "gst_vulkan_trash_new")]
23 pub fn new<P: FnOnce(&VulkanDevice) + Send + Sync + 'static>(
24 fence: &mut VulkanFence,
25 notify: P,
26 ) -> VulkanTrash {
27 assert_initialized_main_thread!();
28 let notify_data: Box_<P> = Box_::new(notify);
29 unsafe extern "C" fn notify_func<P: FnOnce(&VulkanDevice) + Send + Sync + 'static>(
30 device: *mut ffi::GstVulkanDevice,
31 user_data: glib::ffi::gpointer,
32 ) {
33 unsafe {
34 let device = from_glib_borrow(device);
35 let callback = Box_::from_raw(user_data as *mut P);
36 (*callback)(&device)
37 }
38 }
39 let notify = Some(notify_func::<P> as _);
40 let super_callback0: Box_<P> = notify_data;
41 unsafe {
42 from_glib_full(ffi::gst_vulkan_trash_new(
43 fence.to_glib_none_mut().0,
44 notify,
45 Box_::into_raw(super_callback0) as *mut _,
46 ))
47 }
48 }
49
50 }
65
66unsafe impl Send for VulkanTrash {}
67unsafe impl Sync for VulkanTrash {}