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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// 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::{GLBaseMemoryAllocator, GLContext};
use glib::{prelude::*, translate::*};

glib::wrapper! {
    /// Opaque [`GLMemoryAllocator`][crate::GLMemoryAllocator] struct
    ///
    /// # Implements
    ///
    /// [`GLBaseMemoryAllocatorExt`][trait@crate::prelude::GLBaseMemoryAllocatorExt], [`trait@gst::prelude::AllocatorExt`], [`trait@gst::prelude::ObjectExt`], [`trait@glib::ObjectExt`]
    #[doc(alias = "GstGLMemoryAllocator")]
    pub struct GLMemoryAllocator(Object<ffi::GstGLMemoryAllocator, ffi::GstGLMemoryAllocatorClass>) @extends GLBaseMemoryAllocator, gst::Allocator, gst::Object;

    match fn {
        type_ => || ffi::gst_gl_memory_allocator_get_type(),
    }
}

impl GLMemoryAllocator {
    pub const NONE: Option<&'static GLMemoryAllocator> = None;

    /// ## `context`
    /// a [`GLContext`][crate::GLContext]
    ///
    /// # Returns
    ///
    /// the default [`GLMemoryAllocator`][crate::GLMemoryAllocator] supported by
    ///  `context`
    #[doc(alias = "gst_gl_memory_allocator_get_default")]
    #[doc(alias = "get_default")]
    #[allow(clippy::should_implement_trait)]
    pub fn default(context: &impl IsA<GLContext>) -> GLMemoryAllocator {
        skip_assert_initialized!();
        unsafe {
            from_glib_full(ffi::gst_gl_memory_allocator_get_default(
                context.as_ref().to_glib_none().0,
            ))
        }
    }
}

unsafe impl Send for GLMemoryAllocator {}
unsafe impl Sync for GLMemoryAllocator {}