gstreamer_audio/auto/
audio_aggregator.rs1use 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 = "GstAudioAggregator")]
16 pub struct AudioAggregator(Object<ffi::GstAudioAggregator, ffi::GstAudioAggregatorClass>) @extends gst_base::Aggregator, gst::Element, gst::Object;
17
18 match fn {
19 type_ => || ffi::gst_audio_aggregator_get_type(),
20 }
21}
22
23impl AudioAggregator {
24 pub const NONE: Option<&'static AudioAggregator> = None;
25}
26
27unsafe impl Send for AudioAggregator {}
28unsafe impl Sync for AudioAggregator {}
29
30pub trait AudioAggregatorExt: IsA<AudioAggregator> + 'static {
31 #[cfg(feature = "v1_30")]
32 #[cfg_attr(docsrs, doc(cfg(feature = "v1_30")))]
33 #[doc(alias = "gst_audio_aggregator_has_current_output_buffer")]
34 fn has_current_output_buffer(&self) -> bool {
35 unsafe {
36 from_glib(ffi::gst_audio_aggregator_has_current_output_buffer(
37 self.as_ref().to_glib_none().0,
38 ))
39 }
40 }
41
42 #[doc(alias = "alignment-threshold")]
43 fn alignment_threshold(&self) -> u64 {
44 ObjectExt::property(self.as_ref(), "alignment-threshold")
45 }
46
47 #[doc(alias = "alignment-threshold")]
48 fn set_alignment_threshold(&self, alignment_threshold: u64) {
49 ObjectExt::set_property(self.as_ref(), "alignment-threshold", alignment_threshold)
50 }
51
52 #[doc(alias = "discont-wait")]
53 fn discont_wait(&self) -> u64 {
54 ObjectExt::property(self.as_ref(), "discont-wait")
55 }
56
57 #[doc(alias = "discont-wait")]
58 fn set_discont_wait(&self, discont_wait: u64) {
59 ObjectExt::set_property(self.as_ref(), "discont-wait", discont_wait)
60 }
61
62 #[doc(alias = "output-buffer-duration")]
63 fn output_buffer_duration(&self) -> u64 {
64 ObjectExt::property(self.as_ref(), "output-buffer-duration")
65 }
66
67 #[doc(alias = "output-buffer-duration")]
68 fn set_output_buffer_duration(&self, output_buffer_duration: u64) {
69 ObjectExt::set_property(
70 self.as_ref(),
71 "output-buffer-duration",
72 output_buffer_duration,
73 )
74 }
75
76 #[doc(alias = "alignment-threshold")]
77 fn connect_alignment_threshold_notify<F: Fn(&Self) + Send + Sync + 'static>(
78 &self,
79 f: F,
80 ) -> SignalHandlerId {
81 unsafe extern "C" fn notify_alignment_threshold_trampoline<
82 P: IsA<AudioAggregator>,
83 F: Fn(&P) + Send + Sync + 'static,
84 >(
85 this: *mut ffi::GstAudioAggregator,
86 _param_spec: glib::ffi::gpointer,
87 f: glib::ffi::gpointer,
88 ) {
89 unsafe {
90 let f: &F = &*(f as *const F);
91 f(AudioAggregator::from_glib_borrow(this).unsafe_cast_ref())
92 }
93 }
94 unsafe {
95 let f: Box_<F> = Box_::new(f);
96 connect_raw(
97 self.as_ptr() as *mut _,
98 c"notify::alignment-threshold".as_ptr(),
99 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
100 notify_alignment_threshold_trampoline::<Self, F> as *const (),
101 )),
102 Box_::into_raw(f),
103 )
104 }
105 }
106
107 #[doc(alias = "discont-wait")]
108 fn connect_discont_wait_notify<F: Fn(&Self) + Send + Sync + 'static>(
109 &self,
110 f: F,
111 ) -> SignalHandlerId {
112 unsafe extern "C" fn notify_discont_wait_trampoline<
113 P: IsA<AudioAggregator>,
114 F: Fn(&P) + Send + Sync + 'static,
115 >(
116 this: *mut ffi::GstAudioAggregator,
117 _param_spec: glib::ffi::gpointer,
118 f: glib::ffi::gpointer,
119 ) {
120 unsafe {
121 let f: &F = &*(f as *const F);
122 f(AudioAggregator::from_glib_borrow(this).unsafe_cast_ref())
123 }
124 }
125 unsafe {
126 let f: Box_<F> = Box_::new(f);
127 connect_raw(
128 self.as_ptr() as *mut _,
129 c"notify::discont-wait".as_ptr(),
130 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
131 notify_discont_wait_trampoline::<Self, F> as *const (),
132 )),
133 Box_::into_raw(f),
134 )
135 }
136 }
137
138 #[doc(alias = "output-buffer-duration")]
139 fn connect_output_buffer_duration_notify<F: Fn(&Self) + Send + Sync + 'static>(
140 &self,
141 f: F,
142 ) -> SignalHandlerId {
143 unsafe extern "C" fn notify_output_buffer_duration_trampoline<
144 P: IsA<AudioAggregator>,
145 F: Fn(&P) + Send + Sync + 'static,
146 >(
147 this: *mut ffi::GstAudioAggregator,
148 _param_spec: glib::ffi::gpointer,
149 f: glib::ffi::gpointer,
150 ) {
151 unsafe {
152 let f: &F = &*(f as *const F);
153 f(AudioAggregator::from_glib_borrow(this).unsafe_cast_ref())
154 }
155 }
156 unsafe {
157 let f: Box_<F> = Box_::new(f);
158 connect_raw(
159 self.as_ptr() as *mut _,
160 c"notify::output-buffer-duration".as_ptr(),
161 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
162 notify_output_buffer_duration_trampoline::<Self, F> as *const (),
163 )),
164 Box_::into_raw(f),
165 )
166 }
167 }
168}
169
170impl<O: IsA<AudioAggregator>> AudioAggregatorExt for O {}