gstreamer_gl/auto/
gl_base_src.rs1use crate::ffi;
7#[cfg(feature = "v1_28")]
8#[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
9use crate::GLContext;
10use glib::{
11 prelude::*,
12 signal::{connect_raw, SignalHandlerId},
13 translate::*,
14};
15use std::boxed::Box as Box_;
16
17glib::wrapper! {
18 #[doc(alias = "GstGLBaseSrc")]
19 pub struct GLBaseSrc(Object<ffi::GstGLBaseSrc, ffi::GstGLBaseSrcClass>) @extends gst_base::PushSrc, gst_base::BaseSrc, gst::Element, gst::Object;
20
21 match fn {
22 type_ => || ffi::gst_gl_base_src_get_type(),
23 }
24}
25
26impl GLBaseSrc {
27 pub const NONE: Option<&'static GLBaseSrc> = None;
28}
29
30unsafe impl Send for GLBaseSrc {}
31unsafe impl Sync for GLBaseSrc {}
32
33pub trait GLBaseSrcExt: IsA<GLBaseSrc> + 'static {
34 #[cfg(feature = "v1_28")]
35 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
36 #[doc(alias = "gst_gl_base_src_get_gl_context")]
37 #[doc(alias = "get_gl_context")]
38 fn gl_context(&self) -> Option<GLContext> {
39 unsafe {
40 from_glib_full(ffi::gst_gl_base_src_get_gl_context(
41 self.as_ref().to_glib_none().0,
42 ))
43 }
44 }
45
46 #[doc(alias = "timestamp-offset")]
47 fn timestamp_offset(&self) -> i64 {
48 ObjectExt::property(self.as_ref(), "timestamp-offset")
49 }
50
51 #[doc(alias = "timestamp-offset")]
52 fn set_timestamp_offset(&self, timestamp_offset: i64) {
53 ObjectExt::set_property(self.as_ref(), "timestamp-offset", timestamp_offset)
54 }
55
56 #[doc(alias = "timestamp-offset")]
57 fn connect_timestamp_offset_notify<F: Fn(&Self) + Send + Sync + 'static>(
58 &self,
59 f: F,
60 ) -> SignalHandlerId {
61 unsafe extern "C" fn notify_timestamp_offset_trampoline<
62 P: IsA<GLBaseSrc>,
63 F: Fn(&P) + Send + Sync + 'static,
64 >(
65 this: *mut ffi::GstGLBaseSrc,
66 _param_spec: glib::ffi::gpointer,
67 f: glib::ffi::gpointer,
68 ) {
69 let f: &F = &*(f as *const F);
70 f(GLBaseSrc::from_glib_borrow(this).unsafe_cast_ref())
71 }
72 unsafe {
73 let f: Box_<F> = Box_::new(f);
74 connect_raw(
75 self.as_ptr() as *mut _,
76 c"notify::timestamp-offset".as_ptr() as *const _,
77 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
78 notify_timestamp_offset_trampoline::<Self, F> as *const (),
79 )),
80 Box_::into_raw(f),
81 )
82 }
83 }
84}
85
86impl<O: IsA<GLBaseSrc>> GLBaseSrcExt for O {}