gstreamer_vulkan/auto/vulkan_trash.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, VulkanDevice, VulkanFence};
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    /// Create and return a new [`VulkanTrash`][crate::VulkanTrash] object that will stores a callback
23    /// to call when `fence` is signalled.
24    /// ## `fence`
25    /// a [`VulkanFence`][crate::VulkanFence]
26    /// ## `notify`
27    /// a `GstVulkanTrashNotify`
28    ///
29    /// # Returns
30    ///
31    /// a new [`VulkanTrash`][crate::VulkanTrash]
32    #[doc(alias = "gst_vulkan_trash_new")]
33    pub fn new<P: FnOnce(&VulkanDevice) + Send + Sync + 'static>(
34        fence: &mut VulkanFence,
35        notify: P,
36    ) -> VulkanTrash {
37        assert_initialized_main_thread!();
38        let notify_data: Box_<P> = Box_::new(notify);
39        unsafe extern "C" fn notify_func<P: FnOnce(&VulkanDevice) + Send + Sync + 'static>(
40            device: *mut ffi::GstVulkanDevice,
41            user_data: glib::ffi::gpointer,
42        ) {
43            let device = from_glib_borrow(device);
44            let callback = Box_::from_raw(user_data as *mut P);
45            (*callback)(&device)
46        }
47        let notify = Some(notify_func::<P> as _);
48        let super_callback0: Box_<P> = notify_data;
49        unsafe {
50            from_glib_full(ffi::gst_vulkan_trash_new(
51                fence.to_glib_none_mut().0,
52                notify,
53                Box_::into_raw(super_callback0) as *mut _,
54            ))
55        }
56    }
57
58    //#[doc(alias = "gst_vulkan_trash_new_free_semaphore")]
59    //pub fn new_free_semaphore(fence: &mut VulkanFence, semaphore: /*Ignored*/&vulkan::Semaphore) -> VulkanTrash {
60    //    unsafe { TODO: call ffi:gst_vulkan_trash_new_free_semaphore() }
61    //}
62
63    //#[doc(alias = "gst_vulkan_trash_mini_object_unref")]
64    //pub fn mini_object_unref(device: &impl IsA<VulkanDevice>, user_data: /*Unimplemented*/Option<Basic: Pointer>) {
65    //    unsafe { TODO: call ffi:gst_vulkan_trash_mini_object_unref() }
66    //}
67
68    //#[doc(alias = "gst_vulkan_trash_object_unref")]
69    //pub fn object_unref(device: &impl IsA<VulkanDevice>, user_data: /*Unimplemented*/Option<Basic: Pointer>) {
70    //    unsafe { TODO: call ffi:gst_vulkan_trash_object_unref() }
71    //}
72}
73
74unsafe impl Send for VulkanTrash {}
75unsafe impl Sync for VulkanTrash {}