allocator: Generate new ShmAllocator

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1343>
This commit is contained in:
Sebastian Dröge 2023-11-10 16:41:39 +02:00
parent 6403d3c0ee
commit ec3a3610d3
5 changed files with 70 additions and 0 deletions

View file

@ -94,3 +94,15 @@ status = "generate"
[[object.function]] [[object.function]]
name = "alloc" name = "alloc"
manual = true manual = true
[[object]]
name = "GstAllocators.ShmAllocator"
status = "generate"
cfg_condition = "unix"
[[object.function]]
name = "get"
manual = true
[[object.function]]
name = "once_init"
manual = true

View file

@ -27,6 +27,17 @@ pub use self::fd_allocator::FdAllocator;
mod phys_memory_allocator; mod phys_memory_allocator;
pub use self::phys_memory_allocator::PhysMemoryAllocator; pub use self::phys_memory_allocator::PhysMemoryAllocator;
#[cfg(unix)]
#[cfg_attr(docsrs, doc(cfg(unix)))]
#[cfg(feature = "v1_24")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
mod shm_allocator;
#[cfg(unix)]
#[cfg_attr(docsrs, doc(cfg(unix)))]
#[cfg(feature = "v1_24")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
pub use self::shm_allocator::ShmAllocator;
mod flags; mod flags;
pub use self::flags::FdMemoryFlags; pub use self::flags::FdMemoryFlags;

View file

@ -0,0 +1,29 @@
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
// DO NOT EDIT
use crate::FdAllocator;
use glib::translate::*;
glib::wrapper! {
#[doc(alias = "GstShmAllocator")]
pub struct ShmAllocator(Object<ffi::GstShmAllocator, ffi::GstShmAllocatorClass>) @extends FdAllocator, gst::Allocator;
match fn {
type_ => || ffi::gst_shm_allocator_get_type(),
}
}
impl ShmAllocator {
#[doc(alias = "gst_shm_allocator_init_once")]
pub fn init_once() {
assert_initialized_main_thread!();
unsafe {
ffi::gst_shm_allocator_init_once();
}
}
}
unsafe impl Send for ShmAllocator {}
unsafe impl Sync for ShmAllocator {}

View file

@ -44,6 +44,10 @@ mod drm_dumb_allocator;
#[cfg_attr(docsrs, doc(cfg(all(feature = "v1_24", target_os = "linux"))))] #[cfg_attr(docsrs, doc(cfg(all(feature = "v1_24", target_os = "linux"))))]
pub use drm_dumb_allocator::*; pub use drm_dumb_allocator::*;
#[cfg(any(all(feature = "v1_24", unix), docsrs))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "v1_24", unix))))]
mod shm_allocator;
mod phys_memory; mod phys_memory;
pub use phys_memory::*; pub use phys_memory::*;

View file

@ -0,0 +1,14 @@
use glib::translate::*;
use crate::ShmAllocator;
impl ShmAllocator {
#[doc(alias = "gst_shm_allocator_get")]
pub fn get() -> Option<gst::Allocator> {
assert_initialized_main_thread!();
unsafe {
ffi::gst_shm_allocator_init_once();
from_glib_full(ffi::gst_shm_allocator_get())
}
}
}