From 608edfc4ad80ddbbaa62eb6e0bf880b0d553ba3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 13 May 2025 12:54:29 +0300 Subject: [PATCH] allocators: Manually bind `FdAllocator::alloc_full()` Part-of: --- gstreamer-allocators/Gir.toml | 3 +++ gstreamer-allocators/src/fd_allocator.rs | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/gstreamer-allocators/Gir.toml b/gstreamer-allocators/Gir.toml index 8aed7e4c1..a62e74aa5 100644 --- a/gstreamer-allocators/Gir.toml +++ b/gstreamer-allocators/Gir.toml @@ -94,6 +94,9 @@ status = "generate" [[object.function]] name = "alloc" manual = true + [[object.function]] + name = "alloc_full" + manual = true [[object]] name = "GstAllocators.ShmAllocator" diff --git a/gstreamer-allocators/src/fd_allocator.rs b/gstreamer-allocators/src/fd_allocator.rs index af9b645ec..61a6a64d5 100644 --- a/gstreamer-allocators/src/fd_allocator.rs +++ b/gstreamer-allocators/src/fd_allocator.rs @@ -61,4 +61,28 @@ impl FdAllocator { )) .ok_or_else(|| glib::bool_error!("Failed to allocate memory")) } + + #[cfg(feature = "v1_28")] + #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))] + #[doc(alias = "gst_fd_allocator_alloc_full")] + pub unsafe fn alloc_full( + allocator: &impl IsA, + fd: RawFd, + maxsize: usize, + offset: usize, + size: usize, + flags: FdMemoryFlags, + ) -> Option { + assert_initialized_main_thread!(); + unsafe { + from_glib_full(ffi::gst_fd_allocator_alloc_full( + allocator.as_ref().to_glib_none().0, + fd, + maxsize, + offset, + size, + flags.into_glib(), + )) + } + } }