gstreamer_gl/auto/
gl_framebuffer.rs1use crate::{GLBaseMemory, GLContext, ffi};
7use glib::{prelude::*, translate::*};
8
9glib::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
18impl 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
49unsafe impl Send for GLFramebuffer {}
50unsafe impl Sync for GLFramebuffer {}
51
52pub trait GLFramebufferExt: IsA<GLFramebuffer> + 'static {
53 #[doc(alias = "gst_gl_framebuffer_attach")]
54 unsafe fn attach(&self, attachment_point: u32, mem: &mut GLBaseMemory) {
55 unsafe {
56 ffi::gst_gl_framebuffer_attach(
57 self.as_ref().to_glib_none().0,
58 attachment_point,
59 mem.to_glib_none_mut().0,
60 );
61 }
62 }
63
64 #[doc(alias = "gst_gl_framebuffer_bind")]
65 fn bind(&self) {
66 unsafe {
67 ffi::gst_gl_framebuffer_bind(self.as_ref().to_glib_none().0);
68 }
69 }
70
71 #[doc(alias = "gst_gl_framebuffer_get_effective_dimensions")]
72 #[doc(alias = "get_effective_dimensions")]
73 fn effective_dimensions(&self) -> (u32, u32) {
74 unsafe {
75 let mut width = std::mem::MaybeUninit::uninit();
76 let mut height = std::mem::MaybeUninit::uninit();
77 ffi::gst_gl_framebuffer_get_effective_dimensions(
78 self.as_ref().to_glib_none().0,
79 width.as_mut_ptr(),
80 height.as_mut_ptr(),
81 );
82 (width.assume_init(), height.assume_init())
83 }
84 }
85
86 #[doc(alias = "gst_gl_framebuffer_get_id")]
87 #[doc(alias = "get_id")]
88 fn id(&self) -> u32 {
89 unsafe { ffi::gst_gl_framebuffer_get_id(self.as_ref().to_glib_none().0) }
90 }
91}
92
93impl<O: IsA<GLFramebuffer>> GLFramebufferExt for O {}