gstreamer_gl/auto/
gl_base_filter.rs1use crate::{GLContext, ffi};
7use glib::{
8 prelude::*,
9 signal::{SignalHandlerId, connect_raw},
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
30pub trait GLBaseFilterExt: IsA<GLBaseFilter> + 'static {
31 #[cfg(feature = "v1_16")]
32 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
33 #[doc(alias = "gst_gl_base_filter_find_gl_context")]
34 fn find_gl_context(&self) -> bool {
35 unsafe {
36 from_glib(ffi::gst_gl_base_filter_find_gl_context(
37 self.as_ref().to_glib_none().0,
38 ))
39 }
40 }
41
42 #[cfg(feature = "v1_18")]
43 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
44 #[doc(alias = "gst_gl_base_filter_get_gl_context")]
45 #[doc(alias = "get_gl_context")]
46 fn gl_context(&self) -> Option<GLContext> {
47 unsafe {
48 from_glib_full(ffi::gst_gl_base_filter_get_gl_context(
49 self.as_ref().to_glib_none().0,
50 ))
51 }
52 }
53
54 fn context(&self) -> Option<GLContext> {
55 ObjectExt::property(self.as_ref(), "context")
56 }
57
58 #[doc(alias = "context")]
59 fn connect_context_notify<F: Fn(&Self) + Send + Sync + 'static>(
60 &self,
61 f: F,
62 ) -> SignalHandlerId {
63 unsafe extern "C" fn notify_context_trampoline<
64 P: IsA<GLBaseFilter>,
65 F: Fn(&P) + Send + Sync + 'static,
66 >(
67 this: *mut ffi::GstGLBaseFilter,
68 _param_spec: glib::ffi::gpointer,
69 f: glib::ffi::gpointer,
70 ) {
71 unsafe {
72 let f: &F = &*(f as *const F);
73 f(GLBaseFilter::from_glib_borrow(this).unsafe_cast_ref())
74 }
75 }
76 unsafe {
77 let f: Box_<F> = Box_::new(f);
78 connect_raw(
79 self.as_ptr() as *mut _,
80 c"notify::context".as_ptr(),
81 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
82 notify_context_trampoline::<Self, F> as *const (),
83 )),
84 Box_::into_raw(f),
85 )
86 }
87 }
88}
89
90impl<O: IsA<GLBaseFilter>> GLBaseFilterExt for O {}