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