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 | |
6 | use crate::ffi; |
7 | use glib::{ |
8 | prelude::*, |
9 | signal::{connect_raw, SignalHandlerId}, |
10 | translate::*, |
11 | }; |
12 | use std::boxed::Box as Box_; |
13 | |
14 | glib::wrapper! { |
15 | #[doc (alias = "GstAudioBaseSrc" )] |
16 | pub struct AudioBaseSrc(Object<ffi::GstAudioBaseSrc, ffi::GstAudioBaseSrcClass>) @extends gst_base::BaseSrc, gst::Element, gst::Object; |
17 | |
18 | match fn { |
19 | type_ => || ffi::gst_audio_base_src_get_type(), |
20 | } |
21 | } |
22 | |
23 | impl AudioBaseSrc { |
24 | pub const NONE: Option<&'static AudioBaseSrc> = None; |
25 | } |
26 | |
27 | unsafe impl Send for AudioBaseSrc {} |
28 | unsafe impl Sync for AudioBaseSrc {} |
29 | |
30 | mod sealed { |
31 | pub trait Sealed {} |
32 | impl<T: super::IsA<super::AudioBaseSrc>> Sealed for T {} |
33 | } |
34 | |
35 | pub trait AudioBaseSrcExt: IsA<AudioBaseSrc> + sealed::Sealed + 'static { |
36 | //#[doc(alias = "gst_audio_base_src_create_ringbuffer")] |
37 | //fn create_ringbuffer(&self) -> /*Ignored*/Option<AudioRingBuffer> { |
38 | // unsafe { TODO: call ffi:gst_audio_base_src_create_ringbuffer() } |
39 | //} |
40 | |
41 | #[doc (alias = "gst_audio_base_src_get_provide_clock" )] |
42 | #[doc (alias = "get_provide_clock" )] |
43 | #[doc (alias = "provide-clock" )] |
44 | fn is_provide_clock(&self) -> bool { |
45 | unsafe { |
46 | from_glib(ffi::gst_audio_base_src_get_provide_clock( |
47 | self.as_ref().to_glib_none().0, |
48 | )) |
49 | } |
50 | } |
51 | |
52 | //#[doc(alias = "gst_audio_base_src_get_slave_method")] |
53 | //#[doc(alias = "get_slave_method")] |
54 | //#[doc(alias = "slave-method")] |
55 | //fn slave_method(&self) -> /*Ignored*/AudioBaseSrcSlaveMethod { |
56 | // unsafe { TODO: call ffi:gst_audio_base_src_get_slave_method() } |
57 | //} |
58 | |
59 | #[doc (alias = "gst_audio_base_src_set_provide_clock" )] |
60 | #[doc (alias = "provide-clock" )] |
61 | fn set_provide_clock(&self, provide: bool) { |
62 | unsafe { |
63 | ffi::gst_audio_base_src_set_provide_clock( |
64 | self.as_ref().to_glib_none().0, |
65 | provide.into_glib(), |
66 | ); |
67 | } |
68 | } |
69 | |
70 | //#[doc(alias = "gst_audio_base_src_set_slave_method")] |
71 | //#[doc(alias = "slave-method")] |
72 | //fn set_slave_method(&self, method: /*Ignored*/AudioBaseSrcSlaveMethod) { |
73 | // unsafe { TODO: call ffi:gst_audio_base_src_set_slave_method() } |
74 | //} |
75 | |
76 | #[doc (alias = "actual-buffer-time" )] |
77 | fn actual_buffer_time(&self) -> i64 { |
78 | ObjectExt::property(self.as_ref(), "actual-buffer-time" ) |
79 | } |
80 | |
81 | #[doc (alias = "actual-latency-time" )] |
82 | fn actual_latency_time(&self) -> i64 { |
83 | ObjectExt::property(self.as_ref(), "actual-latency-time" ) |
84 | } |
85 | |
86 | #[doc (alias = "buffer-time" )] |
87 | fn buffer_time(&self) -> i64 { |
88 | ObjectExt::property(self.as_ref(), "buffer-time" ) |
89 | } |
90 | |
91 | #[doc (alias = "buffer-time" )] |
92 | fn set_buffer_time(&self, buffer_time: i64) { |
93 | ObjectExt::set_property(self.as_ref(), "buffer-time" , buffer_time) |
94 | } |
95 | |
96 | #[doc (alias = "latency-time" )] |
97 | fn latency_time(&self) -> i64 { |
98 | ObjectExt::property(self.as_ref(), "latency-time" ) |
99 | } |
100 | |
101 | #[doc (alias = "latency-time" )] |
102 | fn set_latency_time(&self, latency_time: i64) { |
103 | ObjectExt::set_property(self.as_ref(), "latency-time" , latency_time) |
104 | } |
105 | |
106 | #[doc (alias = "actual-buffer-time" )] |
107 | fn connect_actual_buffer_time_notify<F: Fn(&Self) + Send + Sync + 'static>( |
108 | &self, |
109 | f: F, |
110 | ) -> SignalHandlerId { |
111 | unsafe extern "C" fn notify_actual_buffer_time_trampoline< |
112 | P: IsA<AudioBaseSrc>, |
113 | F: Fn(&P) + Send + Sync + 'static, |
114 | >( |
115 | this: *mut ffi::GstAudioBaseSrc, |
116 | _param_spec: glib::ffi::gpointer, |
117 | f: glib::ffi::gpointer, |
118 | ) { |
119 | let f: &F = &*(f as *const F); |
120 | f(AudioBaseSrc::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"notify::actual-buffer-time \0" .as_ptr() as *const _, |
127 | Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( |
128 | notify_actual_buffer_time_trampoline::<Self, F> as *const (), |
129 | )), |
130 | Box_::into_raw(f), |
131 | ) |
132 | } |
133 | } |
134 | |
135 | #[doc (alias = "actual-latency-time" )] |
136 | fn connect_actual_latency_time_notify<F: Fn(&Self) + Send + Sync + 'static>( |
137 | &self, |
138 | f: F, |
139 | ) -> SignalHandlerId { |
140 | unsafe extern "C" fn notify_actual_latency_time_trampoline< |
141 | P: IsA<AudioBaseSrc>, |
142 | F: Fn(&P) + Send + Sync + 'static, |
143 | >( |
144 | this: *mut ffi::GstAudioBaseSrc, |
145 | _param_spec: glib::ffi::gpointer, |
146 | f: glib::ffi::gpointer, |
147 | ) { |
148 | let f: &F = &*(f as *const F); |
149 | f(AudioBaseSrc::from_glib_borrow(this).unsafe_cast_ref()) |
150 | } |
151 | unsafe { |
152 | let f: Box_<F> = Box_::new(f); |
153 | connect_raw( |
154 | self.as_ptr() as *mut _, |
155 | b"notify::actual-latency-time \0" .as_ptr() as *const _, |
156 | Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( |
157 | notify_actual_latency_time_trampoline::<Self, F> as *const (), |
158 | )), |
159 | Box_::into_raw(f), |
160 | ) |
161 | } |
162 | } |
163 | |
164 | #[doc (alias = "buffer-time" )] |
165 | fn connect_buffer_time_notify<F: Fn(&Self) + Send + Sync + 'static>( |
166 | &self, |
167 | f: F, |
168 | ) -> SignalHandlerId { |
169 | unsafe extern "C" fn notify_buffer_time_trampoline< |
170 | P: IsA<AudioBaseSrc>, |
171 | F: Fn(&P) + Send + Sync + 'static, |
172 | >( |
173 | this: *mut ffi::GstAudioBaseSrc, |
174 | _param_spec: glib::ffi::gpointer, |
175 | f: glib::ffi::gpointer, |
176 | ) { |
177 | let f: &F = &*(f as *const F); |
178 | f(AudioBaseSrc::from_glib_borrow(this).unsafe_cast_ref()) |
179 | } |
180 | unsafe { |
181 | let f: Box_<F> = Box_::new(f); |
182 | connect_raw( |
183 | self.as_ptr() as *mut _, |
184 | b"notify::buffer-time \0" .as_ptr() as *const _, |
185 | Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( |
186 | notify_buffer_time_trampoline::<Self, F> as *const (), |
187 | )), |
188 | Box_::into_raw(f), |
189 | ) |
190 | } |
191 | } |
192 | |
193 | #[doc (alias = "latency-time" )] |
194 | fn connect_latency_time_notify<F: Fn(&Self) + Send + Sync + 'static>( |
195 | &self, |
196 | f: F, |
197 | ) -> SignalHandlerId { |
198 | unsafe extern "C" fn notify_latency_time_trampoline< |
199 | P: IsA<AudioBaseSrc>, |
200 | F: Fn(&P) + Send + Sync + 'static, |
201 | >( |
202 | this: *mut ffi::GstAudioBaseSrc, |
203 | _param_spec: glib::ffi::gpointer, |
204 | f: glib::ffi::gpointer, |
205 | ) { |
206 | let f: &F = &*(f as *const F); |
207 | f(AudioBaseSrc::from_glib_borrow(this).unsafe_cast_ref()) |
208 | } |
209 | unsafe { |
210 | let f: Box_<F> = Box_::new(f); |
211 | connect_raw( |
212 | self.as_ptr() as *mut _, |
213 | b"notify::latency-time \0" .as_ptr() as *const _, |
214 | Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( |
215 | notify_latency_time_trampoline::<Self, F> as *const (), |
216 | )), |
217 | Box_::into_raw(f), |
218 | ) |
219 | } |
220 | } |
221 | |
222 | #[doc (alias = "provide-clock" )] |
223 | fn connect_provide_clock_notify<F: Fn(&Self) + Send + Sync + 'static>( |
224 | &self, |
225 | f: F, |
226 | ) -> SignalHandlerId { |
227 | unsafe extern "C" fn notify_provide_clock_trampoline< |
228 | P: IsA<AudioBaseSrc>, |
229 | F: Fn(&P) + Send + Sync + 'static, |
230 | >( |
231 | this: *mut ffi::GstAudioBaseSrc, |
232 | _param_spec: glib::ffi::gpointer, |
233 | f: glib::ffi::gpointer, |
234 | ) { |
235 | let f: &F = &*(f as *const F); |
236 | f(AudioBaseSrc::from_glib_borrow(this).unsafe_cast_ref()) |
237 | } |
238 | unsafe { |
239 | let f: Box_<F> = Box_::new(f); |
240 | connect_raw( |
241 | self.as_ptr() as *mut _, |
242 | b"notify::provide-clock \0" .as_ptr() as *const _, |
243 | Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( |
244 | notify_provide_clock_trampoline::<Self, F> as *const (), |
245 | )), |
246 | Box_::into_raw(f), |
247 | ) |
248 | } |
249 | } |
250 | |
251 | #[doc (alias = "slave-method" )] |
252 | fn connect_slave_method_notify<F: Fn(&Self) + Send + Sync + 'static>( |
253 | &self, |
254 | f: F, |
255 | ) -> SignalHandlerId { |
256 | unsafe extern "C" fn notify_slave_method_trampoline< |
257 | P: IsA<AudioBaseSrc>, |
258 | F: Fn(&P) + Send + Sync + 'static, |
259 | >( |
260 | this: *mut ffi::GstAudioBaseSrc, |
261 | _param_spec: glib::ffi::gpointer, |
262 | f: glib::ffi::gpointer, |
263 | ) { |
264 | let f: &F = &*(f as *const F); |
265 | f(AudioBaseSrc::from_glib_borrow(this).unsafe_cast_ref()) |
266 | } |
267 | unsafe { |
268 | let f: Box_<F> = Box_::new(f); |
269 | connect_raw( |
270 | self.as_ptr() as *mut _, |
271 | b"notify::slave-method \0" .as_ptr() as *const _, |
272 | Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( |
273 | notify_slave_method_trampoline::<Self, F> as *const (), |
274 | )), |
275 | Box_::into_raw(f), |
276 | ) |
277 | } |
278 | } |
279 | } |
280 | |
281 | impl<O: IsA<AudioBaseSrc>> AudioBaseSrcExt for O {} |
282 | |