gstreamer_audio/auto/
audio_base_sink.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;
7use glib::{
8    prelude::*,
9    signal::{connect_raw, SignalHandlerId},
10    translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15    #[doc(alias = "GstAudioBaseSink")]
16    pub struct AudioBaseSink(Object<ffi::GstAudioBaseSink, ffi::GstAudioBaseSinkClass>) @extends gst_base::BaseSink, gst::Element, gst::Object;
17
18    match fn {
19        type_ => || ffi::gst_audio_base_sink_get_type(),
20    }
21}
22
23impl AudioBaseSink {
24    pub const NONE: Option<&'static AudioBaseSink> = None;
25}
26
27unsafe impl Send for AudioBaseSink {}
28unsafe impl Sync for AudioBaseSink {}
29
30pub trait AudioBaseSinkExt: IsA<AudioBaseSink> + 'static {
31    //#[doc(alias = "gst_audio_base_sink_create_ringbuffer")]
32    //fn create_ringbuffer(&self) -> /*Ignored*/Option<AudioRingBuffer> {
33    //    unsafe { TODO: call ffi:gst_audio_base_sink_create_ringbuffer() }
34    //}
35
36    #[doc(alias = "gst_audio_base_sink_get_alignment_threshold")]
37    #[doc(alias = "get_alignment_threshold")]
38    #[doc(alias = "alignment-threshold")]
39    fn alignment_threshold(&self) -> gst::ClockTime {
40        unsafe {
41            try_from_glib(ffi::gst_audio_base_sink_get_alignment_threshold(
42                self.as_ref().to_glib_none().0,
43            ))
44            .expect("mandatory glib value is None")
45        }
46    }
47
48    #[doc(alias = "gst_audio_base_sink_get_discont_wait")]
49    #[doc(alias = "get_discont_wait")]
50    #[doc(alias = "discont-wait")]
51    fn discont_wait(&self) -> gst::ClockTime {
52        unsafe {
53            try_from_glib(ffi::gst_audio_base_sink_get_discont_wait(
54                self.as_ref().to_glib_none().0,
55            ))
56            .expect("mandatory glib value is None")
57        }
58    }
59
60    #[doc(alias = "gst_audio_base_sink_get_drift_tolerance")]
61    #[doc(alias = "get_drift_tolerance")]
62    #[doc(alias = "drift-tolerance")]
63    fn drift_tolerance(&self) -> i64 {
64        unsafe { ffi::gst_audio_base_sink_get_drift_tolerance(self.as_ref().to_glib_none().0) }
65    }
66
67    #[doc(alias = "gst_audio_base_sink_get_provide_clock")]
68    #[doc(alias = "get_provide_clock")]
69    #[doc(alias = "provide-clock")]
70    fn is_provide_clock(&self) -> bool {
71        unsafe {
72            from_glib(ffi::gst_audio_base_sink_get_provide_clock(
73                self.as_ref().to_glib_none().0,
74            ))
75        }
76    }
77
78    //#[doc(alias = "gst_audio_base_sink_get_slave_method")]
79    //#[doc(alias = "get_slave_method")]
80    //#[doc(alias = "slave-method")]
81    //fn slave_method(&self) -> /*Ignored*/AudioBaseSinkSlaveMethod {
82    //    unsafe { TODO: call ffi:gst_audio_base_sink_get_slave_method() }
83    //}
84
85    #[doc(alias = "gst_audio_base_sink_report_device_failure")]
86    fn report_device_failure(&self) {
87        unsafe {
88            ffi::gst_audio_base_sink_report_device_failure(self.as_ref().to_glib_none().0);
89        }
90    }
91
92    #[doc(alias = "gst_audio_base_sink_set_alignment_threshold")]
93    #[doc(alias = "alignment-threshold")]
94    fn set_alignment_threshold(&self, alignment_threshold: gst::ClockTime) {
95        unsafe {
96            ffi::gst_audio_base_sink_set_alignment_threshold(
97                self.as_ref().to_glib_none().0,
98                alignment_threshold.into_glib(),
99            );
100        }
101    }
102
103    //#[doc(alias = "gst_audio_base_sink_set_custom_slaving_callback")]
104    //fn set_custom_slaving_callback(&self, callback: /*Unimplemented*/Fn(&AudioBaseSink, impl Into<Option<gst::ClockTime>>, impl Into<Option<gst::ClockTime>>, gst::ClockTimeDiff, /*Ignored*/AudioBaseSinkDiscontReason), user_data: /*Unimplemented*/Option<Basic: Pointer>) {
105    //    unsafe { TODO: call ffi:gst_audio_base_sink_set_custom_slaving_callback() }
106    //}
107
108    #[doc(alias = "gst_audio_base_sink_set_discont_wait")]
109    #[doc(alias = "discont-wait")]
110    fn set_discont_wait(&self, discont_wait: gst::ClockTime) {
111        unsafe {
112            ffi::gst_audio_base_sink_set_discont_wait(
113                self.as_ref().to_glib_none().0,
114                discont_wait.into_glib(),
115            );
116        }
117    }
118
119    #[doc(alias = "gst_audio_base_sink_set_drift_tolerance")]
120    #[doc(alias = "drift-tolerance")]
121    fn set_drift_tolerance(&self, drift_tolerance: i64) {
122        unsafe {
123            ffi::gst_audio_base_sink_set_drift_tolerance(
124                self.as_ref().to_glib_none().0,
125                drift_tolerance,
126            );
127        }
128    }
129
130    #[doc(alias = "gst_audio_base_sink_set_provide_clock")]
131    #[doc(alias = "provide-clock")]
132    fn set_provide_clock(&self, provide: bool) {
133        unsafe {
134            ffi::gst_audio_base_sink_set_provide_clock(
135                self.as_ref().to_glib_none().0,
136                provide.into_glib(),
137            );
138        }
139    }
140
141    //#[doc(alias = "gst_audio_base_sink_set_slave_method")]
142    //#[doc(alias = "slave-method")]
143    //fn set_slave_method(&self, method: /*Ignored*/AudioBaseSinkSlaveMethod) {
144    //    unsafe { TODO: call ffi:gst_audio_base_sink_set_slave_method() }
145    //}
146
147    #[doc(alias = "buffer-time")]
148    fn buffer_time(&self) -> i64 {
149        ObjectExt::property(self.as_ref(), "buffer-time")
150    }
151
152    #[doc(alias = "buffer-time")]
153    fn set_buffer_time(&self, buffer_time: i64) {
154        ObjectExt::set_property(self.as_ref(), "buffer-time", buffer_time)
155    }
156
157    #[doc(alias = "can-activate-pull")]
158    fn can_activate_pull(&self) -> bool {
159        ObjectExt::property(self.as_ref(), "can-activate-pull")
160    }
161
162    #[doc(alias = "can-activate-pull")]
163    fn set_can_activate_pull(&self, can_activate_pull: bool) {
164        ObjectExt::set_property(self.as_ref(), "can-activate-pull", can_activate_pull)
165    }
166
167    #[doc(alias = "latency-time")]
168    fn latency_time(&self) -> i64 {
169        ObjectExt::property(self.as_ref(), "latency-time")
170    }
171
172    #[doc(alias = "latency-time")]
173    fn set_latency_time(&self, latency_time: i64) {
174        ObjectExt::set_property(self.as_ref(), "latency-time", latency_time)
175    }
176
177    #[doc(alias = "alignment-threshold")]
178    fn connect_alignment_threshold_notify<F: Fn(&Self) + Send + Sync + 'static>(
179        &self,
180        f: F,
181    ) -> SignalHandlerId {
182        unsafe extern "C" fn notify_alignment_threshold_trampoline<
183            P: IsA<AudioBaseSink>,
184            F: Fn(&P) + Send + Sync + 'static,
185        >(
186            this: *mut ffi::GstAudioBaseSink,
187            _param_spec: glib::ffi::gpointer,
188            f: glib::ffi::gpointer,
189        ) {
190            let f: &F = &*(f as *const F);
191            f(AudioBaseSink::from_glib_borrow(this).unsafe_cast_ref())
192        }
193        unsafe {
194            let f: Box_<F> = Box_::new(f);
195            connect_raw(
196                self.as_ptr() as *mut _,
197                c"notify::alignment-threshold".as_ptr() as *const _,
198                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
199                    notify_alignment_threshold_trampoline::<Self, F> as *const (),
200                )),
201                Box_::into_raw(f),
202            )
203        }
204    }
205
206    #[doc(alias = "buffer-time")]
207    fn connect_buffer_time_notify<F: Fn(&Self) + Send + Sync + 'static>(
208        &self,
209        f: F,
210    ) -> SignalHandlerId {
211        unsafe extern "C" fn notify_buffer_time_trampoline<
212            P: IsA<AudioBaseSink>,
213            F: Fn(&P) + Send + Sync + 'static,
214        >(
215            this: *mut ffi::GstAudioBaseSink,
216            _param_spec: glib::ffi::gpointer,
217            f: glib::ffi::gpointer,
218        ) {
219            let f: &F = &*(f as *const F);
220            f(AudioBaseSink::from_glib_borrow(this).unsafe_cast_ref())
221        }
222        unsafe {
223            let f: Box_<F> = Box_::new(f);
224            connect_raw(
225                self.as_ptr() as *mut _,
226                c"notify::buffer-time".as_ptr() as *const _,
227                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
228                    notify_buffer_time_trampoline::<Self, F> as *const (),
229                )),
230                Box_::into_raw(f),
231            )
232        }
233    }
234
235    #[doc(alias = "can-activate-pull")]
236    fn connect_can_activate_pull_notify<F: Fn(&Self) + Send + Sync + 'static>(
237        &self,
238        f: F,
239    ) -> SignalHandlerId {
240        unsafe extern "C" fn notify_can_activate_pull_trampoline<
241            P: IsA<AudioBaseSink>,
242            F: Fn(&P) + Send + Sync + 'static,
243        >(
244            this: *mut ffi::GstAudioBaseSink,
245            _param_spec: glib::ffi::gpointer,
246            f: glib::ffi::gpointer,
247        ) {
248            let f: &F = &*(f as *const F);
249            f(AudioBaseSink::from_glib_borrow(this).unsafe_cast_ref())
250        }
251        unsafe {
252            let f: Box_<F> = Box_::new(f);
253            connect_raw(
254                self.as_ptr() as *mut _,
255                c"notify::can-activate-pull".as_ptr() as *const _,
256                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
257                    notify_can_activate_pull_trampoline::<Self, F> as *const (),
258                )),
259                Box_::into_raw(f),
260            )
261        }
262    }
263
264    #[doc(alias = "discont-wait")]
265    fn connect_discont_wait_notify<F: Fn(&Self) + Send + Sync + 'static>(
266        &self,
267        f: F,
268    ) -> SignalHandlerId {
269        unsafe extern "C" fn notify_discont_wait_trampoline<
270            P: IsA<AudioBaseSink>,
271            F: Fn(&P) + Send + Sync + 'static,
272        >(
273            this: *mut ffi::GstAudioBaseSink,
274            _param_spec: glib::ffi::gpointer,
275            f: glib::ffi::gpointer,
276        ) {
277            let f: &F = &*(f as *const F);
278            f(AudioBaseSink::from_glib_borrow(this).unsafe_cast_ref())
279        }
280        unsafe {
281            let f: Box_<F> = Box_::new(f);
282            connect_raw(
283                self.as_ptr() as *mut _,
284                c"notify::discont-wait".as_ptr() as *const _,
285                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
286                    notify_discont_wait_trampoline::<Self, F> as *const (),
287                )),
288                Box_::into_raw(f),
289            )
290        }
291    }
292
293    #[doc(alias = "drift-tolerance")]
294    fn connect_drift_tolerance_notify<F: Fn(&Self) + Send + Sync + 'static>(
295        &self,
296        f: F,
297    ) -> SignalHandlerId {
298        unsafe extern "C" fn notify_drift_tolerance_trampoline<
299            P: IsA<AudioBaseSink>,
300            F: Fn(&P) + Send + Sync + 'static,
301        >(
302            this: *mut ffi::GstAudioBaseSink,
303            _param_spec: glib::ffi::gpointer,
304            f: glib::ffi::gpointer,
305        ) {
306            let f: &F = &*(f as *const F);
307            f(AudioBaseSink::from_glib_borrow(this).unsafe_cast_ref())
308        }
309        unsafe {
310            let f: Box_<F> = Box_::new(f);
311            connect_raw(
312                self.as_ptr() as *mut _,
313                c"notify::drift-tolerance".as_ptr() as *const _,
314                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
315                    notify_drift_tolerance_trampoline::<Self, F> as *const (),
316                )),
317                Box_::into_raw(f),
318            )
319        }
320    }
321
322    #[doc(alias = "latency-time")]
323    fn connect_latency_time_notify<F: Fn(&Self) + Send + Sync + 'static>(
324        &self,
325        f: F,
326    ) -> SignalHandlerId {
327        unsafe extern "C" fn notify_latency_time_trampoline<
328            P: IsA<AudioBaseSink>,
329            F: Fn(&P) + Send + Sync + 'static,
330        >(
331            this: *mut ffi::GstAudioBaseSink,
332            _param_spec: glib::ffi::gpointer,
333            f: glib::ffi::gpointer,
334        ) {
335            let f: &F = &*(f as *const F);
336            f(AudioBaseSink::from_glib_borrow(this).unsafe_cast_ref())
337        }
338        unsafe {
339            let f: Box_<F> = Box_::new(f);
340            connect_raw(
341                self.as_ptr() as *mut _,
342                c"notify::latency-time".as_ptr() as *const _,
343                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
344                    notify_latency_time_trampoline::<Self, F> as *const (),
345                )),
346                Box_::into_raw(f),
347            )
348        }
349    }
350
351    #[doc(alias = "provide-clock")]
352    fn connect_provide_clock_notify<F: Fn(&Self) + Send + Sync + 'static>(
353        &self,
354        f: F,
355    ) -> SignalHandlerId {
356        unsafe extern "C" fn notify_provide_clock_trampoline<
357            P: IsA<AudioBaseSink>,
358            F: Fn(&P) + Send + Sync + 'static,
359        >(
360            this: *mut ffi::GstAudioBaseSink,
361            _param_spec: glib::ffi::gpointer,
362            f: glib::ffi::gpointer,
363        ) {
364            let f: &F = &*(f as *const F);
365            f(AudioBaseSink::from_glib_borrow(this).unsafe_cast_ref())
366        }
367        unsafe {
368            let f: Box_<F> = Box_::new(f);
369            connect_raw(
370                self.as_ptr() as *mut _,
371                c"notify::provide-clock".as_ptr() as *const _,
372                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
373                    notify_provide_clock_trampoline::<Self, F> as *const (),
374                )),
375                Box_::into_raw(f),
376            )
377        }
378    }
379
380    #[doc(alias = "slave-method")]
381    fn connect_slave_method_notify<F: Fn(&Self) + Send + Sync + 'static>(
382        &self,
383        f: F,
384    ) -> SignalHandlerId {
385        unsafe extern "C" fn notify_slave_method_trampoline<
386            P: IsA<AudioBaseSink>,
387            F: Fn(&P) + Send + Sync + 'static,
388        >(
389            this: *mut ffi::GstAudioBaseSink,
390            _param_spec: glib::ffi::gpointer,
391            f: glib::ffi::gpointer,
392        ) {
393            let f: &F = &*(f as *const F);
394            f(AudioBaseSink::from_glib_borrow(this).unsafe_cast_ref())
395        }
396        unsafe {
397            let f: Box_<F> = Box_::new(f);
398            connect_raw(
399                self.as_ptr() as *mut _,
400                c"notify::slave-method".as_ptr() as *const _,
401                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
402                    notify_slave_method_trampoline::<Self, F> as *const (),
403                )),
404                Box_::into_raw(f),
405            )
406        }
407    }
408}
409
410impl<O: IsA<AudioBaseSink>> AudioBaseSinkExt for O {}