1#![allow(deprecated)]
6
7use crate::ffi;
8#[cfg(feature = "v1_28")]
9#[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
10use crate::AppLeakyType;
11use glib::{
12 prelude::*,
13 signal::{connect_raw, SignalHandlerId},
14 translate::*,
15};
16use std::boxed::Box as Box_;
17
18glib::wrapper! {
19 #[doc(alias = "GstAppSink")]
20 pub struct AppSink(Object<ffi::GstAppSink, ffi::GstAppSinkClass>) @extends gst::Element, gst::Object, @implements gst::URIHandler;
21
22 match fn {
23 type_ => || ffi::gst_app_sink_get_type(),
24 }
25}
26
27impl AppSink {
28 #[doc(alias = "gst_app_sink_get_buffer_list_support")]
29 #[doc(alias = "get_buffer_list_support")]
30 pub fn is_buffer_list_support(&self) -> bool {
31 unsafe {
32 from_glib(ffi::gst_app_sink_get_buffer_list_support(
33 self.to_glib_none().0,
34 ))
35 }
36 }
37
38 #[doc(alias = "gst_app_sink_get_caps")]
39 #[doc(alias = "get_caps")]
40 pub fn caps(&self) -> Option<gst::Caps> {
41 unsafe { from_glib_full(ffi::gst_app_sink_get_caps(self.to_glib_none().0)) }
42 }
43
44 #[cfg(feature = "v1_28")]
45 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
46 #[doc(alias = "gst_app_sink_get_current_level_buffers")]
47 #[doc(alias = "get_current_level_buffers")]
48 #[doc(alias = "current-level-buffers")]
49 pub fn current_level_buffers(&self) -> u64 {
50 unsafe { ffi::gst_app_sink_get_current_level_buffers(self.to_glib_none().0) }
51 }
52
53 #[cfg(feature = "v1_28")]
54 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
55 #[doc(alias = "gst_app_sink_get_current_level_bytes")]
56 #[doc(alias = "get_current_level_bytes")]
57 #[doc(alias = "current-level-bytes")]
58 pub fn current_level_bytes(&self) -> u64 {
59 unsafe { ffi::gst_app_sink_get_current_level_bytes(self.to_glib_none().0) }
60 }
61
62 #[cfg(feature = "v1_28")]
63 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
64 #[doc(alias = "gst_app_sink_get_current_level_time")]
65 #[doc(alias = "get_current_level_time")]
66 #[doc(alias = "current-level-time")]
67 pub fn current_level_time(&self) -> Option<gst::ClockTime> {
68 unsafe {
69 from_glib(ffi::gst_app_sink_get_current_level_time(
70 self.to_glib_none().0,
71 ))
72 }
73 }
74
75 #[cfg_attr(feature = "v1_28", deprecated = "Since 1.28")]
76 #[allow(deprecated)]
77 #[doc(alias = "gst_app_sink_get_drop")]
78 #[doc(alias = "get_drop")]
79 #[doc(alias = "drop")]
80 pub fn is_drop(&self) -> bool {
81 unsafe { from_glib(ffi::gst_app_sink_get_drop(self.to_glib_none().0)) }
82 }
83
84 #[cfg(feature = "v1_28")]
85 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
86 #[doc(alias = "gst_app_sink_get_leaky_type")]
87 #[doc(alias = "get_leaky_type")]
88 #[doc(alias = "leaky-type")]
89 pub fn leaky_type(&self) -> AppLeakyType {
90 unsafe { from_glib(ffi::gst_app_sink_get_leaky_type(self.to_glib_none().0)) }
91 }
92
93 #[doc(alias = "gst_app_sink_get_max_buffers")]
94 #[doc(alias = "get_max_buffers")]
95 #[doc(alias = "max-buffers")]
96 pub fn max_buffers(&self) -> u32 {
97 unsafe { ffi::gst_app_sink_get_max_buffers(self.to_glib_none().0) }
98 }
99
100 #[cfg(feature = "v1_24")]
101 #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
102 #[doc(alias = "gst_app_sink_get_max_bytes")]
103 #[doc(alias = "get_max_bytes")]
104 #[doc(alias = "max-bytes")]
105 pub fn max_bytes(&self) -> u64 {
106 unsafe { ffi::gst_app_sink_get_max_bytes(self.to_glib_none().0) }
107 }
108
109 #[cfg(feature = "v1_24")]
110 #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
111 #[doc(alias = "gst_app_sink_get_max_time")]
112 #[doc(alias = "get_max_time")]
113 #[doc(alias = "max-time")]
114 pub fn max_time(&self) -> Option<gst::ClockTime> {
115 unsafe { from_glib(ffi::gst_app_sink_get_max_time(self.to_glib_none().0)) }
116 }
117
118 #[doc(alias = "gst_app_sink_get_wait_on_eos")]
119 #[doc(alias = "get_wait_on_eos")]
120 #[doc(alias = "wait-on-eos")]
121 pub fn is_wait_on_eos(&self) -> bool {
122 unsafe { from_glib(ffi::gst_app_sink_get_wait_on_eos(self.to_glib_none().0)) }
123 }
124
125 #[doc(alias = "gst_app_sink_is_eos")]
126 #[doc(alias = "eos")]
127 pub fn is_eos(&self) -> bool {
128 unsafe { from_glib(ffi::gst_app_sink_is_eos(self.to_glib_none().0)) }
129 }
130
131 #[cfg(feature = "v1_20")]
132 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
133 #[doc(alias = "gst_app_sink_pull_object")]
134 pub fn pull_object(&self) -> Result<gst::MiniObject, glib::BoolError> {
135 unsafe {
136 Option::<_>::from_glib_full(ffi::gst_app_sink_pull_object(self.to_glib_none().0))
137 .ok_or_else(|| glib::bool_error!("Failed to pull object"))
138 }
139 }
140
141 #[doc(alias = "gst_app_sink_pull_preroll")]
142 pub fn pull_preroll(&self) -> Result<gst::Sample, glib::BoolError> {
143 unsafe {
144 Option::<_>::from_glib_full(ffi::gst_app_sink_pull_preroll(self.to_glib_none().0))
145 .ok_or_else(|| glib::bool_error!("Failed to pull preroll sample"))
146 }
147 }
148
149 #[doc(alias = "gst_app_sink_pull_sample")]
150 pub fn pull_sample(&self) -> Result<gst::Sample, glib::BoolError> {
151 unsafe {
152 Option::<_>::from_glib_full(ffi::gst_app_sink_pull_sample(self.to_glib_none().0))
153 .ok_or_else(|| glib::bool_error!("Failed to pull sample"))
154 }
155 }
156
157 #[doc(alias = "gst_app_sink_set_buffer_list_support")]
158 pub fn set_buffer_list_support(&self, enable_lists: bool) {
159 unsafe {
160 ffi::gst_app_sink_set_buffer_list_support(
161 self.to_glib_none().0,
162 enable_lists.into_glib(),
163 );
164 }
165 }
166
167 #[doc(alias = "gst_app_sink_set_caps")]
173 #[doc(alias = "caps")]
174 pub fn set_caps(&self, caps: Option<&gst::Caps>) {
175 unsafe {
176 ffi::gst_app_sink_set_caps(self.to_glib_none().0, caps.to_glib_none().0);
177 }
178 }
179
180 #[cfg_attr(feature = "v1_28", deprecated = "Since 1.28")]
181 #[allow(deprecated)]
182 #[doc(alias = "gst_app_sink_set_drop")]
183 #[doc(alias = "drop")]
184 pub fn set_drop(&self, drop: bool) {
185 unsafe {
186 ffi::gst_app_sink_set_drop(self.to_glib_none().0, drop.into_glib());
187 }
188 }
189
190 #[cfg(feature = "v1_28")]
191 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
192 #[doc(alias = "gst_app_sink_set_leaky_type")]
193 #[doc(alias = "leaky-type")]
194 pub fn set_leaky_type(&self, leaky: AppLeakyType) {
195 unsafe {
196 ffi::gst_app_sink_set_leaky_type(self.to_glib_none().0, leaky.into_glib());
197 }
198 }
199
200 #[doc(alias = "gst_app_sink_set_max_buffers")]
201 #[doc(alias = "max-buffers")]
202 pub fn set_max_buffers(&self, max: u32) {
203 unsafe {
204 ffi::gst_app_sink_set_max_buffers(self.to_glib_none().0, max);
205 }
206 }
207
208 #[cfg(feature = "v1_24")]
209 #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
210 #[doc(alias = "gst_app_sink_set_max_bytes")]
211 #[doc(alias = "max-bytes")]
212 pub fn set_max_bytes(&self, max: u64) {
213 unsafe {
214 ffi::gst_app_sink_set_max_bytes(self.to_glib_none().0, max);
215 }
216 }
217
218 #[cfg(feature = "v1_24")]
219 #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
220 #[doc(alias = "gst_app_sink_set_max_time")]
221 #[doc(alias = "max-time")]
222 pub fn set_max_time(&self, max: impl Into<Option<gst::ClockTime>>) {
223 unsafe {
224 ffi::gst_app_sink_set_max_time(self.to_glib_none().0, max.into().into_glib());
225 }
226 }
227
228 #[doc(alias = "gst_app_sink_set_wait_on_eos")]
236 #[doc(alias = "wait-on-eos")]
237 pub fn set_wait_on_eos(&self, wait: bool) {
238 unsafe {
239 ffi::gst_app_sink_set_wait_on_eos(self.to_glib_none().0, wait.into_glib());
240 }
241 }
242
243 #[cfg(feature = "v1_20")]
244 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
245 #[doc(alias = "gst_app_sink_try_pull_object")]
246 pub fn try_pull_object(
247 &self,
248 timeout: impl Into<Option<gst::ClockTime>>,
249 ) -> Option<gst::MiniObject> {
250 unsafe {
251 from_glib_full(ffi::gst_app_sink_try_pull_object(
252 self.to_glib_none().0,
253 timeout.into().into_glib(),
254 ))
255 }
256 }
257
258 #[doc(alias = "gst_app_sink_try_pull_preroll")]
259 pub fn try_pull_preroll(
260 &self,
261 timeout: impl Into<Option<gst::ClockTime>>,
262 ) -> Option<gst::Sample> {
263 unsafe {
264 from_glib_full(ffi::gst_app_sink_try_pull_preroll(
265 self.to_glib_none().0,
266 timeout.into().into_glib(),
267 ))
268 }
269 }
270
271 #[doc(alias = "gst_app_sink_try_pull_sample")]
272 pub fn try_pull_sample(
273 &self,
274 timeout: impl Into<Option<gst::ClockTime>>,
275 ) -> Option<gst::Sample> {
276 unsafe {
277 from_glib_full(ffi::gst_app_sink_try_pull_sample(
278 self.to_glib_none().0,
279 timeout.into().into_glib(),
280 ))
281 }
282 }
283
284 #[doc(alias = "buffer-list")]
285 pub fn is_buffer_list(&self) -> bool {
286 ObjectExt::property(self, "buffer-list")
287 }
288
289 #[doc(alias = "buffer-list")]
290 pub fn set_buffer_list(&self, buffer_list: bool) {
291 ObjectExt::set_property(self, "buffer-list", buffer_list)
292 }
293
294 #[cfg(feature = "v1_28")]
295 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
296 pub fn dropped(&self) -> u64 {
297 ObjectExt::property(self, "dropped")
298 }
299
300 #[cfg(feature = "v1_28")]
301 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
302 #[doc(alias = "in")]
303 pub fn get_in(&self) -> u64 {
304 ObjectExt::property(self, "in")
305 }
306
307 #[cfg(feature = "v1_28")]
308 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
309 pub fn out(&self) -> u64 {
310 ObjectExt::property(self, "out")
311 }
312
313 #[cfg(feature = "v1_28")]
314 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
315 pub fn is_silent(&self) -> bool {
316 ObjectExt::property(self, "silent")
317 }
318
319 #[cfg(feature = "v1_28")]
320 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
321 pub fn set_silent(&self, silent: bool) {
322 ObjectExt::set_property(self, "silent", silent)
323 }
324
325 #[doc(alias = "buffer-list")]
326 pub fn connect_buffer_list_notify<F: Fn(&Self) + Send + Sync + 'static>(
327 &self,
328 f: F,
329 ) -> SignalHandlerId {
330 unsafe extern "C" fn notify_buffer_list_trampoline<
331 F: Fn(&AppSink) + Send + Sync + 'static,
332 >(
333 this: *mut ffi::GstAppSink,
334 _param_spec: glib::ffi::gpointer,
335 f: glib::ffi::gpointer,
336 ) {
337 let f: &F = &*(f as *const F);
338 f(&from_glib_borrow(this))
339 }
340 unsafe {
341 let f: Box_<F> = Box_::new(f);
342 connect_raw(
343 self.as_ptr() as *mut _,
344 c"notify::buffer-list".as_ptr() as *const _,
345 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
346 notify_buffer_list_trampoline::<F> as *const (),
347 )),
348 Box_::into_raw(f),
349 )
350 }
351 }
352
353 #[doc(alias = "caps")]
354 pub fn connect_caps_notify<F: Fn(&Self) + Send + Sync + 'static>(
355 &self,
356 f: F,
357 ) -> SignalHandlerId {
358 unsafe extern "C" fn notify_caps_trampoline<F: Fn(&AppSink) + Send + Sync + 'static>(
359 this: *mut ffi::GstAppSink,
360 _param_spec: glib::ffi::gpointer,
361 f: glib::ffi::gpointer,
362 ) {
363 let f: &F = &*(f as *const F);
364 f(&from_glib_borrow(this))
365 }
366 unsafe {
367 let f: Box_<F> = Box_::new(f);
368 connect_raw(
369 self.as_ptr() as *mut _,
370 c"notify::caps".as_ptr() as *const _,
371 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
372 notify_caps_trampoline::<F> as *const (),
373 )),
374 Box_::into_raw(f),
375 )
376 }
377 }
378
379 #[cfg(feature = "v1_28")]
380 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
381 #[doc(alias = "current-level-buffers")]
382 pub fn connect_current_level_buffers_notify<F: Fn(&Self) + Send + Sync + 'static>(
383 &self,
384 f: F,
385 ) -> SignalHandlerId {
386 unsafe extern "C" fn notify_current_level_buffers_trampoline<
387 F: Fn(&AppSink) + Send + Sync + 'static,
388 >(
389 this: *mut ffi::GstAppSink,
390 _param_spec: glib::ffi::gpointer,
391 f: glib::ffi::gpointer,
392 ) {
393 let f: &F = &*(f as *const F);
394 f(&from_glib_borrow(this))
395 }
396 unsafe {
397 let f: Box_<F> = Box_::new(f);
398 connect_raw(
399 self.as_ptr() as *mut _,
400 c"notify::current-level-buffers".as_ptr() as *const _,
401 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
402 notify_current_level_buffers_trampoline::<F> as *const (),
403 )),
404 Box_::into_raw(f),
405 )
406 }
407 }
408
409 #[cfg(feature = "v1_28")]
410 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
411 #[doc(alias = "current-level-bytes")]
412 pub fn connect_current_level_bytes_notify<F: Fn(&Self) + Send + Sync + 'static>(
413 &self,
414 f: F,
415 ) -> SignalHandlerId {
416 unsafe extern "C" fn notify_current_level_bytes_trampoline<
417 F: Fn(&AppSink) + Send + Sync + 'static,
418 >(
419 this: *mut ffi::GstAppSink,
420 _param_spec: glib::ffi::gpointer,
421 f: glib::ffi::gpointer,
422 ) {
423 let f: &F = &*(f as *const F);
424 f(&from_glib_borrow(this))
425 }
426 unsafe {
427 let f: Box_<F> = Box_::new(f);
428 connect_raw(
429 self.as_ptr() as *mut _,
430 c"notify::current-level-bytes".as_ptr() as *const _,
431 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
432 notify_current_level_bytes_trampoline::<F> as *const (),
433 )),
434 Box_::into_raw(f),
435 )
436 }
437 }
438
439 #[cfg(feature = "v1_28")]
440 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
441 #[doc(alias = "current-level-time")]
442 pub fn connect_current_level_time_notify<F: Fn(&Self) + Send + Sync + 'static>(
443 &self,
444 f: F,
445 ) -> SignalHandlerId {
446 unsafe extern "C" fn notify_current_level_time_trampoline<
447 F: Fn(&AppSink) + Send + Sync + 'static,
448 >(
449 this: *mut ffi::GstAppSink,
450 _param_spec: glib::ffi::gpointer,
451 f: glib::ffi::gpointer,
452 ) {
453 let f: &F = &*(f as *const F);
454 f(&from_glib_borrow(this))
455 }
456 unsafe {
457 let f: Box_<F> = Box_::new(f);
458 connect_raw(
459 self.as_ptr() as *mut _,
460 c"notify::current-level-time".as_ptr() as *const _,
461 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
462 notify_current_level_time_trampoline::<F> as *const (),
463 )),
464 Box_::into_raw(f),
465 )
466 }
467 }
468
469 #[cfg_attr(feature = "v1_28", deprecated = "Since 1.28")]
470 #[doc(alias = "drop")]
471 pub fn connect_drop_notify<F: Fn(&Self) + Send + Sync + 'static>(
472 &self,
473 f: F,
474 ) -> SignalHandlerId {
475 unsafe extern "C" fn notify_drop_trampoline<F: Fn(&AppSink) + Send + Sync + 'static>(
476 this: *mut ffi::GstAppSink,
477 _param_spec: glib::ffi::gpointer,
478 f: glib::ffi::gpointer,
479 ) {
480 let f: &F = &*(f as *const F);
481 f(&from_glib_borrow(this))
482 }
483 unsafe {
484 let f: Box_<F> = Box_::new(f);
485 connect_raw(
486 self.as_ptr() as *mut _,
487 c"notify::drop".as_ptr() as *const _,
488 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
489 notify_drop_trampoline::<F> as *const (),
490 )),
491 Box_::into_raw(f),
492 )
493 }
494 }
495
496 #[cfg(feature = "v1_28")]
497 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
498 #[doc(alias = "dropped")]
499 pub fn connect_dropped_notify<F: Fn(&Self) + Send + Sync + 'static>(
500 &self,
501 f: F,
502 ) -> SignalHandlerId {
503 unsafe extern "C" fn notify_dropped_trampoline<F: Fn(&AppSink) + Send + Sync + 'static>(
504 this: *mut ffi::GstAppSink,
505 _param_spec: glib::ffi::gpointer,
506 f: glib::ffi::gpointer,
507 ) {
508 let f: &F = &*(f as *const F);
509 f(&from_glib_borrow(this))
510 }
511 unsafe {
512 let f: Box_<F> = Box_::new(f);
513 connect_raw(
514 self.as_ptr() as *mut _,
515 c"notify::dropped".as_ptr() as *const _,
516 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
517 notify_dropped_trampoline::<F> as *const (),
518 )),
519 Box_::into_raw(f),
520 )
521 }
522 }
523
524 #[doc(alias = "eos")]
525 pub fn connect_eos_notify<F: Fn(&Self) + Send + Sync + 'static>(
526 &self,
527 f: F,
528 ) -> SignalHandlerId {
529 unsafe extern "C" fn notify_eos_trampoline<F: Fn(&AppSink) + Send + Sync + 'static>(
530 this: *mut ffi::GstAppSink,
531 _param_spec: glib::ffi::gpointer,
532 f: glib::ffi::gpointer,
533 ) {
534 let f: &F = &*(f as *const F);
535 f(&from_glib_borrow(this))
536 }
537 unsafe {
538 let f: Box_<F> = Box_::new(f);
539 connect_raw(
540 self.as_ptr() as *mut _,
541 c"notify::eos".as_ptr() as *const _,
542 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
543 notify_eos_trampoline::<F> as *const (),
544 )),
545 Box_::into_raw(f),
546 )
547 }
548 }
549
550 #[cfg(feature = "v1_28")]
551 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
552 #[doc(alias = "in")]
553 pub fn connect_in_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
554 unsafe extern "C" fn notify_in_trampoline<F: Fn(&AppSink) + Send + Sync + 'static>(
555 this: *mut ffi::GstAppSink,
556 _param_spec: glib::ffi::gpointer,
557 f: glib::ffi::gpointer,
558 ) {
559 let f: &F = &*(f as *const F);
560 f(&from_glib_borrow(this))
561 }
562 unsafe {
563 let f: Box_<F> = Box_::new(f);
564 connect_raw(
565 self.as_ptr() as *mut _,
566 c"notify::in".as_ptr() as *const _,
567 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
568 notify_in_trampoline::<F> as *const (),
569 )),
570 Box_::into_raw(f),
571 )
572 }
573 }
574
575 #[cfg(feature = "v1_28")]
576 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
577 #[doc(alias = "leaky-type")]
578 pub fn connect_leaky_type_notify<F: Fn(&Self) + Send + Sync + 'static>(
579 &self,
580 f: F,
581 ) -> SignalHandlerId {
582 unsafe extern "C" fn notify_leaky_type_trampoline<
583 F: Fn(&AppSink) + Send + Sync + 'static,
584 >(
585 this: *mut ffi::GstAppSink,
586 _param_spec: glib::ffi::gpointer,
587 f: glib::ffi::gpointer,
588 ) {
589 let f: &F = &*(f as *const F);
590 f(&from_glib_borrow(this))
591 }
592 unsafe {
593 let f: Box_<F> = Box_::new(f);
594 connect_raw(
595 self.as_ptr() as *mut _,
596 c"notify::leaky-type".as_ptr() as *const _,
597 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
598 notify_leaky_type_trampoline::<F> as *const (),
599 )),
600 Box_::into_raw(f),
601 )
602 }
603 }
604
605 #[doc(alias = "max-buffers")]
606 pub fn connect_max_buffers_notify<F: Fn(&Self) + Send + Sync + 'static>(
607 &self,
608 f: F,
609 ) -> SignalHandlerId {
610 unsafe extern "C" fn notify_max_buffers_trampoline<
611 F: Fn(&AppSink) + Send + Sync + 'static,
612 >(
613 this: *mut ffi::GstAppSink,
614 _param_spec: glib::ffi::gpointer,
615 f: glib::ffi::gpointer,
616 ) {
617 let f: &F = &*(f as *const F);
618 f(&from_glib_borrow(this))
619 }
620 unsafe {
621 let f: Box_<F> = Box_::new(f);
622 connect_raw(
623 self.as_ptr() as *mut _,
624 c"notify::max-buffers".as_ptr() as *const _,
625 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
626 notify_max_buffers_trampoline::<F> as *const (),
627 )),
628 Box_::into_raw(f),
629 )
630 }
631 }
632
633 #[cfg(feature = "v1_24")]
634 #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
635 #[doc(alias = "max-bytes")]
636 pub fn connect_max_bytes_notify<F: Fn(&Self) + Send + Sync + 'static>(
637 &self,
638 f: F,
639 ) -> SignalHandlerId {
640 unsafe extern "C" fn notify_max_bytes_trampoline<
641 F: Fn(&AppSink) + Send + Sync + 'static,
642 >(
643 this: *mut ffi::GstAppSink,
644 _param_spec: glib::ffi::gpointer,
645 f: glib::ffi::gpointer,
646 ) {
647 let f: &F = &*(f as *const F);
648 f(&from_glib_borrow(this))
649 }
650 unsafe {
651 let f: Box_<F> = Box_::new(f);
652 connect_raw(
653 self.as_ptr() as *mut _,
654 c"notify::max-bytes".as_ptr() as *const _,
655 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
656 notify_max_bytes_trampoline::<F> as *const (),
657 )),
658 Box_::into_raw(f),
659 )
660 }
661 }
662
663 #[cfg(feature = "v1_24")]
664 #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
665 #[doc(alias = "max-time")]
666 pub fn connect_max_time_notify<F: Fn(&Self) + Send + Sync + 'static>(
667 &self,
668 f: F,
669 ) -> SignalHandlerId {
670 unsafe extern "C" fn notify_max_time_trampoline<F: Fn(&AppSink) + Send + Sync + 'static>(
671 this: *mut ffi::GstAppSink,
672 _param_spec: glib::ffi::gpointer,
673 f: glib::ffi::gpointer,
674 ) {
675 let f: &F = &*(f as *const F);
676 f(&from_glib_borrow(this))
677 }
678 unsafe {
679 let f: Box_<F> = Box_::new(f);
680 connect_raw(
681 self.as_ptr() as *mut _,
682 c"notify::max-time".as_ptr() as *const _,
683 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
684 notify_max_time_trampoline::<F> as *const (),
685 )),
686 Box_::into_raw(f),
687 )
688 }
689 }
690
691 #[cfg(feature = "v1_28")]
692 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
693 #[doc(alias = "out")]
694 pub fn connect_out_notify<F: Fn(&Self) + Send + Sync + 'static>(
695 &self,
696 f: F,
697 ) -> SignalHandlerId {
698 unsafe extern "C" fn notify_out_trampoline<F: Fn(&AppSink) + Send + Sync + 'static>(
699 this: *mut ffi::GstAppSink,
700 _param_spec: glib::ffi::gpointer,
701 f: glib::ffi::gpointer,
702 ) {
703 let f: &F = &*(f as *const F);
704 f(&from_glib_borrow(this))
705 }
706 unsafe {
707 let f: Box_<F> = Box_::new(f);
708 connect_raw(
709 self.as_ptr() as *mut _,
710 c"notify::out".as_ptr() as *const _,
711 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
712 notify_out_trampoline::<F> as *const (),
713 )),
714 Box_::into_raw(f),
715 )
716 }
717 }
718
719 #[cfg(feature = "v1_28")]
720 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
721 #[doc(alias = "silent")]
722 pub fn connect_silent_notify<F: Fn(&Self) + Send + Sync + 'static>(
723 &self,
724 f: F,
725 ) -> SignalHandlerId {
726 unsafe extern "C" fn notify_silent_trampoline<F: Fn(&AppSink) + Send + Sync + 'static>(
727 this: *mut ffi::GstAppSink,
728 _param_spec: glib::ffi::gpointer,
729 f: glib::ffi::gpointer,
730 ) {
731 let f: &F = &*(f as *const F);
732 f(&from_glib_borrow(this))
733 }
734 unsafe {
735 let f: Box_<F> = Box_::new(f);
736 connect_raw(
737 self.as_ptr() as *mut _,
738 c"notify::silent".as_ptr() as *const _,
739 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
740 notify_silent_trampoline::<F> as *const (),
741 )),
742 Box_::into_raw(f),
743 )
744 }
745 }
746
747 #[doc(alias = "wait-on-eos")]
748 pub fn connect_wait_on_eos_notify<F: Fn(&Self) + Send + Sync + 'static>(
749 &self,
750 f: F,
751 ) -> SignalHandlerId {
752 unsafe extern "C" fn notify_wait_on_eos_trampoline<
753 F: Fn(&AppSink) + Send + Sync + 'static,
754 >(
755 this: *mut ffi::GstAppSink,
756 _param_spec: glib::ffi::gpointer,
757 f: glib::ffi::gpointer,
758 ) {
759 let f: &F = &*(f as *const F);
760 f(&from_glib_borrow(this))
761 }
762 unsafe {
763 let f: Box_<F> = Box_::new(f);
764 connect_raw(
765 self.as_ptr() as *mut _,
766 c"notify::wait-on-eos".as_ptr() as *const _,
767 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
768 notify_wait_on_eos_trampoline::<F> as *const (),
769 )),
770 Box_::into_raw(f),
771 )
772 }
773 }
774}
775
776unsafe impl Send for AppSink {}
777unsafe impl Sync for AppSink {}