[go: up one dir, main page]

gvnc/auto/
base_audio.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from
3// from gir-files (https://github.com/gtk-rs/gir-files.git)
4// DO NOT EDIT
5
6use crate::{ffi, Audio, AudioFormat, AudioSample};
7use glib::{
8    object::ObjectType as _,
9    prelude::*,
10    signal::{connect_raw, SignalHandlerId},
11    translate::*,
12};
13use std::boxed::Box as Box_;
14
15glib::wrapper! {
16    #[doc(alias = "VncBaseAudio")]
17    pub struct BaseAudio(Object<ffi::VncBaseAudio, ffi::VncBaseAudioClass>) @implements Audio;
18
19    match fn {
20        type_ => || ffi::vnc_base_audio_get_type(),
21    }
22}
23
24impl BaseAudio {
25    pub const NONE: Option<&'static BaseAudio> = None;
26
27    #[doc(alias = "vnc_base_audio_new")]
28    pub fn new() -> BaseAudio {
29        assert_initialized_main_thread!();
30        unsafe { from_glib_full(ffi::vnc_base_audio_new()) }
31    }
32}
33
34impl Default for BaseAudio {
35    fn default() -> Self {
36        Self::new()
37    }
38}
39
40mod sealed {
41    pub trait Sealed {}
42    impl<T: super::IsA<super::BaseAudio>> Sealed for T {}
43}
44
45pub trait BaseAudioExt: IsA<BaseAudio> + sealed::Sealed + 'static {
46    #[doc(alias = "vnc-audio-playback-data")]
47    fn connect_vnc_audio_playback_data<F: Fn(&Self, &AudioSample) + 'static>(
48        &self,
49        f: F,
50    ) -> SignalHandlerId {
51        unsafe extern "C" fn vnc_audio_playback_data_trampoline<
52            P: IsA<BaseAudio>,
53            F: Fn(&P, &AudioSample) + 'static,
54        >(
55            this: *mut ffi::VncBaseAudio,
56            object: *mut ffi::VncAudioSample,
57            f: glib::ffi::gpointer,
58        ) {
59            let f: &F = &*(f as *const F);
60            f(
61                BaseAudio::from_glib_borrow(this).unsafe_cast_ref(),
62                &from_glib_borrow(object),
63            )
64        }
65        unsafe {
66            let f: Box_<F> = Box_::new(f);
67            connect_raw(
68                self.as_ptr() as *mut _,
69                b"vnc-audio-playback-data\0".as_ptr() as *const _,
70                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
71                    vnc_audio_playback_data_trampoline::<Self, F> as *const (),
72                )),
73                Box_::into_raw(f),
74            )
75        }
76    }
77
78    #[doc(alias = "vnc-audio-playback-start")]
79    fn connect_vnc_audio_playback_start<F: Fn(&Self, &AudioFormat) + 'static>(
80        &self,
81        f: F,
82    ) -> SignalHandlerId {
83        unsafe extern "C" fn vnc_audio_playback_start_trampoline<
84            P: IsA<BaseAudio>,
85            F: Fn(&P, &AudioFormat) + 'static,
86        >(
87            this: *mut ffi::VncBaseAudio,
88            object: *mut ffi::VncAudioFormat,
89            f: glib::ffi::gpointer,
90        ) {
91            let f: &F = &*(f as *const F);
92            f(
93                BaseAudio::from_glib_borrow(this).unsafe_cast_ref(),
94                &from_glib_borrow(object),
95            )
96        }
97        unsafe {
98            let f: Box_<F> = Box_::new(f);
99            connect_raw(
100                self.as_ptr() as *mut _,
101                b"vnc-audio-playback-start\0".as_ptr() as *const _,
102                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
103                    vnc_audio_playback_start_trampoline::<Self, F> as *const (),
104                )),
105                Box_::into_raw(f),
106            )
107        }
108    }
109
110    #[doc(alias = "vnc-audio-playback-stop")]
111    fn connect_vnc_audio_playback_stop<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
112        unsafe extern "C" fn vnc_audio_playback_stop_trampoline<
113            P: IsA<BaseAudio>,
114            F: Fn(&P) + 'static,
115        >(
116            this: *mut ffi::VncBaseAudio,
117            f: glib::ffi::gpointer,
118        ) {
119            let f: &F = &*(f as *const F);
120            f(BaseAudio::from_glib_borrow(this).unsafe_cast_ref())
121        }
122        unsafe {
123            let f: Box_<F> = Box_::new(f);
124            connect_raw(
125                self.as_ptr() as *mut _,
126                b"vnc-audio-playback-stop\0".as_ptr() as *const _,
127                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
128                    vnc_audio_playback_stop_trampoline::<Self, F> as *const (),
129                )),
130                Box_::into_raw(f),
131            )
132        }
133    }
134}
135
136impl<O: IsA<BaseAudio>> BaseAudioExt for O {}