gstreamer_pbutils/auto/
audio_visualizer.rs1use 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    #[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
69pub 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 {}