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