gstreamer_pbutils/auto/
audio_visualizer.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, AudioVisualizerShader};
7use glib::{
8    prelude::*,
9    signal::{connect_raw, SignalHandlerId},
10    translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15    /// A baseclass for scopes (visualizers). It takes care of re-fitting the
16    /// audio-rate to video-rate and handles renegotiation (downstream video size
17    /// changes).
18    ///
19    /// It also provides several background shading effects. These effects are
20    /// applied to a previous picture before the ``render()`` implementation can draw a
21    /// new frame.
22    ///
23    /// This is an Abstract Base Class, you cannot instantiate it.
24    ///
25    /// ## Properties
26    ///
27    ///
28    /// #### `shade-amount`
29    ///  Readable | Writeable
30    ///
31    ///
32    /// #### `shader`
33    ///  Readable | Writeable
34    /// <details><summary><h4>Object</h4></summary>
35    ///
36    ///
37    /// #### `name`
38    ///  Readable | Writeable | Construct
39    ///
40    ///
41    /// #### `parent`
42    ///  The parent of the object. Please note, that when changing the 'parent'
43    /// property, we don't emit [`notify`][struct@crate::glib::Object#notify] and [`deep-notify`][struct@crate::gst::Object#deep-notify]
44    /// signals due to locking issues. In some cases one can use
45    /// `GstBin::element-added` or `GstBin::element-removed` signals on the parent to
46    /// achieve a similar effect.
47    ///
48    /// Readable | Writeable
49    /// </details>
50    ///
51    /// # Implements
52    ///
53    /// [`AudioVisualizerExt`][trait@crate::prelude::AudioVisualizerExt], [`trait@gst::prelude::ElementExt`], [`trait@gst::prelude::ObjectExt`], [`trait@glib::ObjectExt`]
54    #[doc(alias = "GstAudioVisualizer")]
55    pub struct AudioVisualizer(Object<ffi::GstAudioVisualizer, ffi::GstAudioVisualizerClass>) @extends gst::Element, gst::Object;
56
57    match fn {
58        type_ => || ffi::gst_audio_visualizer_get_type(),
59    }
60}
61
62impl AudioVisualizer {
63    pub const NONE: Option<&'static AudioVisualizer> = None;
64}
65
66unsafe impl Send for AudioVisualizer {}
67unsafe impl Sync for AudioVisualizer {}
68
69/// Trait containing all [`struct@AudioVisualizer`] methods.
70///
71/// # Implementors
72///
73/// [`AudioVisualizer`][struct@crate::AudioVisualizer]
74pub trait AudioVisualizerExt: IsA<AudioVisualizer> + 'static {
75    #[doc(alias = "shade-amount")]
76    fn shade_amount(&self) -> u32 {
77        ObjectExt::property(self.as_ref(), "shade-amount")
78    }
79
80    #[doc(alias = "shade-amount")]
81    fn set_shade_amount(&self, shade_amount: u32) {
82        ObjectExt::set_property(self.as_ref(), "shade-amount", shade_amount)
83    }
84
85    fn shader(&self) -> AudioVisualizerShader {
86        ObjectExt::property(self.as_ref(), "shader")
87    }
88
89    fn set_shader(&self, shader: AudioVisualizerShader) {
90        ObjectExt::set_property(self.as_ref(), "shader", shader)
91    }
92
93    #[doc(alias = "shade-amount")]
94    fn connect_shade_amount_notify<F: Fn(&Self) + Send + Sync + 'static>(
95        &self,
96        f: F,
97    ) -> SignalHandlerId {
98        unsafe extern "C" fn notify_shade_amount_trampoline<
99            P: IsA<AudioVisualizer>,
100            F: Fn(&P) + Send + Sync + 'static,
101        >(
102            this: *mut ffi::GstAudioVisualizer,
103            _param_spec: glib::ffi::gpointer,
104            f: glib::ffi::gpointer,
105        ) {
106            let f: &F = &*(f as *const F);
107            f(AudioVisualizer::from_glib_borrow(this).unsafe_cast_ref())
108        }
109        unsafe {
110            let f: Box_<F> = Box_::new(f);
111            connect_raw(
112                self.as_ptr() as *mut _,
113                c"notify::shade-amount".as_ptr() as *const _,
114                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
115                    notify_shade_amount_trampoline::<Self, F> as *const (),
116                )),
117                Box_::into_raw(f),
118            )
119        }
120    }
121
122    #[doc(alias = "shader")]
123    fn connect_shader_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
124        unsafe extern "C" fn notify_shader_trampoline<
125            P: IsA<AudioVisualizer>,
126            F: Fn(&P) + Send + Sync + 'static,
127        >(
128            this: *mut ffi::GstAudioVisualizer,
129            _param_spec: glib::ffi::gpointer,
130            f: glib::ffi::gpointer,
131        ) {
132            let f: &F = &*(f as *const F);
133            f(AudioVisualizer::from_glib_borrow(this).unsafe_cast_ref())
134        }
135        unsafe {
136            let f: Box_<F> = Box_::new(f);
137            connect_raw(
138                self.as_ptr() as *mut _,
139                c"notify::shader".as_ptr() as *const _,
140                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
141                    notify_shader_trampoline::<Self, F> as *const (),
142                )),
143                Box_::into_raw(f),
144            )
145        }
146    }
147}
148
149impl<O: IsA<AudioVisualizer>> AudioVisualizerExt for O {}