Skip to main content

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::{SignalHandlerId, connect_raw},
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            unsafe {
191                let f: &F = &*(f as *const F);
192                f(AudioBaseSink::from_glib_borrow(this).unsafe_cast_ref())
193            }
194        }
195        unsafe {
196            let f: Box_<F> = Box_::new(f);
197            connect_raw(
198                self.as_ptr() as *mut _,
199                c"notify::alignment-threshold".as_ptr(),
200                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
201                    notify_alignment_threshold_trampoline::<Self, F> as *const (),
202                )),
203                Box_::into_raw(f),
204            )
205        }
206    }
207
208    #[doc(alias = "buffer-time")]
209    fn connect_buffer_time_notify<F: Fn(&Self) + Send + Sync + 'static>(
210        &self,
211        f: F,
212    ) -> SignalHandlerId {
213        unsafe extern "C" fn notify_buffer_time_trampoline<
214            P: IsA<AudioBaseSink>,
215            F: Fn(&P) + Send + Sync + 'static,
216        >(
217            this: *mut ffi::GstAudioBaseSink,
218            _param_spec: glib::ffi::gpointer,
219            f: glib::ffi::gpointer,
220        ) {
221            unsafe {
222                let f: &F = &*(f as *const F);
223                f(AudioBaseSink::from_glib_borrow(this).unsafe_cast_ref())
224            }
225        }
226        unsafe {
227            let f: Box_<F> = Box_::new(f);
228            connect_raw(
229                self.as_ptr() as *mut _,
230                c"notify::buffer-time".as_ptr(),
231                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
232                    notify_buffer_time_trampoline::<Self, F> as *const (),
233                )),
234                Box_::into_raw(f),
235            )
236        }
237    }
238
239    #[doc(alias = "can-activate-pull")]
240    fn connect_can_activate_pull_notify<F: Fn(&Self) + Send + Sync + 'static>(
241        &self,
242        f: F,
243    ) -> SignalHandlerId {
244        unsafe extern "C" fn notify_can_activate_pull_trampoline<
245            P: IsA<AudioBaseSink>,
246            F: Fn(&P) + Send + Sync + 'static,
247        >(
248            this: *mut ffi::GstAudioBaseSink,
249            _param_spec: glib::ffi::gpointer,
250            f: glib::ffi::gpointer,
251        ) {
252            unsafe {
253                let f: &F = &*(f as *const F);
254                f(AudioBaseSink::from_glib_borrow(this).unsafe_cast_ref())
255            }
256        }
257        unsafe {
258            let f: Box_<F> = Box_::new(f);
259            connect_raw(
260                self.as_ptr() as *mut _,
261                c"notify::can-activate-pull".as_ptr(),
262                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
263                    notify_can_activate_pull_trampoline::<Self, F> as *const (),
264                )),
265                Box_::into_raw(f),
266            )
267        }
268    }
269
270    #[doc(alias = "discont-wait")]
271    fn connect_discont_wait_notify<F: Fn(&Self) + Send + Sync + 'static>(
272        &self,
273        f: F,
274    ) -> SignalHandlerId {
275        unsafe extern "C" fn notify_discont_wait_trampoline<
276            P: IsA<AudioBaseSink>,
277            F: Fn(&P) + Send + Sync + 'static,
278        >(
279            this: *mut ffi::GstAudioBaseSink,
280            _param_spec: glib::ffi::gpointer,
281            f: glib::ffi::gpointer,
282        ) {
283            unsafe {
284                let f: &F = &*(f as *const F);
285                f(AudioBaseSink::from_glib_borrow(this).unsafe_cast_ref())
286            }
287        }
288        unsafe {
289            let f: Box_<F> = Box_::new(f);
290            connect_raw(
291                self.as_ptr() as *mut _,
292                c"notify::discont-wait".as_ptr(),
293                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
294                    notify_discont_wait_trampoline::<Self, F> as *const (),
295                )),
296                Box_::into_raw(f),
297            )
298        }
299    }
300
301    #[doc(alias = "drift-tolerance")]
302    fn connect_drift_tolerance_notify<F: Fn(&Self) + Send + Sync + 'static>(
303        &self,
304        f: F,
305    ) -> SignalHandlerId {
306        unsafe extern "C" fn notify_drift_tolerance_trampoline<
307            P: IsA<AudioBaseSink>,
308            F: Fn(&P) + Send + Sync + 'static,
309        >(
310            this: *mut ffi::GstAudioBaseSink,
311            _param_spec: glib::ffi::gpointer,
312            f: glib::ffi::gpointer,
313        ) {
314            unsafe {
315                let f: &F = &*(f as *const F);
316                f(AudioBaseSink::from_glib_borrow(this).unsafe_cast_ref())
317            }
318        }
319        unsafe {
320            let f: Box_<F> = Box_::new(f);
321            connect_raw(
322                self.as_ptr() as *mut _,
323                c"notify::drift-tolerance".as_ptr(),
324                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
325                    notify_drift_tolerance_trampoline::<Self, F> as *const (),
326                )),
327                Box_::into_raw(f),
328            )
329        }
330    }
331
332    #[doc(alias = "latency-time")]
333    fn connect_latency_time_notify<F: Fn(&Self) + Send + Sync + 'static>(
334        &self,
335        f: F,
336    ) -> SignalHandlerId {
337        unsafe extern "C" fn notify_latency_time_trampoline<
338            P: IsA<AudioBaseSink>,
339            F: Fn(&P) + Send + Sync + 'static,
340        >(
341            this: *mut ffi::GstAudioBaseSink,
342            _param_spec: glib::ffi::gpointer,
343            f: glib::ffi::gpointer,
344        ) {
345            unsafe {
346                let f: &F = &*(f as *const F);
347                f(AudioBaseSink::from_glib_borrow(this).unsafe_cast_ref())
348            }
349        }
350        unsafe {
351            let f: Box_<F> = Box_::new(f);
352            connect_raw(
353                self.as_ptr() as *mut _,
354                c"notify::latency-time".as_ptr(),
355                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
356                    notify_latency_time_trampoline::<Self, F> as *const (),
357                )),
358                Box_::into_raw(f),
359            )
360        }
361    }
362
363    #[doc(alias = "provide-clock")]
364    fn connect_provide_clock_notify<F: Fn(&Self) + Send + Sync + 'static>(
365        &self,
366        f: F,
367    ) -> SignalHandlerId {
368        unsafe extern "C" fn notify_provide_clock_trampoline<
369            P: IsA<AudioBaseSink>,
370            F: Fn(&P) + Send + Sync + 'static,
371        >(
372            this: *mut ffi::GstAudioBaseSink,
373            _param_spec: glib::ffi::gpointer,
374            f: glib::ffi::gpointer,
375        ) {
376            unsafe {
377                let f: &F = &*(f as *const F);
378                f(AudioBaseSink::from_glib_borrow(this).unsafe_cast_ref())
379            }
380        }
381        unsafe {
382            let f: Box_<F> = Box_::new(f);
383            connect_raw(
384                self.as_ptr() as *mut _,
385                c"notify::provide-clock".as_ptr(),
386                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
387                    notify_provide_clock_trampoline::<Self, F> as *const (),
388                )),
389                Box_::into_raw(f),
390            )
391        }
392    }
393
394    #[doc(alias = "slave-method")]
395    fn connect_slave_method_notify<F: Fn(&Self) + Send + Sync + 'static>(
396        &self,
397        f: F,
398    ) -> SignalHandlerId {
399        unsafe extern "C" fn notify_slave_method_trampoline<
400            P: IsA<AudioBaseSink>,
401            F: Fn(&P) + Send + Sync + 'static,
402        >(
403            this: *mut ffi::GstAudioBaseSink,
404            _param_spec: glib::ffi::gpointer,
405            f: glib::ffi::gpointer,
406        ) {
407            unsafe {
408                let f: &F = &*(f as *const F);
409                f(AudioBaseSink::from_glib_borrow(this).unsafe_cast_ref())
410            }
411        }
412        unsafe {
413            let f: Box_<F> = Box_::new(f);
414            connect_raw(
415                self.as_ptr() as *mut _,
416                c"notify::slave-method".as_ptr(),
417                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
418                    notify_slave_method_trampoline::<Self, F> as *const (),
419                )),
420                Box_::into_raw(f),
421            )
422        }
423    }
424}
425
426impl<O: IsA<AudioBaseSink>> AudioBaseSinkExt for O {}