gstreamer_gl/auto/
gl_base_filter.rs1use crate::{ffi, GLContext};
7use glib::{
8 prelude::*,
9 signal::{connect_raw, SignalHandlerId},
10 translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15 #[doc(alias = "GstGLBaseFilter")]
16 pub struct GLBaseFilter(Object<ffi::GstGLBaseFilter, ffi::GstGLBaseFilterClass>) @extends gst_base::BaseTransform, gst::Element, gst::Object;
17
18 match fn {
19 type_ => || ffi::gst_gl_base_filter_get_type(),
20 }
21}
22
23impl GLBaseFilter {
24 pub const NONE: Option<&'static GLBaseFilter> = None;
25}
26
27unsafe impl Send for GLBaseFilter {}
28unsafe impl Sync for GLBaseFilter {}
29
30mod sealed {
31 pub trait Sealed {}
32 impl<T: super::IsA<super::GLBaseFilter>> Sealed for T {}
33}
34
35pub trait GLBaseFilterExt: IsA<GLBaseFilter> + sealed::Sealed + 'static {
36 #[cfg(feature = "v1_16")]
37 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
38 #[doc(alias = "gst_gl_base_filter_find_gl_context")]
39 fn find_gl_context(&self) -> bool {
40 unsafe {
41 from_glib(ffi::gst_gl_base_filter_find_gl_context(
42 self.as_ref().to_glib_none().0,
43 ))
44 }
45 }
46
47 #[cfg(feature = "v1_18")]
48 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
49 #[doc(alias = "gst_gl_base_filter_get_gl_context")]
50 #[doc(alias = "get_gl_context")]
51 fn gl_context(&self) -> Option<GLContext> {
52 unsafe {
53 from_glib_full(ffi::gst_gl_base_filter_get_gl_context(
54 self.as_ref().to_glib_none().0,
55 ))
56 }
57 }
58
59 fn context(&self) -> Option<GLContext> {
60 ObjectExt::property(self.as_ref(), "context")
61 }
62
63 #[doc(alias = "context")]
64 fn connect_context_notify<F: Fn(&Self) + Send + Sync + 'static>(
65 &self,
66 f: F,
67 ) -> SignalHandlerId {
68 unsafe extern "C" fn notify_context_trampoline<
69 P: IsA<GLBaseFilter>,
70 F: Fn(&P) + Send + Sync + 'static,
71 >(
72 this: *mut ffi::GstGLBaseFilter,
73 _param_spec: glib::ffi::gpointer,
74 f: glib::ffi::gpointer,
75 ) {
76 let f: &F = &*(f as *const F);
77 f(GLBaseFilter::from_glib_borrow(this).unsafe_cast_ref())
78 }
79 unsafe {
80 let f: Box_<F> = Box_::new(f);
81 connect_raw(
82 self.as_ptr() as *mut _,
83 b"notify::context\0".as_ptr() as *const _,
84 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
85 notify_context_trampoline::<Self, F> as *const (),
86 )),
87 Box_::into_raw(f),
88 )
89 }
90 }
91}
92
93impl<O: IsA<GLBaseFilter>> GLBaseFilterExt for O {}