gstreamer_gl/auto/
gl_memory_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, GLBaseMemoryAllocator, GLContext};
7use glib::{prelude::*, translate::*};
8
9glib::wrapper! {
10    /// Opaque [`GLMemoryAllocator`][crate::GLMemoryAllocator] struct
11    ///
12    /// # Implements
13    ///
14    /// [`GLBaseMemoryAllocatorExt`][trait@crate::prelude::GLBaseMemoryAllocatorExt], [`trait@gst::prelude::AllocatorExt`], [`trait@gst::prelude::ObjectExt`], [`trait@glib::ObjectExt`]
15    #[doc(alias = "GstGLMemoryAllocator")]
16    pub struct GLMemoryAllocator(Object<ffi::GstGLMemoryAllocator, ffi::GstGLMemoryAllocatorClass>) @extends GLBaseMemoryAllocator, gst::Allocator, gst::Object;
17
18    match fn {
19        type_ => || ffi::gst_gl_memory_allocator_get_type(),
20    }
21}
22
23impl GLMemoryAllocator {
24    pub const NONE: Option<&'static GLMemoryAllocator> = None;
25
26    /// ## `context`
27    /// a [`GLContext`][crate::GLContext]
28    ///
29    /// # Returns
30    ///
31    /// the default [`GLMemoryAllocator`][crate::GLMemoryAllocator] supported by
32    ///  `context`
33    #[doc(alias = "gst_gl_memory_allocator_get_default")]
34    #[doc(alias = "get_default")]
35    #[allow(clippy::should_implement_trait)]
36    pub fn default(context: &impl IsA<GLContext>) -> GLMemoryAllocator {
37        skip_assert_initialized!();
38        unsafe {
39            from_glib_full(ffi::gst_gl_memory_allocator_get_default(
40                context.as_ref().to_glib_none().0,
41            ))
42        }
43    }
44}
45
46unsafe impl Send for GLMemoryAllocator {}
47unsafe impl Sync for GLMemoryAllocator {}