Skip to main content

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::{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    /// 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            unsafe {
44                let device = from_glib_borrow(device);
45                let callback = Box_::from_raw(user_data as *mut P);
46                (*callback)(&device)
47            }
48        }
49        let notify = Some(notify_func::<P> as _);
50        let super_callback0: Box_<P> = notify_data;
51        unsafe {
52            from_glib_full(ffi::gst_vulkan_trash_new(
53                fence.to_glib_none_mut().0,
54                notify,
55                Box_::into_raw(super_callback0) as *mut _,
56            ))
57        }
58    }
59
60    //#[doc(alias = "gst_vulkan_trash_new_free_semaphore")]
61    //pub fn new_free_semaphore(fence: &mut VulkanFence, semaphore: /*Ignored*/&vulkan::Semaphore) -> VulkanTrash {
62    //    unsafe { TODO: call ffi:gst_vulkan_trash_new_free_semaphore() }
63    //}
64
65    //#[doc(alias = "gst_vulkan_trash_mini_object_unref")]
66    //pub fn mini_object_unref(device: &impl IsA<VulkanDevice>, user_data: /*Unimplemented*/Option<Basic: Pointer>) {
67    //    unsafe { TODO: call ffi:gst_vulkan_trash_mini_object_unref() }
68    //}
69
70    //#[doc(alias = "gst_vulkan_trash_object_unref")]
71    //pub fn object_unref(device: &impl IsA<VulkanDevice>, user_data: /*Unimplemented*/Option<Basic: Pointer>) {
72    //    unsafe { TODO: call ffi:gst_vulkan_trash_object_unref() }
73    //}
74}
75
76unsafe impl Send for VulkanTrash {}
77unsafe impl Sync for VulkanTrash {}