gstreamer_allocators/auto/
fd_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;
7use glib::{prelude::*, translate::*};
8
9glib::wrapper! {
10    /// Base class for allocators with fd-backed memory
11    ///
12    /// # Implements
13    ///
14    /// [`trait@gst::prelude::AllocatorExt`]
15    #[doc(alias = "GstFdAllocator")]
16    pub struct FdAllocator(Object<ffi::GstFdAllocator, ffi::GstFdAllocatorClass>) @extends gst::Allocator;
17
18    match fn {
19        type_ => || ffi::gst_fd_allocator_get_type(),
20    }
21}
22
23impl FdAllocator {
24    pub const NONE: Option<&'static FdAllocator> = None;
25
26    /// Return a new fd allocator.
27    ///
28    /// # Returns
29    ///
30    /// a new fd allocator. Use `gst_object_unref()` to
31    /// release the allocator after usage
32    #[doc(alias = "gst_fd_allocator_new")]
33    pub fn new() -> FdAllocator {
34        assert_initialized_main_thread!();
35        unsafe { gst::Allocator::from_glib_full(ffi::gst_fd_allocator_new()).unsafe_cast() }
36    }
37}
38
39impl Default for FdAllocator {
40    fn default() -> Self {
41        Self::new()
42    }
43}
44
45unsafe impl Send for FdAllocator {}
46unsafe impl Sync for FdAllocator {}