gstreamer_gl/auto/gl_base_src.rs
1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
4// DO NOT EDIT
5
6use 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 /// [`GLBaseSrc`][crate::GLBaseSrc] handles the nitty gritty details of retrieving an OpenGL
19 /// context. It also provided some wrappers around [`gst_base::BaseSrc`][crate::gst_base::BaseSrc]'s ``start()`` and
20 /// ``stop()`` virtual methods that ensure an OpenGL context is available and
21 /// current in the calling thread.
22 ///
23 /// This is an Abstract Base Class, you cannot instantiate it.
24 ///
25 /// ## Properties
26 ///
27 ///
28 /// #### `timestamp-offset`
29 /// Readable | Writeable
30 /// <details><summary><h4>BaseSrc</h4></summary>
31 ///
32 ///
33 /// #### `automatic-eos`
34 /// See [`BaseSrcExtManual::set_automatic_eos()`][crate::gst_base::prelude::BaseSrcExtManual::set_automatic_eos()]
35 ///
36 /// Readable | Writeable
37 ///
38 ///
39 /// #### `blocksize`
40 /// Readable | Writeable
41 ///
42 ///
43 /// #### `do-timestamp`
44 /// Readable | Writeable
45 ///
46 ///
47 /// #### `num-buffers`
48 /// Readable | Writeable
49 ///
50 ///
51 /// #### `typefind`
52 /// Readable | Writeable
53 /// </details>
54 /// <details><summary><h4>Object</h4></summary>
55 ///
56 ///
57 /// #### `name`
58 /// Readable | Writeable | Construct
59 ///
60 ///
61 /// #### `parent`
62 /// The parent of the object. Please note, that when changing the 'parent'
63 /// property, we don't emit [`notify`][struct@crate::glib::Object#notify] and [`deep-notify`][struct@crate::gst::Object#deep-notify]
64 /// signals due to locking issues. In some cases one can use
65 /// `GstBin::element-added` or `GstBin::element-removed` signals on the parent to
66 /// achieve a similar effect.
67 ///
68 /// Readable | Writeable
69 /// </details>
70 ///
71 /// # Implements
72 ///
73 /// [`GLBaseSrcExt`][trait@crate::prelude::GLBaseSrcExt], [`trait@gst_base::prelude::PushSrcExt`], [`trait@gst_base::prelude::BaseSrcExt`], [`trait@gst::prelude::ElementExt`], [`trait@gst::prelude::ObjectExt`], [`trait@glib::ObjectExt`]
74 #[doc(alias = "GstGLBaseSrc")]
75 pub struct GLBaseSrc(Object<ffi::GstGLBaseSrc, ffi::GstGLBaseSrcClass>) @extends gst_base::PushSrc, gst_base::BaseSrc, gst::Element, gst::Object;
76
77 match fn {
78 type_ => || ffi::gst_gl_base_src_get_type(),
79 }
80}
81
82impl GLBaseSrc {
83 pub const NONE: Option<&'static GLBaseSrc> = None;
84}
85
86unsafe impl Send for GLBaseSrc {}
87unsafe impl Sync for GLBaseSrc {}
88
89/// Trait containing all [`struct@GLBaseSrc`] methods.
90///
91/// # Implementors
92///
93/// [`GLBaseSrc`][struct@crate::GLBaseSrc]
94pub trait GLBaseSrcExt: IsA<GLBaseSrc> + 'static {
95 ///
96 /// # Returns
97 ///
98 /// the configured [`GLContext`][crate::GLContext].
99 #[cfg(feature = "v1_28")]
100 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
101 #[doc(alias = "gst_gl_base_src_get_gl_context")]
102 #[doc(alias = "get_gl_context")]
103 fn gl_context(&self) -> Option<GLContext> {
104 unsafe {
105 from_glib_full(ffi::gst_gl_base_src_get_gl_context(
106 self.as_ref().to_glib_none().0,
107 ))
108 }
109 }
110
111 #[doc(alias = "timestamp-offset")]
112 fn timestamp_offset(&self) -> i64 {
113 ObjectExt::property(self.as_ref(), "timestamp-offset")
114 }
115
116 #[doc(alias = "timestamp-offset")]
117 fn set_timestamp_offset(&self, timestamp_offset: i64) {
118 ObjectExt::set_property(self.as_ref(), "timestamp-offset", timestamp_offset)
119 }
120
121 #[doc(alias = "timestamp-offset")]
122 fn connect_timestamp_offset_notify<F: Fn(&Self) + Send + Sync + 'static>(
123 &self,
124 f: F,
125 ) -> SignalHandlerId {
126 unsafe extern "C" fn notify_timestamp_offset_trampoline<
127 P: IsA<GLBaseSrc>,
128 F: Fn(&P) + Send + Sync + 'static,
129 >(
130 this: *mut ffi::GstGLBaseSrc,
131 _param_spec: glib::ffi::gpointer,
132 f: glib::ffi::gpointer,
133 ) {
134 let f: &F = &*(f as *const F);
135 f(GLBaseSrc::from_glib_borrow(this).unsafe_cast_ref())
136 }
137 unsafe {
138 let f: Box_<F> = Box_::new(f);
139 connect_raw(
140 self.as_ptr() as *mut _,
141 c"notify::timestamp-offset".as_ptr() as *const _,
142 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
143 notify_timestamp_offset_trampoline::<Self, F> as *const (),
144 )),
145 Box_::into_raw(f),
146 )
147 }
148 }
149}
150
151impl<O: IsA<GLBaseSrc>> GLBaseSrcExt for O {}