allocators: Manually bind FdAllocator::alloc_full()

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1729>
This commit is contained in:
Sebastian Dröge 2025-05-13 12:54:29 +03:00 committed by GStreamer Marge Bot
parent 20152b8579
commit 608edfc4ad
2 changed files with 27 additions and 0 deletions

View file

@ -94,6 +94,9 @@ status = "generate"
[[object.function]]
name = "alloc"
manual = true
[[object.function]]
name = "alloc_full"
manual = true
[[object]]
name = "GstAllocators.ShmAllocator"

View file

@ -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<gst::Allocator>,
fd: RawFd,
maxsize: usize,
offset: usize,
size: usize,
flags: FdMemoryFlags,
) -> Option<gst::Memory> {
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(),
))
}
}
}