gstreamer-allocators: allow to subclass fd memory allocators

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1215>
This commit is contained in:
Christian Meissl 2023-01-06 20:31:13 +01:00 committed by Sebastian Dröge
parent b708208408
commit 0714c2ceb0
4 changed files with 29 additions and 0 deletions

View file

@ -57,3 +57,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;
}