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