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