Skip to main content

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::{AudioVisualizerShader, ffi};
7use glib::{
8    prelude::*,
9    signal::{SignalHandlerId, connect_raw},
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            unsafe {
107                let f: &F = &*(f as *const F);
108                f(AudioVisualizer::from_glib_borrow(this).unsafe_cast_ref())
109            }
110        }
111        unsafe {
112            let f: Box_<F> = Box_::new(f);
113            connect_raw(
114                self.as_ptr() as *mut _,
115                c"notify::shade-amount".as_ptr(),
116                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
117                    notify_shade_amount_trampoline::<Self, F> as *const (),
118                )),
119                Box_::into_raw(f),
120            )
121        }
122    }
123
124    #[doc(alias = "shader")]
125    fn connect_shader_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
126        unsafe extern "C" fn notify_shader_trampoline<
127            P: IsA<AudioVisualizer>,
128            F: Fn(&P) + Send + Sync + 'static,
129        >(
130            this: *mut ffi::GstAudioVisualizer,
131            _param_spec: glib::ffi::gpointer,
132            f: glib::ffi::gpointer,
133        ) {
134            unsafe {
135                let f: &F = &*(f as *const F);
136                f(AudioVisualizer::from_glib_borrow(this).unsafe_cast_ref())
137            }
138        }
139        unsafe {
140            let f: Box_<F> = Box_::new(f);
141            connect_raw(
142                self.as_ptr() as *mut _,
143                c"notify::shader".as_ptr(),
144                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
145                    notify_shader_trampoline::<Self, F> as *const (),
146                )),
147                Box_::into_raw(f),
148            )
149        }
150    }
151}
152
153impl<O: IsA<AudioVisualizer>> AudioVisualizerExt for O {}