Skip to main content

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#[allow(unused_imports)]
20use libc::{FILE, intptr_t, off_t, size_t, ssize_t, time_t, uintptr_t};
21#[cfg(unix)]
22#[allow(unused_imports)]
23use libc::{dev_t, gid_t, pid_t, socklen_t, uid_t};
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::{GType, gboolean, gconstpointer, gpointer};
31
32// Enums
33pub type GstAHardwareBufferFormat = c_int;
34pub const GST_AHARDWARE_BUFFER_FORMAT_R8G8B8A8_UNORM: GstAHardwareBufferFormat = 1;
35pub const GST_AHARDWARE_BUFFER_FORMAT_R8G8B8X8_UNORM: GstAHardwareBufferFormat = 2;
36pub const GST_AHARDWARE_BUFFER_FORMAT_R8G8B8_UNORM: GstAHardwareBufferFormat = 3;
37pub const GST_AHARDWARE_BUFFER_FORMAT_R5G6B5_UNORM: GstAHardwareBufferFormat = 4;
38pub const GST_AHARDWARE_BUFFER_FORMAT_R16G16B16A16_FLOAT: GstAHardwareBufferFormat = 22;
39pub const GST_AHARDWARE_BUFFER_FORMAT_BLOB: GstAHardwareBufferFormat = 33;
40pub const GST_AHARDWARE_BUFFER_FORMAT_Y8Cb8Cr8_420: GstAHardwareBufferFormat = 35;
41pub const GST_AHARDWARE_BUFFER_FORMAT_R10G10B10A2_UNORM: GstAHardwareBufferFormat = 43;
42pub const GST_AHARDWARE_BUFFER_FORMAT_D16_UNORM: GstAHardwareBufferFormat = 48;
43pub const GST_AHARDWARE_BUFFER_FORMAT_D24_UNORM: GstAHardwareBufferFormat = 49;
44pub const GST_AHARDWARE_BUFFER_FORMAT_D24_UNORM_S8_UINT: GstAHardwareBufferFormat = 50;
45pub const GST_AHARDWARE_BUFFER_FORMAT_D32_FLOAT: GstAHardwareBufferFormat = 51;
46pub const GST_AHARDWARE_BUFFER_FORMAT_D32_FLOAT_S8_UINT: GstAHardwareBufferFormat = 52;
47pub const GST_AHARDWARE_BUFFER_FORMAT_S8_UINT: GstAHardwareBufferFormat = 53;
48pub const GST_AHARDWARE_BUFFER_FORMAT_YCbCr_P010: GstAHardwareBufferFormat = 54;
49pub const GST_AHARDWARE_BUFFER_FORMAT_R8_UNORM: GstAHardwareBufferFormat = 56;
50pub const GST_AHARDWARE_BUFFER_FORMAT_R16_UINT: GstAHardwareBufferFormat = 57;
51pub const GST_AHARDWARE_BUFFER_FORMAT_R16G16_UINT: GstAHardwareBufferFormat = 58;
52pub const GST_AHARDWARE_BUFFER_FORMAT_R10G10B10A10_UNORM: GstAHardwareBufferFormat = 59;
53pub const GST_AHARDWARE_BUFFER_FORMAT_YCbCr_P210: GstAHardwareBufferFormat = 60;
54pub const GST_AHARDWARE_BUFFER_FORMAT_R12_UINT: GstAHardwareBufferFormat = 61;
55pub const GST_AHARDWARE_BUFFER_FORMAT_R14_UINT: GstAHardwareBufferFormat = 62;
56pub const GST_AHARDWARE_BUFFER_FORMAT_R12G12_UINT: GstAHardwareBufferFormat = 63;
57pub const GST_AHARDWARE_BUFFER_FORMAT_R14G14_UINT: GstAHardwareBufferFormat = 64;
58pub const GST_AHARDWARE_BUFFER_FORMAT_R12G12B12A12_UINT: GstAHardwareBufferFormat = 65;
59pub const GST_AHARDWARE_BUFFER_FORMAT_R14G14B14A14_UINT: GstAHardwareBufferFormat = 66;
60pub const GST_AHARDWARE_BUFFER_FORMAT_B10G10R10A2_UNORM: GstAHardwareBufferFormat = 67;
61pub const GST_AHARDWARE_BUFFER_FORMAT_B10G10R10X2_UNORM: GstAHardwareBufferFormat = 68;
62
63// Constants
64pub const GST_ALLOCATOR_DMABUF: &[u8] = b"dmabuf\0";
65pub const GST_ALLOCATOR_FD: &[u8] = b"fd\0";
66pub const GST_ALLOCATOR_SHM: &[u8] = b"shm\0";
67pub const GST_ALLOCATOR_UDMABUF: &[u8] = b"udmabuf\0";
68pub const GST_CAPS_FEATURE_MEMORY_AHARDWAREBUFFER: &[u8] = b"memory:AHardwareBuffer\0";
69pub const GST_CAPS_FEATURE_MEMORY_DMABUF: &[u8] = b"memory:DMABuf\0";
70
71// Flags
72pub type GstFdMemoryFlags = c_uint;
73pub const GST_FD_MEMORY_FLAG_NONE: GstFdMemoryFlags = 0;
74pub const GST_FD_MEMORY_FLAG_KEEP_MAPPED: GstFdMemoryFlags = 1;
75pub const GST_FD_MEMORY_FLAG_MAP_PRIVATE: GstFdMemoryFlags = 2;
76pub const GST_FD_MEMORY_FLAG_DONT_CLOSE: GstFdMemoryFlags = 4;
77
78// Callbacks
79pub type GstAHardwareBufferMemoryQueryFunction =
80    Option<unsafe extern "C" fn(*mut gst::GstMemory, *mut gpointer) -> gboolean>;
81
82// Records
83#[derive(Copy, Clone)]
84#[repr(C)]
85pub struct GstDRMDumbAllocatorClass {
86    pub parent_class: gst::GstAllocatorClass,
87}
88
89impl ::std::fmt::Debug for GstDRMDumbAllocatorClass {
90    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
91        f.debug_struct(&format!("GstDRMDumbAllocatorClass @ {self:p}"))
92            .field("parent_class", &self.parent_class)
93            .finish()
94    }
95}
96
97#[derive(Copy, Clone)]
98#[repr(C)]
99pub struct GstDmaBufAllocatorClass {
100    pub parent_class: GstFdAllocatorClass,
101    pub _gst_reserved: [gpointer; 4],
102}
103
104impl ::std::fmt::Debug for GstDmaBufAllocatorClass {
105    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
106        f.debug_struct(&format!("GstDmaBufAllocatorClass @ {self:p}"))
107            .field("parent_class", &self.parent_class)
108            .finish()
109    }
110}
111
112#[derive(Copy, Clone)]
113#[repr(C)]
114pub struct GstFdAllocatorClass {
115    pub parent_class: gst::GstAllocatorClass,
116}
117
118impl ::std::fmt::Debug for GstFdAllocatorClass {
119    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
120        f.debug_struct(&format!("GstFdAllocatorClass @ {self:p}"))
121            .field("parent_class", &self.parent_class)
122            .finish()
123    }
124}
125
126#[derive(Copy, Clone)]
127#[repr(C)]
128pub struct GstPhysMemoryAllocatorInterface {
129    pub parent_iface: gobject::GTypeInterface,
130    pub get_phys_addr:
131        Option<unsafe extern "C" fn(*mut GstPhysMemoryAllocator, *mut gst::GstMemory) -> uintptr_t>,
132}
133
134impl ::std::fmt::Debug for GstPhysMemoryAllocatorInterface {
135    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
136        f.debug_struct(&format!("GstPhysMemoryAllocatorInterface @ {self:p}"))
137            .field("get_phys_addr", &self.get_phys_addr)
138            .finish()
139    }
140}
141
142#[derive(Copy, Clone)]
143#[repr(C)]
144pub struct GstShmAllocatorClass {
145    pub parent_class: GstFdAllocatorClass,
146}
147
148impl ::std::fmt::Debug for GstShmAllocatorClass {
149    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
150        f.debug_struct(&format!("GstShmAllocatorClass @ {self:p}"))
151            .field("parent_class", &self.parent_class)
152            .finish()
153    }
154}
155
156#[derive(Copy, Clone)]
157#[repr(C)]
158pub struct GstUdmabufAllocatorClass {
159    pub parent_class: GstDmaBufAllocatorClass,
160}
161
162impl ::std::fmt::Debug for GstUdmabufAllocatorClass {
163    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
164        f.debug_struct(&format!("GstUdmabufAllocatorClass @ {self:p}"))
165            .field("parent_class", &self.parent_class)
166            .finish()
167    }
168}
169
170// Classes
171#[repr(C)]
172#[allow(dead_code)]
173pub struct GstDRMDumbAllocator {
174    _data: [u8; 0],
175    _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
176}
177
178impl ::std::fmt::Debug for GstDRMDumbAllocator {
179    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
180        f.debug_struct(&format!("GstDRMDumbAllocator @ {self:p}"))
181            .finish()
182    }
183}
184
185#[derive(Copy, Clone)]
186#[repr(C)]
187pub struct GstDmaBufAllocator {
188    pub parent: GstFdAllocator,
189    pub _gst_reserved: [gpointer; 4],
190}
191
192impl ::std::fmt::Debug for GstDmaBufAllocator {
193    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
194        f.debug_struct(&format!("GstDmaBufAllocator @ {self:p}"))
195            .field("parent", &self.parent)
196            .finish()
197    }
198}
199
200#[derive(Copy, Clone)]
201#[repr(C)]
202pub struct GstFdAllocator {
203    pub parent: gst::GstAllocator,
204}
205
206impl ::std::fmt::Debug for GstFdAllocator {
207    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
208        f.debug_struct(&format!("GstFdAllocator @ {self:p}"))
209            .field("parent", &self.parent)
210            .finish()
211    }
212}
213
214#[derive(Copy, Clone)]
215#[repr(C)]
216pub struct GstShmAllocator {
217    pub parent_instance: GstFdAllocator,
218}
219
220impl ::std::fmt::Debug for GstShmAllocator {
221    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
222        f.debug_struct(&format!("GstShmAllocator @ {self:p}"))
223            .field("parent_instance", &self.parent_instance)
224            .finish()
225    }
226}
227
228#[repr(C)]
229#[allow(dead_code)]
230pub struct GstUdmabufAllocator {
231    _data: [u8; 0],
232    _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
233}
234
235impl ::std::fmt::Debug for GstUdmabufAllocator {
236    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
237        f.debug_struct(&format!("GstUdmabufAllocator @ {self:p}"))
238            .finish()
239    }
240}
241
242// Interfaces
243#[repr(C)]
244#[allow(dead_code)]
245pub struct GstPhysMemoryAllocator {
246    _data: [u8; 0],
247    _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
248}
249
250impl ::std::fmt::Debug for GstPhysMemoryAllocator {
251    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
252        write!(f, "GstPhysMemoryAllocator @ {self:p}")
253    }
254}
255
256unsafe extern "C" {
257
258    //=========================================================================
259    // GstDRMDumbAllocator
260    //=========================================================================
261    #[cfg(feature = "v1_24")]
262    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
263    pub fn gst_drm_dumb_allocator_get_type() -> GType;
264    #[cfg(feature = "v1_24")]
265    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
266    pub fn gst_drm_dumb_allocator_new_with_device_path(
267        drm_device_path: *const c_char,
268    ) -> *mut gst::GstAllocator;
269    #[cfg(feature = "v1_24")]
270    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
271    pub fn gst_drm_dumb_allocator_new_with_fd(drm_fd: c_int) -> *mut gst::GstAllocator;
272    #[cfg(feature = "v1_24")]
273    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
274    pub fn gst_drm_dumb_allocator_alloc(
275        allocator: *mut GstDRMDumbAllocator,
276        drm_fourcc: u32,
277        width: u32,
278        height: u32,
279        out_pitch: *mut u32,
280    ) -> *mut gst::GstMemory;
281    #[cfg(feature = "v1_24")]
282    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
283    pub fn gst_drm_dumb_allocator_has_prime_export(allocator: *mut GstDRMDumbAllocator)
284    -> gboolean;
285
286    //=========================================================================
287    // GstDmaBufAllocator
288    //=========================================================================
289    pub fn gst_dmabuf_allocator_get_type() -> GType;
290    pub fn gst_dmabuf_allocator_new() -> *mut gst::GstAllocator;
291    pub fn gst_dmabuf_allocator_alloc(
292        allocator: *mut gst::GstAllocator,
293        fd: c_int,
294        size: size_t,
295    ) -> *mut gst::GstMemory;
296    #[cfg(feature = "v1_16")]
297    #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
298    pub fn gst_dmabuf_allocator_alloc_with_flags(
299        allocator: *mut gst::GstAllocator,
300        fd: c_int,
301        size: size_t,
302        flags: GstFdMemoryFlags,
303    ) -> *mut gst::GstMemory;
304
305    //=========================================================================
306    // GstFdAllocator
307    //=========================================================================
308    pub fn gst_fd_allocator_get_type() -> GType;
309    pub fn gst_fd_allocator_new() -> *mut gst::GstAllocator;
310    pub fn gst_fd_allocator_alloc(
311        allocator: *mut gst::GstAllocator,
312        fd: c_int,
313        size: size_t,
314        flags: GstFdMemoryFlags,
315    ) -> *mut gst::GstMemory;
316    #[cfg(feature = "v1_28")]
317    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
318    pub fn gst_fd_allocator_alloc_full(
319        allocator: *mut gst::GstAllocator,
320        fd: c_int,
321        maxsize: size_t,
322        offset: size_t,
323        size: size_t,
324        flags: GstFdMemoryFlags,
325    ) -> *mut gst::GstMemory;
326
327    //=========================================================================
328    // GstShmAllocator
329    //=========================================================================
330    #[cfg(feature = "v1_24")]
331    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
332    pub fn gst_shm_allocator_get_type() -> GType;
333    #[cfg(feature = "v1_24")]
334    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
335    pub fn gst_shm_allocator_get() -> *mut gst::GstAllocator;
336    #[cfg(feature = "v1_24")]
337    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
338    pub fn gst_shm_allocator_init_once();
339
340    //=========================================================================
341    // GstUdmabufAllocator
342    //=========================================================================
343    #[cfg(feature = "v1_28")]
344    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
345    pub fn gst_udmabuf_allocator_get_type() -> GType;
346    #[cfg(feature = "v1_28")]
347    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
348    pub fn gst_udmabuf_allocator_get() -> *mut gst::GstAllocator;
349    #[cfg(feature = "v1_28")]
350    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
351    pub fn gst_udmabuf_allocator_init_once();
352
353    //=========================================================================
354    // GstPhysMemoryAllocator
355    //=========================================================================
356    pub fn gst_phys_memory_allocator_get_type() -> GType;
357
358    //=========================================================================
359    // Other functions
360    //=========================================================================
361    #[cfg(feature = "v1_30")]
362    #[cfg_attr(docsrs, doc(cfg(feature = "v1_30")))]
363    pub fn gst_ahardware_buffer_format_from_caps_string(
364        value: *const c_char,
365        format: *mut u32,
366    ) -> gboolean;
367    #[cfg(feature = "v1_30")]
368    #[cfg_attr(docsrs, doc(cfg(feature = "v1_30")))]
369    pub fn gst_ahardware_buffer_format_to_caps_string(format: u32) -> *mut c_char;
370    #[cfg(feature = "v1_30")]
371    #[cfg_attr(docsrs, doc(cfg(feature = "v1_30")))]
372    pub fn gst_ahardware_buffer_memory_peek_buffer(
373        mem: *mut gst::GstMemory,
374        buffer: *mut gpointer,
375    ) -> gboolean;
376    #[cfg(feature = "v1_30")]
377    #[cfg_attr(docsrs, doc(cfg(feature = "v1_30")))]
378    pub fn gst_ahardware_buffer_memory_register_query_function(
379        allocator_type: GType,
380        query: GstAHardwareBufferMemoryQueryFunction,
381    );
382    pub fn gst_dmabuf_memory_get_fd(mem: *mut gst::GstMemory) -> c_int;
383    #[cfg(feature = "v1_24")]
384    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
385    pub fn gst_drm_dumb_memory_export_dmabuf(mem: *mut gst::GstMemory) -> *mut gst::GstMemory;
386    #[cfg(feature = "v1_24")]
387    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
388    pub fn gst_drm_dumb_memory_get_handle(mem: *mut gst::GstMemory) -> u32;
389    pub fn gst_fd_memory_get_fd(mem: *mut gst::GstMemory) -> c_int;
390    #[cfg(feature = "v1_30")]
391    #[cfg_attr(docsrs, doc(cfg(feature = "v1_30")))]
392    pub fn gst_is_ahardware_buffer_buffer(buffer: *mut gst::GstBuffer) -> gboolean;
393    #[cfg(feature = "v1_30")]
394    #[cfg_attr(docsrs, doc(cfg(feature = "v1_30")))]
395    pub fn gst_is_ahardware_buffer_memory(mem: *mut gst::GstMemory) -> gboolean;
396    pub fn gst_is_dmabuf_memory(mem: *mut gst::GstMemory) -> gboolean;
397    #[cfg(feature = "v1_24")]
398    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
399    pub fn gst_is_drm_dumb_memory(mem: *mut gst::GstMemory) -> gboolean;
400    pub fn gst_is_fd_memory(mem: *mut gst::GstMemory) -> gboolean;
401    pub fn gst_is_phys_memory(mem: *mut gst::GstMemory) -> gboolean;
402    pub fn gst_phys_memory_get_phys_addr(mem: *mut gst::GstMemory) -> uintptr_t;
403
404}