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
69mod sealed {
70    pub trait Sealed {}
71    impl<T: super::IsA<super::AudioVisualizer>> Sealed for T {}
72}
73
74/// Trait containing all [`struct@AudioVisualizer`] methods.
75///
76/// # Implementors
77///
78/// [`AudioVisualizer`][struct@crate::AudioVisualizer]
79pub trait AudioVisualizerExt: IsA<AudioVisualizer> + sealed::Sealed + 'static {
80    #[doc(alias = "shade-amount")]
81    fn shade_amount(&self) -> u32 {
82        ObjectExt::property(self.as_ref(), "shade-amount")
83    }
84
85    #[doc(alias = "shade-amount")]
86    fn set_shade_amount(&self, shade_amount: u32) {
87        ObjectExt::set_property(self.as_ref(), "shade-amount", shade_amount)
88    }
89
90    fn shader(&self) -> AudioVisualizerShader {
91        ObjectExt::property(self.as_ref(), "shader")
92    }
93
94    fn set_shader(&self, shader: AudioVisualizerShader) {
95        ObjectExt::set_property(self.as_ref(), "shader", shader)
96    }
97
98    #[doc(alias = "shade-amount")]
99    fn connect_shade_amount_notify<F: Fn(&Self) + Send + Sync + 'static>(
100        &self,
101        f: F,
102    ) -> SignalHandlerId {
103        unsafe extern "C" fn notify_shade_amount_trampoline<
104            P: IsA<AudioVisualizer>,
105            F: Fn(&P) + Send + Sync + 'static,
106        >(
107            this: *mut ffi::GstAudioVisualizer,
108            _param_spec: glib::ffi::gpointer,
109            f: glib::ffi::gpointer,
110        ) {
111            let f: &F = &*(f as *const F);
112            f(AudioVisualizer::from_glib_borrow(this).unsafe_cast_ref())
113        }
114        unsafe {
115            let f: Box_<F> = Box_::new(f);
116            connect_raw(
117                self.as_ptr() as *mut _,
118                b"notify::shade-amount\0".as_ptr() as *const _,
119                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
120                    notify_shade_amount_trampoline::<Self, F> as *const (),
121                )),
122                Box_::into_raw(f),
123            )
124        }
125    }
126
127    #[doc(alias = "shader")]
128    fn connect_shader_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
129        unsafe extern "C" fn notify_shader_trampoline<
130            P: IsA<AudioVisualizer>,
131            F: Fn(&P) + Send + Sync + 'static,
132        >(
133            this: *mut ffi::GstAudioVisualizer,
134            _param_spec: glib::ffi::gpointer,
135            f: glib::ffi::gpointer,
136        ) {
137            let f: &F = &*(f as *const F);
138            f(AudioVisualizer::from_glib_borrow(this).unsafe_cast_ref())
139        }
140        unsafe {
141            let f: Box_<F> = Box_::new(f);
142            connect_raw(
143                self.as_ptr() as *mut _,
144                b"notify::shader\0".as_ptr() as *const _,
145                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
146                    notify_shader_trampoline::<Self, F> as *const (),
147                )),
148                Box_::into_raw(f),
149            )
150        }
151    }
152}
153
154impl<O: IsA<AudioVisualizer>> AudioVisualizerExt for O {}