gstreamer_allocators_sys/
lib.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
6#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]
7#![allow(
8    clippy::approx_constant,
9    clippy::type_complexity,
10    clippy::unreadable_literal,
11    clippy::upper_case_acronyms
12)]
13#![cfg_attr(docsrs, feature(doc_cfg))]
14
15use glib_sys as glib;
16use gobject_sys as gobject;
17use gstreamer_sys as gst;
18
19#[cfg(unix)]
20#[allow(unused_imports)]
21use libc::{dev_t, gid_t, pid_t, socklen_t, uid_t};
22#[allow(unused_imports)]
23use libc::{intptr_t, off_t, size_t, ssize_t, time_t, uintptr_t, FILE};
24#[allow(unused_imports)]
25use std::ffi::{
26    c_char, c_double, c_float, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort, c_void,
27};
28
29#[allow(unused_imports)]
30use glib::{gboolean, gconstpointer, gpointer, GType};
31
32// Constants
33pub const GST_ALLOCATOR_DMABUF: &[u8] = b"dmabuf\0";
34pub const GST_ALLOCATOR_FD: &[u8] = b"fd\0";
35pub const GST_ALLOCATOR_SHM: &[u8] = b"shm\0";
36pub const GST_CAPS_FEATURE_MEMORY_DMABUF: &[u8] = b"memory:DMABuf\0";
37
38// Flags
39pub type GstFdMemoryFlags = c_uint;
40pub const GST_FD_MEMORY_FLAG_NONE: GstFdMemoryFlags = 0;
41pub const GST_FD_MEMORY_FLAG_KEEP_MAPPED: GstFdMemoryFlags = 1;
42pub const GST_FD_MEMORY_FLAG_MAP_PRIVATE: GstFdMemoryFlags = 2;
43pub const GST_FD_MEMORY_FLAG_DONT_CLOSE: GstFdMemoryFlags = 4;
44
45// Records
46#[derive(Copy, Clone)]
47#[repr(C)]
48pub struct GstDRMDumbAllocatorClass {
49    pub parent_class: gst::GstAllocatorClass,
50}
51
52impl ::std::fmt::Debug for GstDRMDumbAllocatorClass {
53    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
54        f.debug_struct(&format!("GstDRMDumbAllocatorClass @ {self:p}"))
55            .field("parent_class", &self.parent_class)
56            .finish()
57    }
58}
59
60#[derive(Copy, Clone)]
61#[repr(C)]
62pub struct GstDmaBufAllocatorClass {
63    pub parent_class: GstFdAllocatorClass,
64    pub _gst_reserved: [gpointer; 4],
65}
66
67impl ::std::fmt::Debug for GstDmaBufAllocatorClass {
68    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
69        f.debug_struct(&format!("GstDmaBufAllocatorClass @ {self:p}"))
70            .field("parent_class", &self.parent_class)
71            .finish()
72    }
73}
74
75#[derive(Copy, Clone)]
76#[repr(C)]
77pub struct GstFdAllocatorClass {
78    pub parent_class: gst::GstAllocatorClass,
79}
80
81impl ::std::fmt::Debug for GstFdAllocatorClass {
82    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
83        f.debug_struct(&format!("GstFdAllocatorClass @ {self:p}"))
84            .field("parent_class", &self.parent_class)
85            .finish()
86    }
87}
88
89#[derive(Copy, Clone)]
90#[repr(C)]
91pub struct GstPhysMemoryAllocatorInterface {
92    pub parent_iface: gobject::GTypeInterface,
93    pub get_phys_addr:
94        Option<unsafe extern "C" fn(*mut GstPhysMemoryAllocator, *mut gst::GstMemory) -> uintptr_t>,
95}
96
97impl ::std::fmt::Debug for GstPhysMemoryAllocatorInterface {
98    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
99        f.debug_struct(&format!("GstPhysMemoryAllocatorInterface @ {self:p}"))
100            .field("get_phys_addr", &self.get_phys_addr)
101            .finish()
102    }
103}
104
105#[derive(Copy, Clone)]
106#[repr(C)]
107pub struct GstShmAllocatorClass {
108    pub parent_class: GstFdAllocatorClass,
109}
110
111impl ::std::fmt::Debug for GstShmAllocatorClass {
112    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
113        f.debug_struct(&format!("GstShmAllocatorClass @ {self:p}"))
114            .field("parent_class", &self.parent_class)
115            .finish()
116    }
117}
118
119// Classes
120#[repr(C)]
121#[allow(dead_code)]
122pub struct GstDRMDumbAllocator {
123    _data: [u8; 0],
124    _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
125}
126
127impl ::std::fmt::Debug for GstDRMDumbAllocator {
128    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
129        f.debug_struct(&format!("GstDRMDumbAllocator @ {self:p}"))
130            .finish()
131    }
132}
133
134#[derive(Copy, Clone)]
135#[repr(C)]
136pub struct GstDmaBufAllocator {
137    pub parent: GstFdAllocator,
138    pub _gst_reserved: [gpointer; 4],
139}
140
141impl ::std::fmt::Debug for GstDmaBufAllocator {
142    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
143        f.debug_struct(&format!("GstDmaBufAllocator @ {self:p}"))
144            .field("parent", &self.parent)
145            .finish()
146    }
147}
148
149#[derive(Copy, Clone)]
150#[repr(C)]
151pub struct GstFdAllocator {
152    pub parent: gst::GstAllocator,
153}
154
155impl ::std::fmt::Debug for GstFdAllocator {
156    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
157        f.debug_struct(&format!("GstFdAllocator @ {self:p}"))
158            .field("parent", &self.parent)
159            .finish()
160    }
161}
162
163#[repr(C)]
164#[allow(dead_code)]
165pub struct GstShmAllocator {
166    _data: [u8; 0],
167    _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
168}
169
170impl ::std::fmt::Debug for GstShmAllocator {
171    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
172        f.debug_struct(&format!("GstShmAllocator @ {self:p}"))
173            .finish()
174    }
175}
176
177// Interfaces
178#[repr(C)]
179#[allow(dead_code)]
180pub struct GstPhysMemoryAllocator {
181    _data: [u8; 0],
182    _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
183}
184
185impl ::std::fmt::Debug for GstPhysMemoryAllocator {
186    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
187        write!(f, "GstPhysMemoryAllocator @ {self:p}")
188    }
189}
190
191extern "C" {
192
193    //=========================================================================
194    // GstDRMDumbAllocator
195    //=========================================================================
196    #[cfg(feature = "v1_24")]
197    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
198    pub fn gst_drm_dumb_allocator_get_type() -> GType;
199    #[cfg(feature = "v1_24")]
200    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
201    pub fn gst_drm_dumb_allocator_new_with_device_path(
202        drm_device_path: *const c_char,
203    ) -> *mut gst::GstAllocator;
204    #[cfg(feature = "v1_24")]
205    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
206    pub fn gst_drm_dumb_allocator_new_with_fd(drm_fd: c_int) -> *mut gst::GstAllocator;
207    #[cfg(feature = "v1_24")]
208    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
209    pub fn gst_drm_dumb_allocator_alloc(
210        allocator: *mut GstDRMDumbAllocator,
211        drm_fourcc: u32,
212        width: u32,
213        height: u32,
214        out_pitch: *mut u32,
215    ) -> *mut gst::GstMemory;
216    #[cfg(feature = "v1_24")]
217    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
218    pub fn gst_drm_dumb_allocator_has_prime_export(allocator: *mut GstDRMDumbAllocator)
219        -> gboolean;
220
221    //=========================================================================
222    // GstDmaBufAllocator
223    //=========================================================================
224    pub fn gst_dmabuf_allocator_get_type() -> GType;
225    pub fn gst_dmabuf_allocator_new() -> *mut gst::GstAllocator;
226    pub fn gst_dmabuf_allocator_alloc(
227        allocator: *mut gst::GstAllocator,
228        fd: c_int,
229        size: size_t,
230    ) -> *mut gst::GstMemory;
231    #[cfg(feature = "v1_16")]
232    #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
233    pub fn gst_dmabuf_allocator_alloc_with_flags(
234        allocator: *mut gst::GstAllocator,
235        fd: c_int,
236        size: size_t,
237        flags: GstFdMemoryFlags,
238    ) -> *mut gst::GstMemory;
239
240    //=========================================================================
241    // GstFdAllocator
242    //=========================================================================
243    pub fn gst_fd_allocator_get_type() -> GType;
244    pub fn gst_fd_allocator_new() -> *mut gst::GstAllocator;
245    pub fn gst_fd_allocator_alloc(
246        allocator: *mut gst::GstAllocator,
247        fd: c_int,
248        size: size_t,
249        flags: GstFdMemoryFlags,
250    ) -> *mut gst::GstMemory;
251
252    //=========================================================================
253    // GstShmAllocator
254    //=========================================================================
255    #[cfg(feature = "v1_24")]
256    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
257    pub fn gst_shm_allocator_get_type() -> GType;
258    #[cfg(feature = "v1_24")]
259    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
260    pub fn gst_shm_allocator_get() -> *mut gst::GstAllocator;
261    #[cfg(feature = "v1_24")]
262    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
263    pub fn gst_shm_allocator_init_once();
264
265    //=========================================================================
266    // GstPhysMemoryAllocator
267    //=========================================================================
268    pub fn gst_phys_memory_allocator_get_type() -> GType;
269
270    //=========================================================================
271    // Other functions
272    //=========================================================================
273    pub fn gst_dmabuf_memory_get_fd(mem: *mut gst::GstMemory) -> c_int;
274    #[cfg(feature = "v1_24")]
275    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
276    pub fn gst_drm_dumb_memory_export_dmabuf(mem: *mut gst::GstMemory) -> *mut gst::GstMemory;
277    #[cfg(feature = "v1_24")]
278    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
279    pub fn gst_drm_dumb_memory_get_handle(mem: *mut gst::GstMemory) -> u32;
280    pub fn gst_fd_memory_get_fd(mem: *mut gst::GstMemory) -> c_int;
281    pub fn gst_is_dmabuf_memory(mem: *mut gst::GstMemory) -> gboolean;
282    #[cfg(feature = "v1_24")]
283    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
284    pub fn gst_is_drm_dumb_memory(mem: *mut gst::GstMemory) -> gboolean;
285    pub fn gst_is_fd_memory(mem: *mut gst::GstMemory) -> gboolean;
286    pub fn gst_is_phys_memory(mem: *mut gst::GstMemory) -> gboolean;
287    pub fn gst_phys_memory_get_phys_addr(mem: *mut gst::GstMemory) -> uintptr_t;
288
289}