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    #[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            let f: &F = &*(f as *const F);
63            f(AudioVisualizer::from_glib_borrow(this).unsafe_cast_ref())
64        }
65        unsafe {
66            let f: Box_<F> = Box_::new(f);
67            connect_raw(
68                self.as_ptr() as *mut _,
69                c"notify::shade-amount".as_ptr() as *const _,
70                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
71                    notify_shade_amount_trampoline::<Self, F> as *const (),
72                )),
73                Box_::into_raw(f),
74            )
75        }
76    }
77
78    #[doc(alias = "shader")]
79    fn connect_shader_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
80        unsafe extern "C" fn notify_shader_trampoline<
81            P: IsA<AudioVisualizer>,
82            F: Fn(&P) + Send + Sync + 'static,
83        >(
84            this: *mut ffi::GstAudioVisualizer,
85            _param_spec: glib::ffi::gpointer,
86            f: glib::ffi::gpointer,
87        ) {
88            let f: &F = &*(f as *const F);
89            f(AudioVisualizer::from_glib_borrow(this).unsafe_cast_ref())
90        }
91        unsafe {
92            let f: Box_<F> = Box_::new(f);
93            connect_raw(
94                self.as_ptr() as *mut _,
95                c"notify::shader".as_ptr() as *const _,
96                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
97                    notify_shader_trampoline::<Self, F> as *const (),
98                )),
99                Box_::into_raw(f),
100            )
101        }
102    }
103}
104
105impl<O: IsA<AudioVisualizer>> AudioVisualizerExt for O {}