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 | use crate::{ffi, GLBaseMemory, GLContext}; |
7 | use glib::{prelude::*, translate::*}; |
8 | |
9 | glib::wrapper! { |
10 | #[doc (alias = "GstGLFramebuffer" )] |
11 | pub struct GLFramebuffer(Object<ffi::GstGLFramebuffer, ffi::GstGLFramebufferClass>) @extends gst::Object; |
12 | |
13 | match fn { |
14 | type_ => || ffi::gst_gl_framebuffer_get_type(), |
15 | } |
16 | } |
17 | |
18 | impl GLFramebuffer { |
19 | pub const NONE: Option<&'static GLFramebuffer> = None; |
20 | |
21 | #[doc (alias = "gst_gl_framebuffer_new" )] |
22 | pub fn new(context: &impl IsA<GLContext>) -> GLFramebuffer { |
23 | skip_assert_initialized!(); |
24 | unsafe { |
25 | from_glib_full(ffi::gst_gl_framebuffer_new( |
26 | context.as_ref().to_glib_none().0, |
27 | )) |
28 | } |
29 | } |
30 | |
31 | #[doc (alias = "gst_gl_framebuffer_new_with_default_depth" )] |
32 | #[doc (alias = "new_with_default_depth" )] |
33 | pub fn with_default_depth( |
34 | context: &impl IsA<GLContext>, |
35 | width: u32, |
36 | height: u32, |
37 | ) -> GLFramebuffer { |
38 | skip_assert_initialized!(); |
39 | unsafe { |
40 | from_glib_none(ffi::gst_gl_framebuffer_new_with_default_depth( |
41 | context.as_ref().to_glib_none().0, |
42 | width, |
43 | height, |
44 | )) |
45 | } |
46 | } |
47 | } |
48 | |
49 | unsafe impl Send for GLFramebuffer {} |
50 | unsafe impl Sync for GLFramebuffer {} |
51 | |
52 | mod sealed { |
53 | pub trait Sealed {} |
54 | impl<T: super::IsA<super::GLFramebuffer>> Sealed for T {} |
55 | } |
56 | |
57 | pub trait GLFramebufferExt: IsA<GLFramebuffer> + sealed::Sealed + 'static { |
58 | #[doc (alias = "gst_gl_framebuffer_attach" )] |
59 | unsafe fn attach(&self, attachment_point: u32, mem: &mut GLBaseMemory) { |
60 | ffi::gst_gl_framebuffer_attach( |
61 | self.as_ref().to_glib_none().0, |
62 | attachment_point, |
63 | mem.to_glib_none_mut().0, |
64 | ); |
65 | } |
66 | |
67 | #[doc (alias = "gst_gl_framebuffer_bind" )] |
68 | fn bind(&self) { |
69 | unsafe { |
70 | ffi::gst_gl_framebuffer_bind(self.as_ref().to_glib_none().0); |
71 | } |
72 | } |
73 | |
74 | #[doc (alias = "gst_gl_framebuffer_get_effective_dimensions" )] |
75 | #[doc (alias = "get_effective_dimensions" )] |
76 | fn effective_dimensions(&self) -> (u32, u32) { |
77 | unsafe { |
78 | let mut width = std::mem::MaybeUninit::uninit(); |
79 | let mut height = std::mem::MaybeUninit::uninit(); |
80 | ffi::gst_gl_framebuffer_get_effective_dimensions( |
81 | self.as_ref().to_glib_none().0, |
82 | width.as_mut_ptr(), |
83 | height.as_mut_ptr(), |
84 | ); |
85 | (width.assume_init(), height.assume_init()) |
86 | } |
87 | } |
88 | |
89 | #[doc (alias = "gst_gl_framebuffer_get_id" )] |
90 | #[doc (alias = "get_id" )] |
91 | fn id(&self) -> u32 { |
92 | unsafe { ffi::gst_gl_framebuffer_get_id(self.as_ref().to_glib_none().0) } |
93 | } |
94 | } |
95 | |
96 | impl<O: IsA<GLFramebuffer>> GLFramebufferExt for O {} |
97 | |