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")]
229 #[doc(alias = "wait-on-eos")]
230 pub fn set_wait_on_eos(&self, wait: bool) {
231 unsafe {
232 ffi::gst_app_sink_set_wait_on_eos(self.to_glib_none().0, wait.into_glib());
233 }
234 }
235
236 #[cfg(feature = "v1_20")]
237 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
238 #[doc(alias = "gst_app_sink_try_pull_object")]
239 pub fn try_pull_object(
240 &self,
241 timeout: impl Into<Option<gst::ClockTime>>,
242 ) -> Option<gst::MiniObject> {
243 unsafe {
244 from_glib_full(ffi::gst_app_sink_try_pull_object(
245 self.to_glib_none().0,
246 timeout.into().into_glib(),
247 ))
248 }
249 }
250
251 #[doc(alias = "gst_app_sink_try_pull_preroll")]
252 pub fn try_pull_preroll(
253 &self,
254 timeout: impl Into<Option<gst::ClockTime>>,
255 ) -> Option<gst::Sample> {
256 unsafe {
257 from_glib_full(ffi::gst_app_sink_try_pull_preroll(
258 self.to_glib_none().0,
259 timeout.into().into_glib(),
260 ))
261 }
262 }
263
264 #[doc(alias = "gst_app_sink_try_pull_sample")]
265 pub fn try_pull_sample(
266 &self,
267 timeout: impl Into<Option<gst::ClockTime>>,
268 ) -> Option<gst::Sample> {
269 unsafe {
270 from_glib_full(ffi::gst_app_sink_try_pull_sample(
271 self.to_glib_none().0,
272 timeout.into().into_glib(),
273 ))
274 }
275 }
276
277 #[doc(alias = "buffer-list")]
278 pub fn is_buffer_list(&self) -> bool {
279 ObjectExt::property(self, "buffer-list")
280 }
281
282 #[doc(alias = "buffer-list")]
283 pub fn set_buffer_list(&self, buffer_list: bool) {
284 ObjectExt::set_property(self, "buffer-list", buffer_list)
285 }
286
287 #[cfg(feature = "v1_28")]
288 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
289 pub fn dropped(&self) -> u64 {
290 ObjectExt::property(self, "dropped")
291 }
292
293 #[cfg(feature = "v1_28")]
294 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
295 #[doc(alias = "in")]
296 pub fn get_in(&self) -> u64 {
297 ObjectExt::property(self, "in")
298 }
299
300 #[cfg(feature = "v1_28")]
301 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
302 pub fn out(&self) -> u64 {
303 ObjectExt::property(self, "out")
304 }
305
306 #[cfg(feature = "v1_28")]
307 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
308 pub fn is_silent(&self) -> bool {
309 ObjectExt::property(self, "silent")
310 }
311
312 #[cfg(feature = "v1_28")]
313 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
314 pub fn set_silent(&self, silent: bool) {
315 ObjectExt::set_property(self, "silent", silent)
316 }
317
318 #[doc(alias = "buffer-list")]
319 pub fn connect_buffer_list_notify<F: Fn(&Self) + Send + Sync + 'static>(
320 &self,
321 f: F,
322 ) -> SignalHandlerId {
323 unsafe extern "C" fn notify_buffer_list_trampoline<
324 F: Fn(&AppSink) + Send + Sync + 'static,
325 >(
326 this: *mut ffi::GstAppSink,
327 _param_spec: glib::ffi::gpointer,
328 f: glib::ffi::gpointer,
329 ) {
330 let f: &F = &*(f as *const F);
331 f(&from_glib_borrow(this))
332 }
333 unsafe {
334 let f: Box_<F> = Box_::new(f);
335 connect_raw(
336 self.as_ptr() as *mut _,
337 c"notify::buffer-list".as_ptr() as *const _,
338 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
339 notify_buffer_list_trampoline::<F> as *const (),
340 )),
341 Box_::into_raw(f),
342 )
343 }
344 }
345
346 #[doc(alias = "caps")]
347 pub fn connect_caps_notify<F: Fn(&Self) + Send + Sync + 'static>(
348 &self,
349 f: F,
350 ) -> SignalHandlerId {
351 unsafe extern "C" fn notify_caps_trampoline<F: Fn(&AppSink) + Send + Sync + 'static>(
352 this: *mut ffi::GstAppSink,
353 _param_spec: glib::ffi::gpointer,
354 f: glib::ffi::gpointer,
355 ) {
356 let f: &F = &*(f as *const F);
357 f(&from_glib_borrow(this))
358 }
359 unsafe {
360 let f: Box_<F> = Box_::new(f);
361 connect_raw(
362 self.as_ptr() as *mut _,
363 c"notify::caps".as_ptr() as *const _,
364 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
365 notify_caps_trampoline::<F> as *const (),
366 )),
367 Box_::into_raw(f),
368 )
369 }
370 }
371
372 #[cfg(feature = "v1_28")]
373 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
374 #[doc(alias = "current-level-buffers")]
375 pub fn connect_current_level_buffers_notify<F: Fn(&Self) + Send + Sync + 'static>(
376 &self,
377 f: F,
378 ) -> SignalHandlerId {
379 unsafe extern "C" fn notify_current_level_buffers_trampoline<
380 F: Fn(&AppSink) + Send + Sync + 'static,
381 >(
382 this: *mut ffi::GstAppSink,
383 _param_spec: glib::ffi::gpointer,
384 f: glib::ffi::gpointer,
385 ) {
386 let f: &F = &*(f as *const F);
387 f(&from_glib_borrow(this))
388 }
389 unsafe {
390 let f: Box_<F> = Box_::new(f);
391 connect_raw(
392 self.as_ptr() as *mut _,
393 c"notify::current-level-buffers".as_ptr() as *const _,
394 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
395 notify_current_level_buffers_trampoline::<F> as *const (),
396 )),
397 Box_::into_raw(f),
398 )
399 }
400 }
401
402 #[cfg(feature = "v1_28")]
403 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
404 #[doc(alias = "current-level-bytes")]
405 pub fn connect_current_level_bytes_notify<F: Fn(&Self) + Send + Sync + 'static>(
406 &self,
407 f: F,
408 ) -> SignalHandlerId {
409 unsafe extern "C" fn notify_current_level_bytes_trampoline<
410 F: Fn(&AppSink) + Send + Sync + 'static,
411 >(
412 this: *mut ffi::GstAppSink,
413 _param_spec: glib::ffi::gpointer,
414 f: glib::ffi::gpointer,
415 ) {
416 let f: &F = &*(f as *const F);
417 f(&from_glib_borrow(this))
418 }
419 unsafe {
420 let f: Box_<F> = Box_::new(f);
421 connect_raw(
422 self.as_ptr() as *mut _,
423 c"notify::current-level-bytes".as_ptr() as *const _,
424 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
425 notify_current_level_bytes_trampoline::<F> as *const (),
426 )),
427 Box_::into_raw(f),
428 )
429 }
430 }
431
432 #[cfg(feature = "v1_28")]
433 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
434 #[doc(alias = "current-level-time")]
435 pub fn connect_current_level_time_notify<F: Fn(&Self) + Send + Sync + 'static>(
436 &self,
437 f: F,
438 ) -> SignalHandlerId {
439 unsafe extern "C" fn notify_current_level_time_trampoline<
440 F: Fn(&AppSink) + Send + Sync + 'static,
441 >(
442 this: *mut ffi::GstAppSink,
443 _param_spec: glib::ffi::gpointer,
444 f: glib::ffi::gpointer,
445 ) {
446 let f: &F = &*(f as *const F);
447 f(&from_glib_borrow(this))
448 }
449 unsafe {
450 let f: Box_<F> = Box_::new(f);
451 connect_raw(
452 self.as_ptr() as *mut _,
453 c"notify::current-level-time".as_ptr() as *const _,
454 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
455 notify_current_level_time_trampoline::<F> as *const (),
456 )),
457 Box_::into_raw(f),
458 )
459 }
460 }
461
462 #[cfg_attr(feature = "v1_28", deprecated = "Since 1.28")]
463 #[doc(alias = "drop")]
464 pub fn connect_drop_notify<F: Fn(&Self) + Send + Sync + 'static>(
465 &self,
466 f: F,
467 ) -> SignalHandlerId {
468 unsafe extern "C" fn notify_drop_trampoline<F: Fn(&AppSink) + Send + Sync + 'static>(
469 this: *mut ffi::GstAppSink,
470 _param_spec: glib::ffi::gpointer,
471 f: glib::ffi::gpointer,
472 ) {
473 let f: &F = &*(f as *const F);
474 f(&from_glib_borrow(this))
475 }
476 unsafe {
477 let f: Box_<F> = Box_::new(f);
478 connect_raw(
479 self.as_ptr() as *mut _,
480 c"notify::drop".as_ptr() as *const _,
481 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
482 notify_drop_trampoline::<F> as *const (),
483 )),
484 Box_::into_raw(f),
485 )
486 }
487 }
488
489 #[cfg(feature = "v1_28")]
490 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
491 #[doc(alias = "dropped")]
492 pub fn connect_dropped_notify<F: Fn(&Self) + Send + Sync + 'static>(
493 &self,
494 f: F,
495 ) -> SignalHandlerId {
496 unsafe extern "C" fn notify_dropped_trampoline<F: Fn(&AppSink) + Send + Sync + 'static>(
497 this: *mut ffi::GstAppSink,
498 _param_spec: glib::ffi::gpointer,
499 f: glib::ffi::gpointer,
500 ) {
501 let f: &F = &*(f as *const F);
502 f(&from_glib_borrow(this))
503 }
504 unsafe {
505 let f: Box_<F> = Box_::new(f);
506 connect_raw(
507 self.as_ptr() as *mut _,
508 c"notify::dropped".as_ptr() as *const _,
509 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
510 notify_dropped_trampoline::<F> as *const (),
511 )),
512 Box_::into_raw(f),
513 )
514 }
515 }
516
517 #[doc(alias = "eos")]
518 pub fn connect_eos_notify<F: Fn(&Self) + Send + Sync + 'static>(
519 &self,
520 f: F,
521 ) -> SignalHandlerId {
522 unsafe extern "C" fn notify_eos_trampoline<F: Fn(&AppSink) + Send + Sync + 'static>(
523 this: *mut ffi::GstAppSink,
524 _param_spec: glib::ffi::gpointer,
525 f: glib::ffi::gpointer,
526 ) {
527 let f: &F = &*(f as *const F);
528 f(&from_glib_borrow(this))
529 }
530 unsafe {
531 let f: Box_<F> = Box_::new(f);
532 connect_raw(
533 self.as_ptr() as *mut _,
534 c"notify::eos".as_ptr() as *const _,
535 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
536 notify_eos_trampoline::<F> as *const (),
537 )),
538 Box_::into_raw(f),
539 )
540 }
541 }
542
543 #[cfg(feature = "v1_28")]
544 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
545 #[doc(alias = "in")]
546 pub fn connect_in_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
547 unsafe extern "C" fn notify_in_trampoline<F: Fn(&AppSink) + Send + Sync + 'static>(
548 this: *mut ffi::GstAppSink,
549 _param_spec: glib::ffi::gpointer,
550 f: glib::ffi::gpointer,
551 ) {
552 let f: &F = &*(f as *const F);
553 f(&from_glib_borrow(this))
554 }
555 unsafe {
556 let f: Box_<F> = Box_::new(f);
557 connect_raw(
558 self.as_ptr() as *mut _,
559 c"notify::in".as_ptr() as *const _,
560 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
561 notify_in_trampoline::<F> as *const (),
562 )),
563 Box_::into_raw(f),
564 )
565 }
566 }
567
568 #[cfg(feature = "v1_28")]
569 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
570 #[doc(alias = "leaky-type")]
571 pub fn connect_leaky_type_notify<F: Fn(&Self) + Send + Sync + 'static>(
572 &self,
573 f: F,
574 ) -> SignalHandlerId {
575 unsafe extern "C" fn notify_leaky_type_trampoline<
576 F: Fn(&AppSink) + Send + Sync + 'static,
577 >(
578 this: *mut ffi::GstAppSink,
579 _param_spec: glib::ffi::gpointer,
580 f: glib::ffi::gpointer,
581 ) {
582 let f: &F = &*(f as *const F);
583 f(&from_glib_borrow(this))
584 }
585 unsafe {
586 let f: Box_<F> = Box_::new(f);
587 connect_raw(
588 self.as_ptr() as *mut _,
589 c"notify::leaky-type".as_ptr() as *const _,
590 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
591 notify_leaky_type_trampoline::<F> as *const (),
592 )),
593 Box_::into_raw(f),
594 )
595 }
596 }
597
598 #[doc(alias = "max-buffers")]
599 pub fn connect_max_buffers_notify<F: Fn(&Self) + Send + Sync + 'static>(
600 &self,
601 f: F,
602 ) -> SignalHandlerId {
603 unsafe extern "C" fn notify_max_buffers_trampoline<
604 F: Fn(&AppSink) + Send + Sync + 'static,
605 >(
606 this: *mut ffi::GstAppSink,
607 _param_spec: glib::ffi::gpointer,
608 f: glib::ffi::gpointer,
609 ) {
610 let f: &F = &*(f as *const F);
611 f(&from_glib_borrow(this))
612 }
613 unsafe {
614 let f: Box_<F> = Box_::new(f);
615 connect_raw(
616 self.as_ptr() as *mut _,
617 c"notify::max-buffers".as_ptr() as *const _,
618 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
619 notify_max_buffers_trampoline::<F> as *const (),
620 )),
621 Box_::into_raw(f),
622 )
623 }
624 }
625
626 #[cfg(feature = "v1_24")]
627 #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
628 #[doc(alias = "max-bytes")]
629 pub fn connect_max_bytes_notify<F: Fn(&Self) + Send + Sync + 'static>(
630 &self,
631 f: F,
632 ) -> SignalHandlerId {
633 unsafe extern "C" fn notify_max_bytes_trampoline<
634 F: Fn(&AppSink) + Send + Sync + 'static,
635 >(
636 this: *mut ffi::GstAppSink,
637 _param_spec: glib::ffi::gpointer,
638 f: glib::ffi::gpointer,
639 ) {
640 let f: &F = &*(f as *const F);
641 f(&from_glib_borrow(this))
642 }
643 unsafe {
644 let f: Box_<F> = Box_::new(f);
645 connect_raw(
646 self.as_ptr() as *mut _,
647 c"notify::max-bytes".as_ptr() as *const _,
648 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
649 notify_max_bytes_trampoline::<F> as *const (),
650 )),
651 Box_::into_raw(f),
652 )
653 }
654 }
655
656 #[cfg(feature = "v1_24")]
657 #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
658 #[doc(alias = "max-time")]
659 pub fn connect_max_time_notify<F: Fn(&Self) + Send + Sync + 'static>(
660 &self,
661 f: F,
662 ) -> SignalHandlerId {
663 unsafe extern "C" fn notify_max_time_trampoline<F: Fn(&AppSink) + Send + Sync + 'static>(
664 this: *mut ffi::GstAppSink,
665 _param_spec: glib::ffi::gpointer,
666 f: glib::ffi::gpointer,
667 ) {
668 let f: &F = &*(f as *const F);
669 f(&from_glib_borrow(this))
670 }
671 unsafe {
672 let f: Box_<F> = Box_::new(f);
673 connect_raw(
674 self.as_ptr() as *mut _,
675 c"notify::max-time".as_ptr() as *const _,
676 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
677 notify_max_time_trampoline::<F> as *const (),
678 )),
679 Box_::into_raw(f),
680 )
681 }
682 }
683
684 #[cfg(feature = "v1_28")]
685 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
686 #[doc(alias = "out")]
687 pub fn connect_out_notify<F: Fn(&Self) + Send + Sync + 'static>(
688 &self,
689 f: F,
690 ) -> SignalHandlerId {
691 unsafe extern "C" fn notify_out_trampoline<F: Fn(&AppSink) + Send + Sync + 'static>(
692 this: *mut ffi::GstAppSink,
693 _param_spec: glib::ffi::gpointer,
694 f: glib::ffi::gpointer,
695 ) {
696 let f: &F = &*(f as *const F);
697 f(&from_glib_borrow(this))
698 }
699 unsafe {
700 let f: Box_<F> = Box_::new(f);
701 connect_raw(
702 self.as_ptr() as *mut _,
703 c"notify::out".as_ptr() as *const _,
704 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
705 notify_out_trampoline::<F> as *const (),
706 )),
707 Box_::into_raw(f),
708 )
709 }
710 }
711
712 #[cfg(feature = "v1_28")]
713 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
714 #[doc(alias = "silent")]
715 pub fn connect_silent_notify<F: Fn(&Self) + Send + Sync + 'static>(
716 &self,
717 f: F,
718 ) -> SignalHandlerId {
719 unsafe extern "C" fn notify_silent_trampoline<F: Fn(&AppSink) + Send + Sync + 'static>(
720 this: *mut ffi::GstAppSink,
721 _param_spec: glib::ffi::gpointer,
722 f: glib::ffi::gpointer,
723 ) {
724 let f: &F = &*(f as *const F);
725 f(&from_glib_borrow(this))
726 }
727 unsafe {
728 let f: Box_<F> = Box_::new(f);
729 connect_raw(
730 self.as_ptr() as *mut _,
731 c"notify::silent".as_ptr() as *const _,
732 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
733 notify_silent_trampoline::<F> as *const (),
734 )),
735 Box_::into_raw(f),
736 )
737 }
738 }
739
740 #[doc(alias = "wait-on-eos")]
741 pub fn connect_wait_on_eos_notify<F: Fn(&Self) + Send + Sync + 'static>(
742 &self,
743 f: F,
744 ) -> SignalHandlerId {
745 unsafe extern "C" fn notify_wait_on_eos_trampoline<
746 F: Fn(&AppSink) + Send + Sync + 'static,
747 >(
748 this: *mut ffi::GstAppSink,
749 _param_spec: glib::ffi::gpointer,
750 f: glib::ffi::gpointer,
751 ) {
752 let f: &F = &*(f as *const F);
753 f(&from_glib_borrow(this))
754 }
755 unsafe {
756 let f: Box_<F> = Box_::new(f);
757 connect_raw(
758 self.as_ptr() as *mut _,
759 c"notify::wait-on-eos".as_ptr() as *const _,
760 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
761 notify_wait_on_eos_trampoline::<F> as *const (),
762 )),
763 Box_::into_raw(f),
764 )
765 }
766 }
767}
768
769unsafe impl Send for AppSink {}
770unsafe impl Sync for AppSink {}