bufferpool: Allow passing any subclass of Allocator to the config

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1751>
This commit is contained in:
Sebastian Dröge 2025-07-12 17:05:14 +03:00
parent 081b5760ba
commit 9a5e45c56f

View file

@ -222,12 +222,16 @@ impl BufferPoolConfigRef {
}
#[doc(alias = "gst_buffer_pool_config_set_allocator")]
pub fn set_allocator(&self, allocator: Option<&Allocator>, params: Option<&AllocationParams>) {
pub fn set_allocator(
&self,
allocator: Option<&impl IsA<Allocator>>,
params: Option<&AllocationParams>,
) {
assert!(allocator.is_some() || params.is_some());
unsafe {
ffi::gst_buffer_pool_config_set_allocator(
self.0.as_mut_ptr(),
allocator.to_glib_none().0,
allocator.to_glib_none().0 as *mut ffi::GstAllocator,
match params {
Some(val) => val.as_ptr(),
None => ptr::null(),