1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// 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::{ffi, FdAllocator};

glib::wrapper! {
    /// This is a subclass of [`FdAllocator`][crate::FdAllocator] that implements the
    /// [`AllocatorExtManual::alloc()`][crate::gst::prelude::AllocatorExtManual::alloc()] method using ``memfd_create()`` when available, POSIX
    /// ``shm_open()`` otherwise. Platforms not supporting any of those (Windows) will
    /// always return [`None`].
    ///
    /// Note that allocating new shared memories has a significant performance cost,
    /// it is thus recommended to keep a pool of pre-allocated [`gst::Memory`][crate::gst::Memory], using
    /// `GstBufferPool`. For that reason, this allocator has the
    /// `GST_ALLOCATOR_FLAG_NO_COPY` flag set.
    ///
    /// # Implements
    ///
    /// [`FdAllocatorExt`][trait@crate::prelude::FdAllocatorExt], [`trait@gst::prelude::AllocatorExt`]
    #[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 {}

unsafe impl Send for ShmAllocator {}
unsafe impl Sync for ShmAllocator {}