gstreamer_allocators/auto/
shm_allocator.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
4// DO NOT EDIT
5
6use crate::{ffi, FdAllocator};
7
8glib::wrapper! {
9    /// This is a subclass of [`FdAllocator`][crate::FdAllocator] that implements the
10    /// [`AllocatorExtManual::alloc()`][crate::gst::prelude::AllocatorExtManual::alloc()] method using ``memfd_create()`` when available, POSIX
11    /// ``shm_open()`` otherwise. Platforms not supporting any of those (Windows) will
12    /// always return [`None`].
13    ///
14    /// Note that allocating new shared memories has a significant performance cost,
15    /// it is thus recommended to keep a pool of pre-allocated [`gst::Memory`][crate::gst::Memory], using
16    /// `GstBufferPool`. For that reason, this allocator has the
17    /// `GST_ALLOCATOR_FLAG_NO_COPY` flag set.
18    ///
19    /// # Implements
20    ///
21    /// [`FdAllocatorExt`][trait@crate::prelude::FdAllocatorExt], [`trait@gst::prelude::AllocatorExt`]
22    #[doc(alias = "GstShmAllocator")]
23    pub struct ShmAllocator(Object<ffi::GstShmAllocator, ffi::GstShmAllocatorClass>) @extends FdAllocator, gst::Allocator;
24
25    match fn {
26        type_ => || ffi::gst_shm_allocator_get_type(),
27    }
28}
29
30impl ShmAllocator {}
31
32unsafe impl Send for ShmAllocator {}
33unsafe impl Sync for ShmAllocator {}