gstreamer_pbutils/auto/
audio_visualizer.rs
1use 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
69mod sealed {
70 pub trait Sealed {}
71 impl<T: super::IsA<super::AudioVisualizer>> Sealed for T {}
72}
73
74pub 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 {}