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;
7use glib::{
8    prelude::*,
9    signal::{connect_raw, SignalHandlerId},
10    translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15    /// [`GLBaseSrc`][crate::GLBaseSrc] handles the nitty gritty details of retrieving an OpenGL
16    /// context. It also provided some wrappers around [`gst_base::BaseSrc`][crate::gst_base::BaseSrc]'s ``start()`` and
17    /// ``stop()`` virtual methods that ensure an OpenGL context is available and
18    /// current in the calling thread.
19    ///
20    /// This is an Abstract Base Class, you cannot instantiate it.
21    ///
22    /// ## Properties
23    ///
24    ///
25    /// #### `timestamp-offset`
26    ///  Readable | Writeable
27    /// <details><summary><h4>BaseSrc</h4></summary>
28    ///
29    ///
30    /// #### `automatic-eos`
31    ///  See [`BaseSrcExtManual::set_automatic_eos()`][crate::gst_base::prelude::BaseSrcExtManual::set_automatic_eos()]
32    ///
33    /// Readable | Writeable
34    ///
35    ///
36    /// #### `blocksize`
37    ///  Readable | Writeable
38    ///
39    ///
40    /// #### `do-timestamp`
41    ///  Readable | Writeable
42    ///
43    ///
44    /// #### `num-buffers`
45    ///  Readable | Writeable
46    ///
47    ///
48    /// #### `typefind`
49    ///  Readable | Writeable
50    /// </details>
51    /// <details><summary><h4>Object</h4></summary>
52    ///
53    ///
54    /// #### `name`
55    ///  Readable | Writeable | Construct
56    ///
57    ///
58    /// #### `parent`
59    ///  The parent of the object. Please note, that when changing the 'parent'
60    /// property, we don't emit [`notify`][struct@crate::glib::Object#notify] and [`deep-notify`][struct@crate::gst::Object#deep-notify]
61    /// signals due to locking issues. In some cases one can use
62    /// `GstBin::element-added` or `GstBin::element-removed` signals on the parent to
63    /// achieve a similar effect.
64    ///
65    /// Readable | Writeable
66    /// </details>
67    ///
68    /// # Implements
69    ///
70    /// [`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`]
71    #[doc(alias = "GstGLBaseSrc")]
72    pub struct GLBaseSrc(Object<ffi::GstGLBaseSrc, ffi::GstGLBaseSrcClass>) @extends gst_base::PushSrc, gst_base::BaseSrc, gst::Element, gst::Object;
73
74    match fn {
75        type_ => || ffi::gst_gl_base_src_get_type(),
76    }
77}
78
79impl GLBaseSrc {
80    pub const NONE: Option<&'static GLBaseSrc> = None;
81}
82
83unsafe impl Send for GLBaseSrc {}
84unsafe impl Sync for GLBaseSrc {}
85
86/// Trait containing all [`struct@GLBaseSrc`] methods.
87///
88/// # Implementors
89///
90/// [`GLBaseSrc`][struct@crate::GLBaseSrc]
91pub trait GLBaseSrcExt: IsA<GLBaseSrc> + 'static {
92    #[doc(alias = "timestamp-offset")]
93    fn timestamp_offset(&self) -> i64 {
94        ObjectExt::property(self.as_ref(), "timestamp-offset")
95    }
96
97    #[doc(alias = "timestamp-offset")]
98    fn set_timestamp_offset(&self, timestamp_offset: i64) {
99        ObjectExt::set_property(self.as_ref(), "timestamp-offset", timestamp_offset)
100    }
101
102    #[doc(alias = "timestamp-offset")]
103    fn connect_timestamp_offset_notify<F: Fn(&Self) + Send + Sync + 'static>(
104        &self,
105        f: F,
106    ) -> SignalHandlerId {
107        unsafe extern "C" fn notify_timestamp_offset_trampoline<
108            P: IsA<GLBaseSrc>,
109            F: Fn(&P) + Send + Sync + 'static,
110        >(
111            this: *mut ffi::GstGLBaseSrc,
112            _param_spec: glib::ffi::gpointer,
113            f: glib::ffi::gpointer,
114        ) {
115            let f: &F = &*(f as *const F);
116            f(GLBaseSrc::from_glib_borrow(this).unsafe_cast_ref())
117        }
118        unsafe {
119            let f: Box_<F> = Box_::new(f);
120            connect_raw(
121                self.as_ptr() as *mut _,
122                c"notify::timestamp-offset".as_ptr() as *const _,
123                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
124                    notify_timestamp_offset_trampoline::<Self, F> as *const (),
125                )),
126                Box_::into_raw(f),
127            )
128        }
129    }
130}
131
132impl<O: IsA<GLBaseSrc>> GLBaseSrcExt for O {}