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")]
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 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 {}