gstreamer_allocators/auto/
drm_dumb_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    #[doc(alias = "GstDRMDumbAllocator")]
11    pub struct DRMDumbAllocator(Object<ffi::GstDRMDumbAllocator, ffi::GstDRMDumbAllocatorClass>) @extends gst::Allocator;
12
13    match fn {
14        type_ => || ffi::gst_drm_dumb_allocator_get_type(),
15    }
16}
17
18impl DRMDumbAllocator {
19    #[doc(alias = "gst_drm_dumb_allocator_new_with_device_path")]
20    #[doc(alias = "new_with_device_path")]
21    pub fn with_device_path(
22        drm_device_path: impl AsRef<std::path::Path>,
23    ) -> Result<DRMDumbAllocator, glib::BoolError> {
24        assert_initialized_main_thread!();
25        unsafe {
26            Option::<gst::Allocator>::from_glib_full(
27                ffi::gst_drm_dumb_allocator_new_with_device_path(
28                    drm_device_path.as_ref().to_glib_none().0,
29                ),
30            )
31            .map(|o| o.unsafe_cast())
32            .ok_or_else(|| glib::bool_error!("Failed to create allocator"))
33        }
34    }
35
36    #[doc(alias = "gst_drm_dumb_allocator_has_prime_export")]
37    pub fn has_prime_export(&self) -> bool {
38        unsafe {
39            from_glib(ffi::gst_drm_dumb_allocator_has_prime_export(
40                self.to_glib_none().0,
41            ))
42        }
43    }
44
45    #[cfg(feature = "v1_24")]
46    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
47    #[doc(alias = "drm-device-path")]
48    pub fn drm_device_path(&self) -> Option<std::path::PathBuf> {
49        ObjectExt::property(self, "drm-device-path")
50    }
51
52    #[cfg(feature = "v1_24")]
53    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
54    #[doc(alias = "drm-fd")]
55    pub fn drm_fd(&self) -> i32 {
56        ObjectExt::property(self, "drm-fd")
57    }
58}
59
60unsafe impl Send for DRMDumbAllocator {}
61unsafe impl Sync for DRMDumbAllocator {}