1#![allow(deprecated)]
6
7#[cfg(feature = "v1_28")]
8#[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
9use crate::AppLeakyType;
10use crate::ffi;
11use glib::{
12 prelude::*,
13 signal::{SignalHandlerId, connect_raw},
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 unsafe {
338 let f: &F = &*(f as *const F);
339 f(&from_glib_borrow(this))
340 }
341 }
342 unsafe {
343 let f: Box_<F> = Box_::new(f);
344 connect_raw(
345 self.as_ptr() as *mut _,
346 c"notify::buffer-list".as_ptr(),
347 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
348 notify_buffer_list_trampoline::<F> as *const (),
349 )),
350 Box_::into_raw(f),
351 )
352 }
353 }
354
355 #[doc(alias = "caps")]
356 pub fn connect_caps_notify<F: Fn(&Self) + Send + Sync + 'static>(
357 &self,
358 f: F,
359 ) -> SignalHandlerId {
360 unsafe extern "C" fn notify_caps_trampoline<F: Fn(&AppSink) + Send + Sync + 'static>(
361 this: *mut ffi::GstAppSink,
362 _param_spec: glib::ffi::gpointer,
363 f: glib::ffi::gpointer,
364 ) {
365 unsafe {
366 let f: &F = &*(f as *const F);
367 f(&from_glib_borrow(this))
368 }
369 }
370 unsafe {
371 let f: Box_<F> = Box_::new(f);
372 connect_raw(
373 self.as_ptr() as *mut _,
374 c"notify::caps".as_ptr(),
375 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
376 notify_caps_trampoline::<F> as *const (),
377 )),
378 Box_::into_raw(f),
379 )
380 }
381 }
382
383 #[cfg(feature = "v1_28")]
384 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
385 #[doc(alias = "current-level-buffers")]
386 pub fn connect_current_level_buffers_notify<F: Fn(&Self) + Send + Sync + 'static>(
387 &self,
388 f: F,
389 ) -> SignalHandlerId {
390 unsafe extern "C" fn notify_current_level_buffers_trampoline<
391 F: Fn(&AppSink) + Send + Sync + 'static,
392 >(
393 this: *mut ffi::GstAppSink,
394 _param_spec: glib::ffi::gpointer,
395 f: glib::ffi::gpointer,
396 ) {
397 unsafe {
398 let f: &F = &*(f as *const F);
399 f(&from_glib_borrow(this))
400 }
401 }
402 unsafe {
403 let f: Box_<F> = Box_::new(f);
404 connect_raw(
405 self.as_ptr() as *mut _,
406 c"notify::current-level-buffers".as_ptr(),
407 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
408 notify_current_level_buffers_trampoline::<F> as *const (),
409 )),
410 Box_::into_raw(f),
411 )
412 }
413 }
414
415 #[cfg(feature = "v1_28")]
416 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
417 #[doc(alias = "current-level-bytes")]
418 pub fn connect_current_level_bytes_notify<F: Fn(&Self) + Send + Sync + 'static>(
419 &self,
420 f: F,
421 ) -> SignalHandlerId {
422 unsafe extern "C" fn notify_current_level_bytes_trampoline<
423 F: Fn(&AppSink) + Send + Sync + 'static,
424 >(
425 this: *mut ffi::GstAppSink,
426 _param_spec: glib::ffi::gpointer,
427 f: glib::ffi::gpointer,
428 ) {
429 unsafe {
430 let f: &F = &*(f as *const F);
431 f(&from_glib_borrow(this))
432 }
433 }
434 unsafe {
435 let f: Box_<F> = Box_::new(f);
436 connect_raw(
437 self.as_ptr() as *mut _,
438 c"notify::current-level-bytes".as_ptr(),
439 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
440 notify_current_level_bytes_trampoline::<F> as *const (),
441 )),
442 Box_::into_raw(f),
443 )
444 }
445 }
446
447 #[cfg(feature = "v1_28")]
448 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
449 #[doc(alias = "current-level-time")]
450 pub fn connect_current_level_time_notify<F: Fn(&Self) + Send + Sync + 'static>(
451 &self,
452 f: F,
453 ) -> SignalHandlerId {
454 unsafe extern "C" fn notify_current_level_time_trampoline<
455 F: Fn(&AppSink) + Send + Sync + 'static,
456 >(
457 this: *mut ffi::GstAppSink,
458 _param_spec: glib::ffi::gpointer,
459 f: glib::ffi::gpointer,
460 ) {
461 unsafe {
462 let f: &F = &*(f as *const F);
463 f(&from_glib_borrow(this))
464 }
465 }
466 unsafe {
467 let f: Box_<F> = Box_::new(f);
468 connect_raw(
469 self.as_ptr() as *mut _,
470 c"notify::current-level-time".as_ptr(),
471 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
472 notify_current_level_time_trampoline::<F> as *const (),
473 )),
474 Box_::into_raw(f),
475 )
476 }
477 }
478
479 #[cfg_attr(feature = "v1_28", deprecated = "Since 1.28")]
480 #[doc(alias = "drop")]
481 pub fn connect_drop_notify<F: Fn(&Self) + Send + Sync + 'static>(
482 &self,
483 f: F,
484 ) -> SignalHandlerId {
485 unsafe extern "C" fn notify_drop_trampoline<F: Fn(&AppSink) + Send + Sync + 'static>(
486 this: *mut ffi::GstAppSink,
487 _param_spec: glib::ffi::gpointer,
488 f: glib::ffi::gpointer,
489 ) {
490 unsafe {
491 let f: &F = &*(f as *const F);
492 f(&from_glib_borrow(this))
493 }
494 }
495 unsafe {
496 let f: Box_<F> = Box_::new(f);
497 connect_raw(
498 self.as_ptr() as *mut _,
499 c"notify::drop".as_ptr(),
500 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
501 notify_drop_trampoline::<F> as *const (),
502 )),
503 Box_::into_raw(f),
504 )
505 }
506 }
507
508 #[cfg(feature = "v1_28")]
509 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
510 #[doc(alias = "dropped")]
511 pub fn connect_dropped_notify<F: Fn(&Self) + Send + Sync + 'static>(
512 &self,
513 f: F,
514 ) -> SignalHandlerId {
515 unsafe extern "C" fn notify_dropped_trampoline<F: Fn(&AppSink) + Send + Sync + 'static>(
516 this: *mut ffi::GstAppSink,
517 _param_spec: glib::ffi::gpointer,
518 f: glib::ffi::gpointer,
519 ) {
520 unsafe {
521 let f: &F = &*(f as *const F);
522 f(&from_glib_borrow(this))
523 }
524 }
525 unsafe {
526 let f: Box_<F> = Box_::new(f);
527 connect_raw(
528 self.as_ptr() as *mut _,
529 c"notify::dropped".as_ptr(),
530 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
531 notify_dropped_trampoline::<F> as *const (),
532 )),
533 Box_::into_raw(f),
534 )
535 }
536 }
537
538 #[doc(alias = "eos")]
539 pub fn connect_eos_notify<F: Fn(&Self) + Send + Sync + 'static>(
540 &self,
541 f: F,
542 ) -> SignalHandlerId {
543 unsafe extern "C" fn notify_eos_trampoline<F: Fn(&AppSink) + Send + Sync + 'static>(
544 this: *mut ffi::GstAppSink,
545 _param_spec: glib::ffi::gpointer,
546 f: glib::ffi::gpointer,
547 ) {
548 unsafe {
549 let f: &F = &*(f as *const F);
550 f(&from_glib_borrow(this))
551 }
552 }
553 unsafe {
554 let f: Box_<F> = Box_::new(f);
555 connect_raw(
556 self.as_ptr() as *mut _,
557 c"notify::eos".as_ptr(),
558 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
559 notify_eos_trampoline::<F> as *const (),
560 )),
561 Box_::into_raw(f),
562 )
563 }
564 }
565
566 #[cfg(feature = "v1_28")]
567 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
568 #[doc(alias = "in")]
569 pub fn connect_in_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
570 unsafe extern "C" fn notify_in_trampoline<F: Fn(&AppSink) + Send + Sync + 'static>(
571 this: *mut ffi::GstAppSink,
572 _param_spec: glib::ffi::gpointer,
573 f: glib::ffi::gpointer,
574 ) {
575 unsafe {
576 let f: &F = &*(f as *const F);
577 f(&from_glib_borrow(this))
578 }
579 }
580 unsafe {
581 let f: Box_<F> = Box_::new(f);
582 connect_raw(
583 self.as_ptr() as *mut _,
584 c"notify::in".as_ptr(),
585 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
586 notify_in_trampoline::<F> as *const (),
587 )),
588 Box_::into_raw(f),
589 )
590 }
591 }
592
593 #[cfg(feature = "v1_28")]
594 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
595 #[doc(alias = "leaky-type")]
596 pub fn connect_leaky_type_notify<F: Fn(&Self) + Send + Sync + 'static>(
597 &self,
598 f: F,
599 ) -> SignalHandlerId {
600 unsafe extern "C" fn notify_leaky_type_trampoline<
601 F: Fn(&AppSink) + Send + Sync + 'static,
602 >(
603 this: *mut ffi::GstAppSink,
604 _param_spec: glib::ffi::gpointer,
605 f: glib::ffi::gpointer,
606 ) {
607 unsafe {
608 let f: &F = &*(f as *const F);
609 f(&from_glib_borrow(this))
610 }
611 }
612 unsafe {
613 let f: Box_<F> = Box_::new(f);
614 connect_raw(
615 self.as_ptr() as *mut _,
616 c"notify::leaky-type".as_ptr(),
617 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
618 notify_leaky_type_trampoline::<F> as *const (),
619 )),
620 Box_::into_raw(f),
621 )
622 }
623 }
624
625 #[doc(alias = "max-buffers")]
626 pub fn connect_max_buffers_notify<F: Fn(&Self) + Send + Sync + 'static>(
627 &self,
628 f: F,
629 ) -> SignalHandlerId {
630 unsafe extern "C" fn notify_max_buffers_trampoline<
631 F: Fn(&AppSink) + Send + Sync + 'static,
632 >(
633 this: *mut ffi::GstAppSink,
634 _param_spec: glib::ffi::gpointer,
635 f: glib::ffi::gpointer,
636 ) {
637 unsafe {
638 let f: &F = &*(f as *const F);
639 f(&from_glib_borrow(this))
640 }
641 }
642 unsafe {
643 let f: Box_<F> = Box_::new(f);
644 connect_raw(
645 self.as_ptr() as *mut _,
646 c"notify::max-buffers".as_ptr(),
647 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
648 notify_max_buffers_trampoline::<F> as *const (),
649 )),
650 Box_::into_raw(f),
651 )
652 }
653 }
654
655 #[cfg(feature = "v1_24")]
656 #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
657 #[doc(alias = "max-bytes")]
658 pub fn connect_max_bytes_notify<F: Fn(&Self) + Send + Sync + 'static>(
659 &self,
660 f: F,
661 ) -> SignalHandlerId {
662 unsafe extern "C" fn notify_max_bytes_trampoline<
663 F: Fn(&AppSink) + Send + Sync + 'static,
664 >(
665 this: *mut ffi::GstAppSink,
666 _param_spec: glib::ffi::gpointer,
667 f: glib::ffi::gpointer,
668 ) {
669 unsafe {
670 let f: &F = &*(f as *const F);
671 f(&from_glib_borrow(this))
672 }
673 }
674 unsafe {
675 let f: Box_<F> = Box_::new(f);
676 connect_raw(
677 self.as_ptr() as *mut _,
678 c"notify::max-bytes".as_ptr(),
679 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
680 notify_max_bytes_trampoline::<F> as *const (),
681 )),
682 Box_::into_raw(f),
683 )
684 }
685 }
686
687 #[cfg(feature = "v1_24")]
688 #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
689 #[doc(alias = "max-time")]
690 pub fn connect_max_time_notify<F: Fn(&Self) + Send + Sync + 'static>(
691 &self,
692 f: F,
693 ) -> SignalHandlerId {
694 unsafe extern "C" fn notify_max_time_trampoline<F: Fn(&AppSink) + Send + Sync + 'static>(
695 this: *mut ffi::GstAppSink,
696 _param_spec: glib::ffi::gpointer,
697 f: glib::ffi::gpointer,
698 ) {
699 unsafe {
700 let f: &F = &*(f as *const F);
701 f(&from_glib_borrow(this))
702 }
703 }
704 unsafe {
705 let f: Box_<F> = Box_::new(f);
706 connect_raw(
707 self.as_ptr() as *mut _,
708 c"notify::max-time".as_ptr(),
709 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
710 notify_max_time_trampoline::<F> as *const (),
711 )),
712 Box_::into_raw(f),
713 )
714 }
715 }
716
717 #[cfg(feature = "v1_28")]
718 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
719 #[doc(alias = "out")]
720 pub fn connect_out_notify<F: Fn(&Self) + Send + Sync + 'static>(
721 &self,
722 f: F,
723 ) -> SignalHandlerId {
724 unsafe extern "C" fn notify_out_trampoline<F: Fn(&AppSink) + Send + Sync + 'static>(
725 this: *mut ffi::GstAppSink,
726 _param_spec: glib::ffi::gpointer,
727 f: glib::ffi::gpointer,
728 ) {
729 unsafe {
730 let f: &F = &*(f as *const F);
731 f(&from_glib_borrow(this))
732 }
733 }
734 unsafe {
735 let f: Box_<F> = Box_::new(f);
736 connect_raw(
737 self.as_ptr() as *mut _,
738 c"notify::out".as_ptr(),
739 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
740 notify_out_trampoline::<F> as *const (),
741 )),
742 Box_::into_raw(f),
743 )
744 }
745 }
746
747 #[cfg(feature = "v1_28")]
748 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
749 #[doc(alias = "silent")]
750 pub fn connect_silent_notify<F: Fn(&Self) + Send + Sync + 'static>(
751 &self,
752 f: F,
753 ) -> SignalHandlerId {
754 unsafe extern "C" fn notify_silent_trampoline<F: Fn(&AppSink) + Send + Sync + 'static>(
755 this: *mut ffi::GstAppSink,
756 _param_spec: glib::ffi::gpointer,
757 f: glib::ffi::gpointer,
758 ) {
759 unsafe {
760 let f: &F = &*(f as *const F);
761 f(&from_glib_borrow(this))
762 }
763 }
764 unsafe {
765 let f: Box_<F> = Box_::new(f);
766 connect_raw(
767 self.as_ptr() as *mut _,
768 c"notify::silent".as_ptr(),
769 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
770 notify_silent_trampoline::<F> as *const (),
771 )),
772 Box_::into_raw(f),
773 )
774 }
775 }
776
777 #[doc(alias = "wait-on-eos")]
778 pub fn connect_wait_on_eos_notify<F: Fn(&Self) + Send + Sync + 'static>(
779 &self,
780 f: F,
781 ) -> SignalHandlerId {
782 unsafe extern "C" fn notify_wait_on_eos_trampoline<
783 F: Fn(&AppSink) + Send + Sync + 'static,
784 >(
785 this: *mut ffi::GstAppSink,
786 _param_spec: glib::ffi::gpointer,
787 f: glib::ffi::gpointer,
788 ) {
789 unsafe {
790 let f: &F = &*(f as *const F);
791 f(&from_glib_borrow(this))
792 }
793 }
794 unsafe {
795 let f: Box_<F> = Box_::new(f);
796 connect_raw(
797 self.as_ptr() as *mut _,
798 c"notify::wait-on-eos".as_ptr(),
799 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
800 notify_wait_on_eos_trampoline::<F> as *const (),
801 )),
802 Box_::into_raw(f),
803 )
804 }
805 }
806}
807
808unsafe impl Send for AppSink {}
809unsafe impl Sync for AppSink {}