gstreamer_pbutils/auto/
audio_visualizer.rs1use 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 #[doc(alias = "GstAudioVisualizer")]
16 pub struct AudioVisualizer(Object<ffi::GstAudioVisualizer, ffi::GstAudioVisualizerClass>) @extends gst::Element, gst::Object;
17
18 match fn {
19 type_ => || ffi::gst_audio_visualizer_get_type(),
20 }
21}
22
23impl AudioVisualizer {
24 pub const NONE: Option<&'static AudioVisualizer> = None;
25}
26
27unsafe impl Send for AudioVisualizer {}
28unsafe impl Sync for AudioVisualizer {}
29
30pub trait AudioVisualizerExt: IsA<AudioVisualizer> + 'static {
31 #[doc(alias = "shade-amount")]
32 fn shade_amount(&self) -> u32 {
33 ObjectExt::property(self.as_ref(), "shade-amount")
34 }
35
36 #[doc(alias = "shade-amount")]
37 fn set_shade_amount(&self, shade_amount: u32) {
38 ObjectExt::set_property(self.as_ref(), "shade-amount", shade_amount)
39 }
40
41 fn shader(&self) -> AudioVisualizerShader {
42 ObjectExt::property(self.as_ref(), "shader")
43 }
44
45 fn set_shader(&self, shader: AudioVisualizerShader) {
46 ObjectExt::set_property(self.as_ref(), "shader", shader)
47 }
48
49 #[doc(alias = "shade-amount")]
50 fn connect_shade_amount_notify<F: Fn(&Self) + Send + Sync + 'static>(
51 &self,
52 f: F,
53 ) -> SignalHandlerId {
54 unsafe extern "C" fn notify_shade_amount_trampoline<
55 P: IsA<AudioVisualizer>,
56 F: Fn(&P) + Send + Sync + 'static,
57 >(
58 this: *mut ffi::GstAudioVisualizer,
59 _param_spec: glib::ffi::gpointer,
60 f: glib::ffi::gpointer,
61 ) {
62 unsafe {
63 let f: &F = &*(f as *const F);
64 f(AudioVisualizer::from_glib_borrow(this).unsafe_cast_ref())
65 }
66 }
67 unsafe {
68 let f: Box_<F> = Box_::new(f);
69 connect_raw(
70 self.as_ptr() as *mut _,
71 c"notify::shade-amount".as_ptr(),
72 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
73 notify_shade_amount_trampoline::<Self, F> as *const (),
74 )),
75 Box_::into_raw(f),
76 )
77 }
78 }
79
80 #[doc(alias = "shader")]
81 fn connect_shader_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
82 unsafe extern "C" fn notify_shader_trampoline<
83 P: IsA<AudioVisualizer>,
84 F: Fn(&P) + Send + Sync + 'static,
85 >(
86 this: *mut ffi::GstAudioVisualizer,
87 _param_spec: glib::ffi::gpointer,
88 f: glib::ffi::gpointer,
89 ) {
90 unsafe {
91 let f: &F = &*(f as *const F);
92 f(AudioVisualizer::from_glib_borrow(this).unsafe_cast_ref())
93 }
94 }
95 unsafe {
96 let f: Box_<F> = Box_::new(f);
97 connect_raw(
98 self.as_ptr() as *mut _,
99 c"notify::shader".as_ptr(),
100 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
101 notify_shader_trampoline::<Self, F> as *const (),
102 )),
103 Box_::into_raw(f),
104 )
105 }
106 }
107}
108
109impl<O: IsA<AudioVisualizer>> AudioVisualizerExt for O {}