gstreamer-rs/gstreamer/src/allocator.rs
Bilal Elmoussaoui aaea288abf Adapt to no longer re-exported traits
Some of the traits were moved to prelude or translate
and no longer in the main scope of the crate

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1382>
2024-02-03 10:48:37 +01:00

37 lines
1.2 KiB
Rust

// Take a look at the license at the top of the repository in the LICENSE file.
use glib::{prelude::*, translate::*};
use crate::Allocator;
impl Allocator {
#[doc(alias = "gst_allocator_register")]
pub fn register(name: &str, allocator: impl IsA<Allocator>) {
skip_assert_initialized!();
unsafe {
#[cfg(not(feature = "v1_22"))]
{
// See https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3364
if crate::version() < (1, 20, 5, 0) {
ffi::gst_allocator_register(
name.to_glib_full(),
allocator.upcast().into_glib_ptr(),
);
} else {
ffi::gst_allocator_register(
name.to_glib_none().0,
allocator.upcast().into_glib_ptr(),
);
}
}
#[cfg(feature = "v1_22")]
{
ffi::gst_allocator_register(
name.to_glib_none().0,
allocator.upcast().into_glib_ptr(),
);
}
}
}
}