gstreamer-allocators: allow to subclass fd memory allocators

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1186>
This commit is contained in:
Christian Meissl 2023-01-06 20:31:13 +01:00
parent 00281e98f0
commit 77866a52df
4 changed files with 29 additions and 0 deletions

View file

@ -52,3 +52,5 @@ pub mod prelude {
#[doc(hidden)] #[doc(hidden)]
pub use gst::prelude::*; pub use gst::prelude::*;
} }
pub mod subclass;

View file

@ -0,0 +1,6 @@
use glib::subclass::prelude::*;
use crate::{subclass::fd_allocator::FdAllocatorImpl, DmaBufAllocator};
pub trait DmaBufAllocatorImpl: FdAllocatorImpl {}
unsafe impl<T: DmaBufAllocatorImpl> IsSubclassable<T> for DmaBufAllocator {}

View file

@ -0,0 +1,7 @@
use glib::subclass::prelude::*;
use crate::FdAllocator;
use gst::subclass::prelude::AllocatorImpl;
pub trait FdAllocatorImpl: AllocatorImpl {}
unsafe impl<T: FdAllocatorImpl> IsSubclassable<T> for FdAllocator {}

View file

@ -0,0 +1,14 @@
#[cfg(any(target_os = "linux", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(target_os = "linux")))]
mod dma_buf_allocator;
mod fd_allocator;
pub mod prelude {
#[doc(hidden)]
pub use gst::subclass::prelude::*;
#[cfg(any(target_os = "linux", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(target_os = "linux")))]
pub use super::dma_buf_allocator::DmaBufAllocatorImpl;
pub use super::fd_allocator::FdAllocatorImpl;
}