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 glib::{ |
7 | prelude::*, |
8 | signal::{connect_raw, SignalHandlerId}, |
9 | translate::*, |
10 | }; |
11 | use std::{boxed::Box as Box_, mem, mem::transmute}; |
12 | |
13 | glib::wrapper! { |
14 | #[doc (alias = "GstBaseSink" )] |
15 | pub struct BaseSink(Object<ffi::GstBaseSink, ffi::GstBaseSinkClass>) @extends gst::Element, gst::Object; |
16 | |
17 | match fn { |
18 | type_ => || ffi::gst_base_sink_get_type(), |
19 | } |
20 | } |
21 | |
22 | impl BaseSink { |
23 | pub const NONE: Option<&'static BaseSink> = None; |
24 | } |
25 | |
26 | unsafe impl Send for BaseSink {} |
27 | unsafe impl Sync for BaseSink {} |
28 | |
29 | mod sealed { |
30 | pub trait Sealed {} |
31 | impl<T: super::IsA<super::BaseSink>> Sealed for T {} |
32 | } |
33 | |
34 | pub trait BaseSinkExt: IsA<BaseSink> + sealed::Sealed + 'static { |
35 | //#[doc(alias = "gst_base_sink_do_preroll")] |
36 | //fn do_preroll(&self, obj: /*Ignored*/&gst::MiniObject) -> Result<gst::FlowSuccess, gst::FlowError> { |
37 | // unsafe { TODO: call ffi:gst_base_sink_do_preroll() } |
38 | //} |
39 | |
40 | #[doc (alias = "gst_base_sink_get_blocksize" )] |
41 | #[doc (alias = "get_blocksize" )] |
42 | fn blocksize(&self) -> u32 { |
43 | unsafe { ffi::gst_base_sink_get_blocksize(self.as_ref().to_glib_none().0) } |
44 | } |
45 | |
46 | #[doc (alias = "gst_base_sink_get_drop_out_of_segment" )] |
47 | #[doc (alias = "get_drop_out_of_segment" )] |
48 | fn drops_out_of_segment(&self) -> bool { |
49 | unsafe { |
50 | from_glib(ffi::gst_base_sink_get_drop_out_of_segment( |
51 | self.as_ref().to_glib_none().0, |
52 | )) |
53 | } |
54 | } |
55 | |
56 | #[doc (alias = "gst_base_sink_get_last_sample" )] |
57 | #[doc (alias = "get_last_sample" )] |
58 | fn last_sample(&self) -> Option<gst::Sample> { |
59 | unsafe { |
60 | from_glib_full(ffi::gst_base_sink_get_last_sample( |
61 | self.as_ref().to_glib_none().0, |
62 | )) |
63 | } |
64 | } |
65 | |
66 | #[doc (alias = "gst_base_sink_get_latency" )] |
67 | #[doc (alias = "get_latency" )] |
68 | fn latency(&self) -> gst::ClockTime { |
69 | unsafe { |
70 | try_from_glib(ffi::gst_base_sink_get_latency( |
71 | self.as_ref().to_glib_none().0, |
72 | )) |
73 | .expect("mandatory glib value is None" ) |
74 | } |
75 | } |
76 | |
77 | #[doc (alias = "gst_base_sink_get_max_bitrate" )] |
78 | #[doc (alias = "get_max_bitrate" )] |
79 | fn max_bitrate(&self) -> u64 { |
80 | unsafe { ffi::gst_base_sink_get_max_bitrate(self.as_ref().to_glib_none().0) } |
81 | } |
82 | |
83 | #[doc (alias = "gst_base_sink_get_max_lateness" )] |
84 | #[doc (alias = "get_max_lateness" )] |
85 | fn max_lateness(&self) -> i64 { |
86 | unsafe { ffi::gst_base_sink_get_max_lateness(self.as_ref().to_glib_none().0) } |
87 | } |
88 | |
89 | #[cfg (feature = "v1_16" )] |
90 | #[cfg_attr (docsrs, doc(cfg(feature = "v1_16" )))] |
91 | #[doc (alias = "gst_base_sink_get_processing_deadline" )] |
92 | #[doc (alias = "get_processing_deadline" )] |
93 | fn processing_deadline(&self) -> gst::ClockTime { |
94 | unsafe { |
95 | try_from_glib(ffi::gst_base_sink_get_processing_deadline( |
96 | self.as_ref().to_glib_none().0, |
97 | )) |
98 | .expect("mandatory glib value is None" ) |
99 | } |
100 | } |
101 | |
102 | #[doc (alias = "gst_base_sink_get_render_delay" )] |
103 | #[doc (alias = "get_render_delay" )] |
104 | fn render_delay(&self) -> gst::ClockTime { |
105 | unsafe { |
106 | try_from_glib(ffi::gst_base_sink_get_render_delay( |
107 | self.as_ref().to_glib_none().0, |
108 | )) |
109 | .expect("mandatory glib value is None" ) |
110 | } |
111 | } |
112 | |
113 | #[cfg (feature = "v1_18" )] |
114 | #[cfg_attr (docsrs, doc(cfg(feature = "v1_18" )))] |
115 | #[doc (alias = "gst_base_sink_get_stats" )] |
116 | #[doc (alias = "get_stats" )] |
117 | fn stats(&self) -> gst::Structure { |
118 | unsafe { from_glib_full(ffi::gst_base_sink_get_stats(self.as_ref().to_glib_none().0)) } |
119 | } |
120 | |
121 | #[doc (alias = "gst_base_sink_get_sync" )] |
122 | #[doc (alias = "get_sync" )] |
123 | fn is_sync(&self) -> bool { |
124 | unsafe { from_glib(ffi::gst_base_sink_get_sync(self.as_ref().to_glib_none().0)) } |
125 | } |
126 | |
127 | #[doc (alias = "gst_base_sink_get_throttle_time" )] |
128 | #[doc (alias = "get_throttle_time" )] |
129 | fn throttle_time(&self) -> u64 { |
130 | unsafe { ffi::gst_base_sink_get_throttle_time(self.as_ref().to_glib_none().0) } |
131 | } |
132 | |
133 | #[doc (alias = "gst_base_sink_get_ts_offset" )] |
134 | #[doc (alias = "get_ts_offset" )] |
135 | fn ts_offset(&self) -> gst::ClockTimeDiff { |
136 | unsafe { ffi::gst_base_sink_get_ts_offset(self.as_ref().to_glib_none().0) } |
137 | } |
138 | |
139 | #[doc (alias = "gst_base_sink_set_blocksize" )] |
140 | fn set_blocksize(&self, blocksize: u32) { |
141 | unsafe { |
142 | ffi::gst_base_sink_set_blocksize(self.as_ref().to_glib_none().0, blocksize); |
143 | } |
144 | } |
145 | |
146 | #[doc (alias = "gst_base_sink_set_drop_out_of_segment" )] |
147 | fn set_drop_out_of_segment(&self, drop_out_of_segment: bool) { |
148 | unsafe { |
149 | ffi::gst_base_sink_set_drop_out_of_segment( |
150 | self.as_ref().to_glib_none().0, |
151 | drop_out_of_segment.into_glib(), |
152 | ); |
153 | } |
154 | } |
155 | |
156 | #[doc (alias = "gst_base_sink_set_max_bitrate" )] |
157 | fn set_max_bitrate(&self, max_bitrate: u64) { |
158 | unsafe { |
159 | ffi::gst_base_sink_set_max_bitrate(self.as_ref().to_glib_none().0, max_bitrate); |
160 | } |
161 | } |
162 | |
163 | #[doc (alias = "gst_base_sink_set_max_lateness" )] |
164 | fn set_max_lateness(&self, max_lateness: i64) { |
165 | unsafe { |
166 | ffi::gst_base_sink_set_max_lateness(self.as_ref().to_glib_none().0, max_lateness); |
167 | } |
168 | } |
169 | |
170 | #[cfg (feature = "v1_16" )] |
171 | #[cfg_attr (docsrs, doc(cfg(feature = "v1_16" )))] |
172 | #[doc (alias = "gst_base_sink_set_processing_deadline" )] |
173 | fn set_processing_deadline(&self, processing_deadline: gst::ClockTime) { |
174 | unsafe { |
175 | ffi::gst_base_sink_set_processing_deadline( |
176 | self.as_ref().to_glib_none().0, |
177 | processing_deadline.into_glib(), |
178 | ); |
179 | } |
180 | } |
181 | |
182 | #[doc (alias = "gst_base_sink_set_render_delay" )] |
183 | fn set_render_delay(&self, delay: gst::ClockTime) { |
184 | unsafe { |
185 | ffi::gst_base_sink_set_render_delay(self.as_ref().to_glib_none().0, delay.into_glib()); |
186 | } |
187 | } |
188 | |
189 | #[doc (alias = "gst_base_sink_set_sync" )] |
190 | fn set_sync(&self, sync: bool) { |
191 | unsafe { |
192 | ffi::gst_base_sink_set_sync(self.as_ref().to_glib_none().0, sync.into_glib()); |
193 | } |
194 | } |
195 | |
196 | #[doc (alias = "gst_base_sink_set_throttle_time" )] |
197 | fn set_throttle_time(&self, throttle: u64) { |
198 | unsafe { |
199 | ffi::gst_base_sink_set_throttle_time(self.as_ref().to_glib_none().0, throttle); |
200 | } |
201 | } |
202 | |
203 | #[doc (alias = "gst_base_sink_set_ts_offset" )] |
204 | fn set_ts_offset(&self, offset: gst::ClockTimeDiff) { |
205 | unsafe { |
206 | ffi::gst_base_sink_set_ts_offset(self.as_ref().to_glib_none().0, offset); |
207 | } |
208 | } |
209 | |
210 | #[doc (alias = "gst_base_sink_wait" )] |
211 | fn wait( |
212 | &self, |
213 | time: impl Into<Option<gst::ClockTime>>, |
214 | ) -> (Result<gst::FlowSuccess, gst::FlowError>, gst::ClockTimeDiff) { |
215 | unsafe { |
216 | let mut jitter = mem::MaybeUninit::uninit(); |
217 | let ret = try_from_glib(ffi::gst_base_sink_wait( |
218 | self.as_ref().to_glib_none().0, |
219 | time.into().into_glib(), |
220 | jitter.as_mut_ptr(), |
221 | )); |
222 | (ret, jitter.assume_init()) |
223 | } |
224 | } |
225 | |
226 | #[doc (alias = "gst_base_sink_wait_clock" )] |
227 | fn wait_clock( |
228 | &self, |
229 | time: gst::ClockTime, |
230 | ) -> ( |
231 | Result<gst::ClockSuccess, gst::ClockError>, |
232 | gst::ClockTimeDiff, |
233 | ) { |
234 | unsafe { |
235 | let mut jitter = mem::MaybeUninit::uninit(); |
236 | let ret = try_from_glib(ffi::gst_base_sink_wait_clock( |
237 | self.as_ref().to_glib_none().0, |
238 | time.into_glib(), |
239 | jitter.as_mut_ptr(), |
240 | )); |
241 | (ret, jitter.assume_init()) |
242 | } |
243 | } |
244 | |
245 | #[doc (alias = "gst_base_sink_wait_preroll" )] |
246 | fn wait_preroll(&self) -> Result<gst::FlowSuccess, gst::FlowError> { |
247 | unsafe { |
248 | try_from_glib(ffi::gst_base_sink_wait_preroll( |
249 | self.as_ref().to_glib_none().0, |
250 | )) |
251 | } |
252 | } |
253 | |
254 | #[doc (alias = "async" )] |
255 | fn is_async(&self) -> bool { |
256 | ObjectExt::property(self.as_ref(), "async" ) |
257 | } |
258 | |
259 | #[doc (alias = "async" )] |
260 | fn set_async(&self, async_: bool) { |
261 | ObjectExt::set_property(self.as_ref(), "async" , async_) |
262 | } |
263 | |
264 | #[doc (alias = "enable-last-sample" )] |
265 | fn enables_last_sample(&self) -> bool { |
266 | ObjectExt::property(self.as_ref(), "enable-last-sample" ) |
267 | } |
268 | |
269 | #[doc (alias = "enable-last-sample" )] |
270 | fn set_enable_last_sample(&self, enable_last_sample: bool) { |
271 | ObjectExt::set_property(self.as_ref(), "enable-last-sample" , enable_last_sample) |
272 | } |
273 | |
274 | fn is_qos(&self) -> bool { |
275 | ObjectExt::property(self.as_ref(), "qos" ) |
276 | } |
277 | |
278 | fn set_qos(&self, qos: bool) { |
279 | ObjectExt::set_property(self.as_ref(), "qos" , qos) |
280 | } |
281 | |
282 | #[doc (alias = "async" )] |
283 | fn connect_async_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { |
284 | unsafe extern "C" fn notify_async_trampoline< |
285 | P: IsA<BaseSink>, |
286 | F: Fn(&P) + Send + Sync + 'static, |
287 | >( |
288 | this: *mut ffi::GstBaseSink, |
289 | _param_spec: glib::ffi::gpointer, |
290 | f: glib::ffi::gpointer, |
291 | ) { |
292 | let f: &F = &*(f as *const F); |
293 | f(BaseSink::from_glib_borrow(this).unsafe_cast_ref()) |
294 | } |
295 | unsafe { |
296 | let f: Box_<F> = Box_::new(f); |
297 | connect_raw( |
298 | self.as_ptr() as *mut _, |
299 | b"notify::async \0" .as_ptr() as *const _, |
300 | Some(transmute::<_, unsafe extern "C" fn()>( |
301 | notify_async_trampoline::<Self, F> as *const (), |
302 | )), |
303 | Box_::into_raw(f), |
304 | ) |
305 | } |
306 | } |
307 | |
308 | #[doc (alias = "blocksize" )] |
309 | fn connect_blocksize_notify<F: Fn(&Self) + Send + Sync + 'static>( |
310 | &self, |
311 | f: F, |
312 | ) -> SignalHandlerId { |
313 | unsafe extern "C" fn notify_blocksize_trampoline< |
314 | P: IsA<BaseSink>, |
315 | F: Fn(&P) + Send + Sync + 'static, |
316 | >( |
317 | this: *mut ffi::GstBaseSink, |
318 | _param_spec: glib::ffi::gpointer, |
319 | f: glib::ffi::gpointer, |
320 | ) { |
321 | let f: &F = &*(f as *const F); |
322 | f(BaseSink::from_glib_borrow(this).unsafe_cast_ref()) |
323 | } |
324 | unsafe { |
325 | let f: Box_<F> = Box_::new(f); |
326 | connect_raw( |
327 | self.as_ptr() as *mut _, |
328 | b"notify::blocksize \0" .as_ptr() as *const _, |
329 | Some(transmute::<_, unsafe extern "C" fn()>( |
330 | notify_blocksize_trampoline::<Self, F> as *const (), |
331 | )), |
332 | Box_::into_raw(f), |
333 | ) |
334 | } |
335 | } |
336 | |
337 | #[doc (alias = "enable-last-sample" )] |
338 | fn connect_enable_last_sample_notify<F: Fn(&Self) + Send + Sync + 'static>( |
339 | &self, |
340 | f: F, |
341 | ) -> SignalHandlerId { |
342 | unsafe extern "C" fn notify_enable_last_sample_trampoline< |
343 | P: IsA<BaseSink>, |
344 | F: Fn(&P) + Send + Sync + 'static, |
345 | >( |
346 | this: *mut ffi::GstBaseSink, |
347 | _param_spec: glib::ffi::gpointer, |
348 | f: glib::ffi::gpointer, |
349 | ) { |
350 | let f: &F = &*(f as *const F); |
351 | f(BaseSink::from_glib_borrow(this).unsafe_cast_ref()) |
352 | } |
353 | unsafe { |
354 | let f: Box_<F> = Box_::new(f); |
355 | connect_raw( |
356 | self.as_ptr() as *mut _, |
357 | b"notify::enable-last-sample \0" .as_ptr() as *const _, |
358 | Some(transmute::<_, unsafe extern "C" fn()>( |
359 | notify_enable_last_sample_trampoline::<Self, F> as *const (), |
360 | )), |
361 | Box_::into_raw(f), |
362 | ) |
363 | } |
364 | } |
365 | |
366 | #[doc (alias = "last-sample" )] |
367 | fn connect_last_sample_notify<F: Fn(&Self) + Send + Sync + 'static>( |
368 | &self, |
369 | f: F, |
370 | ) -> SignalHandlerId { |
371 | unsafe extern "C" fn notify_last_sample_trampoline< |
372 | P: IsA<BaseSink>, |
373 | F: Fn(&P) + Send + Sync + 'static, |
374 | >( |
375 | this: *mut ffi::GstBaseSink, |
376 | _param_spec: glib::ffi::gpointer, |
377 | f: glib::ffi::gpointer, |
378 | ) { |
379 | let f: &F = &*(f as *const F); |
380 | f(BaseSink::from_glib_borrow(this).unsafe_cast_ref()) |
381 | } |
382 | unsafe { |
383 | let f: Box_<F> = Box_::new(f); |
384 | connect_raw( |
385 | self.as_ptr() as *mut _, |
386 | b"notify::last-sample \0" .as_ptr() as *const _, |
387 | Some(transmute::<_, unsafe extern "C" fn()>( |
388 | notify_last_sample_trampoline::<Self, F> as *const (), |
389 | )), |
390 | Box_::into_raw(f), |
391 | ) |
392 | } |
393 | } |
394 | |
395 | #[doc (alias = "max-bitrate" )] |
396 | fn connect_max_bitrate_notify<F: Fn(&Self) + Send + Sync + 'static>( |
397 | &self, |
398 | f: F, |
399 | ) -> SignalHandlerId { |
400 | unsafe extern "C" fn notify_max_bitrate_trampoline< |
401 | P: IsA<BaseSink>, |
402 | F: Fn(&P) + Send + Sync + 'static, |
403 | >( |
404 | this: *mut ffi::GstBaseSink, |
405 | _param_spec: glib::ffi::gpointer, |
406 | f: glib::ffi::gpointer, |
407 | ) { |
408 | let f: &F = &*(f as *const F); |
409 | f(BaseSink::from_glib_borrow(this).unsafe_cast_ref()) |
410 | } |
411 | unsafe { |
412 | let f: Box_<F> = Box_::new(f); |
413 | connect_raw( |
414 | self.as_ptr() as *mut _, |
415 | b"notify::max-bitrate \0" .as_ptr() as *const _, |
416 | Some(transmute::<_, unsafe extern "C" fn()>( |
417 | notify_max_bitrate_trampoline::<Self, F> as *const (), |
418 | )), |
419 | Box_::into_raw(f), |
420 | ) |
421 | } |
422 | } |
423 | |
424 | #[doc (alias = "max-lateness" )] |
425 | fn connect_max_lateness_notify<F: Fn(&Self) + Send + Sync + 'static>( |
426 | &self, |
427 | f: F, |
428 | ) -> SignalHandlerId { |
429 | unsafe extern "C" fn notify_max_lateness_trampoline< |
430 | P: IsA<BaseSink>, |
431 | F: Fn(&P) + Send + Sync + 'static, |
432 | >( |
433 | this: *mut ffi::GstBaseSink, |
434 | _param_spec: glib::ffi::gpointer, |
435 | f: glib::ffi::gpointer, |
436 | ) { |
437 | let f: &F = &*(f as *const F); |
438 | f(BaseSink::from_glib_borrow(this).unsafe_cast_ref()) |
439 | } |
440 | unsafe { |
441 | let f: Box_<F> = Box_::new(f); |
442 | connect_raw( |
443 | self.as_ptr() as *mut _, |
444 | b"notify::max-lateness \0" .as_ptr() as *const _, |
445 | Some(transmute::<_, unsafe extern "C" fn()>( |
446 | notify_max_lateness_trampoline::<Self, F> as *const (), |
447 | )), |
448 | Box_::into_raw(f), |
449 | ) |
450 | } |
451 | } |
452 | |
453 | #[cfg (feature = "v1_16" )] |
454 | #[cfg_attr (docsrs, doc(cfg(feature = "v1_16" )))] |
455 | #[doc (alias = "processing-deadline" )] |
456 | fn connect_processing_deadline_notify<F: Fn(&Self) + Send + Sync + 'static>( |
457 | &self, |
458 | f: F, |
459 | ) -> SignalHandlerId { |
460 | unsafe extern "C" fn notify_processing_deadline_trampoline< |
461 | P: IsA<BaseSink>, |
462 | F: Fn(&P) + Send + Sync + 'static, |
463 | >( |
464 | this: *mut ffi::GstBaseSink, |
465 | _param_spec: glib::ffi::gpointer, |
466 | f: glib::ffi::gpointer, |
467 | ) { |
468 | let f: &F = &*(f as *const F); |
469 | f(BaseSink::from_glib_borrow(this).unsafe_cast_ref()) |
470 | } |
471 | unsafe { |
472 | let f: Box_<F> = Box_::new(f); |
473 | connect_raw( |
474 | self.as_ptr() as *mut _, |
475 | b"notify::processing-deadline \0" .as_ptr() as *const _, |
476 | Some(transmute::<_, unsafe extern "C" fn()>( |
477 | notify_processing_deadline_trampoline::<Self, F> as *const (), |
478 | )), |
479 | Box_::into_raw(f), |
480 | ) |
481 | } |
482 | } |
483 | |
484 | #[doc (alias = "qos" )] |
485 | fn connect_qos_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { |
486 | unsafe extern "C" fn notify_qos_trampoline< |
487 | P: IsA<BaseSink>, |
488 | F: Fn(&P) + Send + Sync + 'static, |
489 | >( |
490 | this: *mut ffi::GstBaseSink, |
491 | _param_spec: glib::ffi::gpointer, |
492 | f: glib::ffi::gpointer, |
493 | ) { |
494 | let f: &F = &*(f as *const F); |
495 | f(BaseSink::from_glib_borrow(this).unsafe_cast_ref()) |
496 | } |
497 | unsafe { |
498 | let f: Box_<F> = Box_::new(f); |
499 | connect_raw( |
500 | self.as_ptr() as *mut _, |
501 | b"notify::qos \0" .as_ptr() as *const _, |
502 | Some(transmute::<_, unsafe extern "C" fn()>( |
503 | notify_qos_trampoline::<Self, F> as *const (), |
504 | )), |
505 | Box_::into_raw(f), |
506 | ) |
507 | } |
508 | } |
509 | |
510 | #[doc (alias = "render-delay" )] |
511 | fn connect_render_delay_notify<F: Fn(&Self) + Send + Sync + 'static>( |
512 | &self, |
513 | f: F, |
514 | ) -> SignalHandlerId { |
515 | unsafe extern "C" fn notify_render_delay_trampoline< |
516 | P: IsA<BaseSink>, |
517 | F: Fn(&P) + Send + Sync + 'static, |
518 | >( |
519 | this: *mut ffi::GstBaseSink, |
520 | _param_spec: glib::ffi::gpointer, |
521 | f: glib::ffi::gpointer, |
522 | ) { |
523 | let f: &F = &*(f as *const F); |
524 | f(BaseSink::from_glib_borrow(this).unsafe_cast_ref()) |
525 | } |
526 | unsafe { |
527 | let f: Box_<F> = Box_::new(f); |
528 | connect_raw( |
529 | self.as_ptr() as *mut _, |
530 | b"notify::render-delay \0" .as_ptr() as *const _, |
531 | Some(transmute::<_, unsafe extern "C" fn()>( |
532 | notify_render_delay_trampoline::<Self, F> as *const (), |
533 | )), |
534 | Box_::into_raw(f), |
535 | ) |
536 | } |
537 | } |
538 | |
539 | #[cfg (feature = "v1_18" )] |
540 | #[cfg_attr (docsrs, doc(cfg(feature = "v1_18" )))] |
541 | #[doc (alias = "stats" )] |
542 | fn connect_stats_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { |
543 | unsafe extern "C" fn notify_stats_trampoline< |
544 | P: IsA<BaseSink>, |
545 | F: Fn(&P) + Send + Sync + 'static, |
546 | >( |
547 | this: *mut ffi::GstBaseSink, |
548 | _param_spec: glib::ffi::gpointer, |
549 | f: glib::ffi::gpointer, |
550 | ) { |
551 | let f: &F = &*(f as *const F); |
552 | f(BaseSink::from_glib_borrow(this).unsafe_cast_ref()) |
553 | } |
554 | unsafe { |
555 | let f: Box_<F> = Box_::new(f); |
556 | connect_raw( |
557 | self.as_ptr() as *mut _, |
558 | b"notify::stats \0" .as_ptr() as *const _, |
559 | Some(transmute::<_, unsafe extern "C" fn()>( |
560 | notify_stats_trampoline::<Self, F> as *const (), |
561 | )), |
562 | Box_::into_raw(f), |
563 | ) |
564 | } |
565 | } |
566 | |
567 | #[doc (alias = "sync" )] |
568 | fn connect_sync_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { |
569 | unsafe extern "C" fn notify_sync_trampoline< |
570 | P: IsA<BaseSink>, |
571 | F: Fn(&P) + Send + Sync + 'static, |
572 | >( |
573 | this: *mut ffi::GstBaseSink, |
574 | _param_spec: glib::ffi::gpointer, |
575 | f: glib::ffi::gpointer, |
576 | ) { |
577 | let f: &F = &*(f as *const F); |
578 | f(BaseSink::from_glib_borrow(this).unsafe_cast_ref()) |
579 | } |
580 | unsafe { |
581 | let f: Box_<F> = Box_::new(f); |
582 | connect_raw( |
583 | self.as_ptr() as *mut _, |
584 | b"notify::sync \0" .as_ptr() as *const _, |
585 | Some(transmute::<_, unsafe extern "C" fn()>( |
586 | notify_sync_trampoline::<Self, F> as *const (), |
587 | )), |
588 | Box_::into_raw(f), |
589 | ) |
590 | } |
591 | } |
592 | |
593 | #[doc (alias = "throttle-time" )] |
594 | fn connect_throttle_time_notify<F: Fn(&Self) + Send + Sync + 'static>( |
595 | &self, |
596 | f: F, |
597 | ) -> SignalHandlerId { |
598 | unsafe extern "C" fn notify_throttle_time_trampoline< |
599 | P: IsA<BaseSink>, |
600 | F: Fn(&P) + Send + Sync + 'static, |
601 | >( |
602 | this: *mut ffi::GstBaseSink, |
603 | _param_spec: glib::ffi::gpointer, |
604 | f: glib::ffi::gpointer, |
605 | ) { |
606 | let f: &F = &*(f as *const F); |
607 | f(BaseSink::from_glib_borrow(this).unsafe_cast_ref()) |
608 | } |
609 | unsafe { |
610 | let f: Box_<F> = Box_::new(f); |
611 | connect_raw( |
612 | self.as_ptr() as *mut _, |
613 | b"notify::throttle-time \0" .as_ptr() as *const _, |
614 | Some(transmute::<_, unsafe extern "C" fn()>( |
615 | notify_throttle_time_trampoline::<Self, F> as *const (), |
616 | )), |
617 | Box_::into_raw(f), |
618 | ) |
619 | } |
620 | } |
621 | |
622 | #[doc (alias = "ts-offset" )] |
623 | fn connect_ts_offset_notify<F: Fn(&Self) + Send + Sync + 'static>( |
624 | &self, |
625 | f: F, |
626 | ) -> SignalHandlerId { |
627 | unsafe extern "C" fn notify_ts_offset_trampoline< |
628 | P: IsA<BaseSink>, |
629 | F: Fn(&P) + Send + Sync + 'static, |
630 | >( |
631 | this: *mut ffi::GstBaseSink, |
632 | _param_spec: glib::ffi::gpointer, |
633 | f: glib::ffi::gpointer, |
634 | ) { |
635 | let f: &F = &*(f as *const F); |
636 | f(BaseSink::from_glib_borrow(this).unsafe_cast_ref()) |
637 | } |
638 | unsafe { |
639 | let f: Box_<F> = Box_::new(f); |
640 | connect_raw( |
641 | self.as_ptr() as *mut _, |
642 | b"notify::ts-offset \0" .as_ptr() as *const _, |
643 | Some(transmute::<_, unsafe extern "C" fn()>( |
644 | notify_ts_offset_trampoline::<Self, F> as *const (), |
645 | )), |
646 | Box_::into_raw(f), |
647 | ) |
648 | } |
649 | } |
650 | } |
651 | |
652 | impl<O: IsA<BaseSink>> BaseSinkExt for O {} |
653 | |