1#[cfg(feature = "v1_20")]
7#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
8use crate::AppLeakyType;
9use crate::{AppStreamType, ffi};
10use glib::{
11 prelude::*,
12 signal::{SignalHandlerId, connect_raw},
13 translate::*,
14};
15use std::boxed::Box as Box_;
16
17glib::wrapper! {
18 #[doc(alias = "GstAppSrc")]
19 pub struct AppSrc(Object<ffi::GstAppSrc, ffi::GstAppSrcClass>) @extends gst::Element, gst::Object, @implements gst::URIHandler;
20
21 match fn {
22 type_ => || ffi::gst_app_src_get_type(),
23 }
24}
25
26impl AppSrc {
27 #[doc(alias = "gst_app_src_end_of_stream")]
28 pub fn end_of_stream(&self) -> Result<gst::FlowSuccess, gst::FlowError> {
29 unsafe { try_from_glib(ffi::gst_app_src_end_of_stream(self.to_glib_none().0)) }
30 }
31
32 #[doc(alias = "gst_app_src_get_caps")]
33 #[doc(alias = "get_caps")]
34 pub fn caps(&self) -> Option<gst::Caps> {
35 unsafe { from_glib_full(ffi::gst_app_src_get_caps(self.to_glib_none().0)) }
36 }
37
38 #[cfg(feature = "v1_20")]
39 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
40 #[doc(alias = "gst_app_src_get_current_level_buffers")]
41 #[doc(alias = "get_current_level_buffers")]
42 #[doc(alias = "current-level-buffers")]
43 pub fn current_level_buffers(&self) -> u64 {
44 unsafe { ffi::gst_app_src_get_current_level_buffers(self.to_glib_none().0) }
45 }
46
47 #[doc(alias = "gst_app_src_get_current_level_bytes")]
48 #[doc(alias = "get_current_level_bytes")]
49 #[doc(alias = "current-level-bytes")]
50 pub fn current_level_bytes(&self) -> u64 {
51 unsafe { ffi::gst_app_src_get_current_level_bytes(self.to_glib_none().0) }
52 }
53
54 #[cfg(feature = "v1_20")]
55 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
56 #[doc(alias = "gst_app_src_get_current_level_time")]
57 #[doc(alias = "get_current_level_time")]
58 #[doc(alias = "current-level-time")]
59 pub fn current_level_time(&self) -> gst::ClockTime {
60 unsafe {
61 try_from_glib(ffi::gst_app_src_get_current_level_time(
62 self.to_glib_none().0,
63 ))
64 .expect("mandatory glib value is None")
65 }
66 }
67
68 #[doc(alias = "gst_app_src_get_duration")]
69 #[doc(alias = "get_duration")]
70 pub fn duration(&self) -> Option<gst::ClockTime> {
71 unsafe { from_glib(ffi::gst_app_src_get_duration(self.to_glib_none().0)) }
72 }
73
74 #[cfg(feature = "v1_20")]
75 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
76 #[doc(alias = "gst_app_src_get_leaky_type")]
77 #[doc(alias = "get_leaky_type")]
78 #[doc(alias = "leaky-type")]
79 pub fn leaky_type(&self) -> AppLeakyType {
80 unsafe { from_glib(ffi::gst_app_src_get_leaky_type(self.to_glib_none().0)) }
81 }
82
83 #[cfg(feature = "v1_20")]
84 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
85 #[doc(alias = "gst_app_src_get_max_buffers")]
86 #[doc(alias = "get_max_buffers")]
87 #[doc(alias = "max-buffers")]
88 pub fn max_buffers(&self) -> u64 {
89 unsafe { ffi::gst_app_src_get_max_buffers(self.to_glib_none().0) }
90 }
91
92 #[doc(alias = "gst_app_src_get_max_bytes")]
93 #[doc(alias = "get_max_bytes")]
94 #[doc(alias = "max-bytes")]
95 pub fn max_bytes(&self) -> u64 {
96 unsafe { ffi::gst_app_src_get_max_bytes(self.to_glib_none().0) }
97 }
98
99 #[cfg(feature = "v1_20")]
100 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
101 #[doc(alias = "gst_app_src_get_max_time")]
102 #[doc(alias = "get_max_time")]
103 #[doc(alias = "max-time")]
104 pub fn max_time(&self) -> gst::ClockTime {
105 unsafe {
106 try_from_glib(ffi::gst_app_src_get_max_time(self.to_glib_none().0))
107 .expect("mandatory glib value is None")
108 }
109 }
110
111 #[doc(alias = "gst_app_src_get_size")]
112 #[doc(alias = "get_size")]
113 pub fn size(&self) -> i64 {
114 unsafe { ffi::gst_app_src_get_size(self.to_glib_none().0) }
115 }
116
117 #[doc(alias = "gst_app_src_get_stream_type")]
118 #[doc(alias = "get_stream_type")]
119 #[doc(alias = "stream-type")]
120 pub fn stream_type(&self) -> AppStreamType {
121 unsafe { from_glib(ffi::gst_app_src_get_stream_type(self.to_glib_none().0)) }
122 }
123
124 #[doc(alias = "gst_app_src_push_buffer")]
125 pub fn push_buffer(&self, buffer: gst::Buffer) -> Result<gst::FlowSuccess, gst::FlowError> {
126 unsafe {
127 try_from_glib(ffi::gst_app_src_push_buffer(
128 self.to_glib_none().0,
129 buffer.into_glib_ptr(),
130 ))
131 }
132 }
133
134 #[doc(alias = "gst_app_src_push_buffer_list")]
135 pub fn push_buffer_list(
136 &self,
137 buffer_list: gst::BufferList,
138 ) -> Result<gst::FlowSuccess, gst::FlowError> {
139 unsafe {
140 try_from_glib(ffi::gst_app_src_push_buffer_list(
141 self.to_glib_none().0,
142 buffer_list.into_glib_ptr(),
143 ))
144 }
145 }
146
147 #[doc(alias = "gst_app_src_push_sample")]
148 pub fn push_sample(&self, sample: &gst::Sample) -> Result<gst::FlowSuccess, gst::FlowError> {
149 unsafe {
150 try_from_glib(ffi::gst_app_src_push_sample(
151 self.to_glib_none().0,
152 sample.to_glib_none().0,
153 ))
154 }
155 }
156
157 #[doc(alias = "gst_app_src_set_caps")]
163 #[doc(alias = "caps")]
164 pub fn set_caps(&self, caps: Option<&gst::Caps>) {
165 unsafe {
166 ffi::gst_app_src_set_caps(self.to_glib_none().0, caps.to_glib_none().0);
167 }
168 }
169
170 #[doc(alias = "gst_app_src_set_duration")]
171 #[doc(alias = "duration")]
172 pub fn set_duration(&self, duration: impl Into<Option<gst::ClockTime>>) {
173 unsafe {
174 ffi::gst_app_src_set_duration(self.to_glib_none().0, duration.into().into_glib());
175 }
176 }
177
178 #[cfg(feature = "v1_20")]
179 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
180 #[doc(alias = "gst_app_src_set_leaky_type")]
181 #[doc(alias = "leaky-type")]
182 pub fn set_leaky_type(&self, leaky: AppLeakyType) {
183 unsafe {
184 ffi::gst_app_src_set_leaky_type(self.to_glib_none().0, leaky.into_glib());
185 }
186 }
187
188 #[cfg(feature = "v1_20")]
189 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
190 #[doc(alias = "gst_app_src_set_max_buffers")]
191 #[doc(alias = "max-buffers")]
192 pub fn set_max_buffers(&self, max: u64) {
193 unsafe {
194 ffi::gst_app_src_set_max_buffers(self.to_glib_none().0, max);
195 }
196 }
197
198 #[doc(alias = "gst_app_src_set_max_bytes")]
199 #[doc(alias = "max-bytes")]
200 pub fn set_max_bytes(&self, max: u64) {
201 unsafe {
202 ffi::gst_app_src_set_max_bytes(self.to_glib_none().0, max);
203 }
204 }
205
206 #[cfg(feature = "v1_20")]
207 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
208 #[doc(alias = "gst_app_src_set_max_time")]
209 #[doc(alias = "max-time")]
210 pub fn set_max_time(&self, max: gst::ClockTime) {
211 unsafe {
212 ffi::gst_app_src_set_max_time(self.to_glib_none().0, max.into_glib());
213 }
214 }
215
216 #[doc(alias = "gst_app_src_set_size")]
224 #[doc(alias = "size")]
225 pub fn set_size(&self, size: i64) {
226 unsafe {
227 ffi::gst_app_src_set_size(self.to_glib_none().0, size);
228 }
229 }
230
231 #[doc(alias = "gst_app_src_set_stream_type")]
232 #[doc(alias = "stream-type")]
233 pub fn set_stream_type(&self, type_: AppStreamType) {
234 unsafe {
235 ffi::gst_app_src_set_stream_type(self.to_glib_none().0, type_.into_glib());
236 }
237 }
238
239 pub fn is_block(&self) -> bool {
240 ObjectExt::property(self, "block")
241 }
242
243 pub fn set_block(&self, block: bool) {
244 ObjectExt::set_property(self, "block", block)
245 }
246
247 #[cfg(feature = "v1_28")]
248 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
249 pub fn dropped(&self) -> u64 {
250 ObjectExt::property(self, "dropped")
251 }
252
253 pub fn format(&self) -> gst::Format {
254 ObjectExt::property(self, "format")
255 }
256
257 pub fn set_format(&self, format: gst::Format) {
258 ObjectExt::set_property(self, "format", format)
259 }
260
261 #[cfg(feature = "v1_18")]
262 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
263 #[doc(alias = "handle-segment-change")]
264 pub fn is_handle_segment_change(&self) -> bool {
265 ObjectExt::property(self, "handle-segment-change")
266 }
267
268 #[cfg(feature = "v1_18")]
269 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
270 #[doc(alias = "handle-segment-change")]
271 pub fn set_handle_segment_change(&self, handle_segment_change: bool) {
272 ObjectExt::set_property(self, "handle-segment-change", handle_segment_change)
273 }
274
275 #[cfg(feature = "v1_28")]
276 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
277 #[doc(alias = "in")]
278 pub fn get_in(&self) -> u64 {
279 ObjectExt::property(self, "in")
280 }
281
282 #[doc(alias = "is-live")]
283 pub fn is_live(&self) -> bool {
284 ObjectExt::property(self, "is-live")
285 }
286
287 #[doc(alias = "is-live")]
288 pub fn set_is_live(&self, is_live: bool) {
289 ObjectExt::set_property(self, "is-live", is_live)
290 }
291
292 #[doc(alias = "max-latency")]
293 pub fn max_latency(&self) -> i64 {
294 ObjectExt::property(self, "max-latency")
295 }
296
297 #[doc(alias = "max-latency")]
298 pub fn set_max_latency(&self, max_latency: i64) {
299 ObjectExt::set_property(self, "max-latency", max_latency)
300 }
301
302 #[doc(alias = "min-latency")]
303 pub fn min_latency(&self) -> i64 {
304 ObjectExt::property(self, "min-latency")
305 }
306
307 #[doc(alias = "min-latency")]
308 pub fn set_min_latency(&self, min_latency: i64) {
309 ObjectExt::set_property(self, "min-latency", min_latency)
310 }
311
312 #[doc(alias = "min-percent")]
313 pub fn min_percent(&self) -> u32 {
314 ObjectExt::property(self, "min-percent")
315 }
316
317 #[doc(alias = "min-percent")]
318 pub fn set_min_percent(&self, min_percent: u32) {
319 ObjectExt::set_property(self, "min-percent", min_percent)
320 }
321
322 #[cfg(feature = "v1_28")]
323 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
324 pub fn out(&self) -> u64 {
325 ObjectExt::property(self, "out")
326 }
327
328 #[cfg(feature = "v1_28")]
329 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
330 pub fn is_silent(&self) -> bool {
331 ObjectExt::property(self, "silent")
332 }
333
334 #[cfg(feature = "v1_28")]
335 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
336 pub fn set_silent(&self, silent: bool) {
337 ObjectExt::set_property(self, "silent", silent)
338 }
339
340 #[doc(alias = "block")]
341 pub fn connect_block_notify<F: Fn(&Self) + Send + Sync + 'static>(
342 &self,
343 f: F,
344 ) -> SignalHandlerId {
345 unsafe extern "C" fn notify_block_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
346 this: *mut ffi::GstAppSrc,
347 _param_spec: glib::ffi::gpointer,
348 f: glib::ffi::gpointer,
349 ) {
350 unsafe {
351 let f: &F = &*(f as *const F);
352 f(&from_glib_borrow(this))
353 }
354 }
355 unsafe {
356 let f: Box_<F> = Box_::new(f);
357 connect_raw(
358 self.as_ptr() as *mut _,
359 c"notify::block".as_ptr(),
360 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
361 notify_block_trampoline::<F> as *const (),
362 )),
363 Box_::into_raw(f),
364 )
365 }
366 }
367
368 #[doc(alias = "caps")]
369 pub fn connect_caps_notify<F: Fn(&Self) + Send + Sync + 'static>(
370 &self,
371 f: F,
372 ) -> SignalHandlerId {
373 unsafe extern "C" fn notify_caps_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
374 this: *mut ffi::GstAppSrc,
375 _param_spec: glib::ffi::gpointer,
376 f: glib::ffi::gpointer,
377 ) {
378 unsafe {
379 let f: &F = &*(f as *const F);
380 f(&from_glib_borrow(this))
381 }
382 }
383 unsafe {
384 let f: Box_<F> = Box_::new(f);
385 connect_raw(
386 self.as_ptr() as *mut _,
387 c"notify::caps".as_ptr(),
388 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
389 notify_caps_trampoline::<F> as *const (),
390 )),
391 Box_::into_raw(f),
392 )
393 }
394 }
395
396 #[cfg(feature = "v1_20")]
397 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
398 #[doc(alias = "current-level-buffers")]
399 pub fn connect_current_level_buffers_notify<F: Fn(&Self) + Send + Sync + 'static>(
400 &self,
401 f: F,
402 ) -> SignalHandlerId {
403 unsafe extern "C" fn notify_current_level_buffers_trampoline<
404 F: Fn(&AppSrc) + Send + Sync + 'static,
405 >(
406 this: *mut ffi::GstAppSrc,
407 _param_spec: glib::ffi::gpointer,
408 f: glib::ffi::gpointer,
409 ) {
410 unsafe {
411 let f: &F = &*(f as *const F);
412 f(&from_glib_borrow(this))
413 }
414 }
415 unsafe {
416 let f: Box_<F> = Box_::new(f);
417 connect_raw(
418 self.as_ptr() as *mut _,
419 c"notify::current-level-buffers".as_ptr(),
420 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
421 notify_current_level_buffers_trampoline::<F> as *const (),
422 )),
423 Box_::into_raw(f),
424 )
425 }
426 }
427
428 #[doc(alias = "current-level-bytes")]
429 pub fn connect_current_level_bytes_notify<F: Fn(&Self) + Send + Sync + 'static>(
430 &self,
431 f: F,
432 ) -> SignalHandlerId {
433 unsafe extern "C" fn notify_current_level_bytes_trampoline<
434 F: Fn(&AppSrc) + Send + Sync + 'static,
435 >(
436 this: *mut ffi::GstAppSrc,
437 _param_spec: glib::ffi::gpointer,
438 f: glib::ffi::gpointer,
439 ) {
440 unsafe {
441 let f: &F = &*(f as *const F);
442 f(&from_glib_borrow(this))
443 }
444 }
445 unsafe {
446 let f: Box_<F> = Box_::new(f);
447 connect_raw(
448 self.as_ptr() as *mut _,
449 c"notify::current-level-bytes".as_ptr(),
450 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
451 notify_current_level_bytes_trampoline::<F> as *const (),
452 )),
453 Box_::into_raw(f),
454 )
455 }
456 }
457
458 #[cfg(feature = "v1_20")]
459 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
460 #[doc(alias = "current-level-time")]
461 pub fn connect_current_level_time_notify<F: Fn(&Self) + Send + Sync + 'static>(
462 &self,
463 f: F,
464 ) -> SignalHandlerId {
465 unsafe extern "C" fn notify_current_level_time_trampoline<
466 F: Fn(&AppSrc) + Send + Sync + 'static,
467 >(
468 this: *mut ffi::GstAppSrc,
469 _param_spec: glib::ffi::gpointer,
470 f: glib::ffi::gpointer,
471 ) {
472 unsafe {
473 let f: &F = &*(f as *const F);
474 f(&from_glib_borrow(this))
475 }
476 }
477 unsafe {
478 let f: Box_<F> = Box_::new(f);
479 connect_raw(
480 self.as_ptr() as *mut _,
481 c"notify::current-level-time".as_ptr(),
482 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
483 notify_current_level_time_trampoline::<F> as *const (),
484 )),
485 Box_::into_raw(f),
486 )
487 }
488 }
489
490 #[cfg(feature = "v1_28")]
491 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
492 #[doc(alias = "dropped")]
493 pub fn connect_dropped_notify<F: Fn(&Self) + Send + Sync + 'static>(
494 &self,
495 f: F,
496 ) -> SignalHandlerId {
497 unsafe extern "C" fn notify_dropped_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
498 this: *mut ffi::GstAppSrc,
499 _param_spec: glib::ffi::gpointer,
500 f: glib::ffi::gpointer,
501 ) {
502 unsafe {
503 let f: &F = &*(f as *const F);
504 f(&from_glib_borrow(this))
505 }
506 }
507 unsafe {
508 let f: Box_<F> = Box_::new(f);
509 connect_raw(
510 self.as_ptr() as *mut _,
511 c"notify::dropped".as_ptr(),
512 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
513 notify_dropped_trampoline::<F> as *const (),
514 )),
515 Box_::into_raw(f),
516 )
517 }
518 }
519
520 #[doc(alias = "duration")]
521 pub fn connect_duration_notify<F: Fn(&Self) + Send + Sync + 'static>(
522 &self,
523 f: F,
524 ) -> SignalHandlerId {
525 unsafe extern "C" fn notify_duration_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
526 this: *mut ffi::GstAppSrc,
527 _param_spec: glib::ffi::gpointer,
528 f: glib::ffi::gpointer,
529 ) {
530 unsafe {
531 let f: &F = &*(f as *const F);
532 f(&from_glib_borrow(this))
533 }
534 }
535 unsafe {
536 let f: Box_<F> = Box_::new(f);
537 connect_raw(
538 self.as_ptr() as *mut _,
539 c"notify::duration".as_ptr(),
540 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
541 notify_duration_trampoline::<F> as *const (),
542 )),
543 Box_::into_raw(f),
544 )
545 }
546 }
547
548 #[doc(alias = "format")]
549 pub fn connect_format_notify<F: Fn(&Self) + Send + Sync + 'static>(
550 &self,
551 f: F,
552 ) -> SignalHandlerId {
553 unsafe extern "C" fn notify_format_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
554 this: *mut ffi::GstAppSrc,
555 _param_spec: glib::ffi::gpointer,
556 f: glib::ffi::gpointer,
557 ) {
558 unsafe {
559 let f: &F = &*(f as *const F);
560 f(&from_glib_borrow(this))
561 }
562 }
563 unsafe {
564 let f: Box_<F> = Box_::new(f);
565 connect_raw(
566 self.as_ptr() as *mut _,
567 c"notify::format".as_ptr(),
568 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
569 notify_format_trampoline::<F> as *const (),
570 )),
571 Box_::into_raw(f),
572 )
573 }
574 }
575
576 #[cfg(feature = "v1_18")]
577 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
578 #[doc(alias = "handle-segment-change")]
579 pub fn connect_handle_segment_change_notify<F: Fn(&Self) + Send + Sync + 'static>(
580 &self,
581 f: F,
582 ) -> SignalHandlerId {
583 unsafe extern "C" fn notify_handle_segment_change_trampoline<
584 F: Fn(&AppSrc) + Send + Sync + 'static,
585 >(
586 this: *mut ffi::GstAppSrc,
587 _param_spec: glib::ffi::gpointer,
588 f: glib::ffi::gpointer,
589 ) {
590 unsafe {
591 let f: &F = &*(f as *const F);
592 f(&from_glib_borrow(this))
593 }
594 }
595 unsafe {
596 let f: Box_<F> = Box_::new(f);
597 connect_raw(
598 self.as_ptr() as *mut _,
599 c"notify::handle-segment-change".as_ptr(),
600 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
601 notify_handle_segment_change_trampoline::<F> as *const (),
602 )),
603 Box_::into_raw(f),
604 )
605 }
606 }
607
608 #[cfg(feature = "v1_28")]
609 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
610 #[doc(alias = "in")]
611 pub fn connect_in_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
612 unsafe extern "C" fn notify_in_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
613 this: *mut ffi::GstAppSrc,
614 _param_spec: glib::ffi::gpointer,
615 f: glib::ffi::gpointer,
616 ) {
617 unsafe {
618 let f: &F = &*(f as *const F);
619 f(&from_glib_borrow(this))
620 }
621 }
622 unsafe {
623 let f: Box_<F> = Box_::new(f);
624 connect_raw(
625 self.as_ptr() as *mut _,
626 c"notify::in".as_ptr(),
627 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
628 notify_in_trampoline::<F> as *const (),
629 )),
630 Box_::into_raw(f),
631 )
632 }
633 }
634
635 #[doc(alias = "is-live")]
636 pub fn connect_is_live_notify<F: Fn(&Self) + Send + Sync + 'static>(
637 &self,
638 f: F,
639 ) -> SignalHandlerId {
640 unsafe extern "C" fn notify_is_live_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
641 this: *mut ffi::GstAppSrc,
642 _param_spec: glib::ffi::gpointer,
643 f: glib::ffi::gpointer,
644 ) {
645 unsafe {
646 let f: &F = &*(f as *const F);
647 f(&from_glib_borrow(this))
648 }
649 }
650 unsafe {
651 let f: Box_<F> = Box_::new(f);
652 connect_raw(
653 self.as_ptr() as *mut _,
654 c"notify::is-live".as_ptr(),
655 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
656 notify_is_live_trampoline::<F> as *const (),
657 )),
658 Box_::into_raw(f),
659 )
660 }
661 }
662
663 #[cfg(feature = "v1_20")]
664 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
665 #[doc(alias = "leaky-type")]
666 pub fn connect_leaky_type_notify<F: Fn(&Self) + Send + Sync + 'static>(
667 &self,
668 f: F,
669 ) -> SignalHandlerId {
670 unsafe extern "C" fn notify_leaky_type_trampoline<
671 F: Fn(&AppSrc) + Send + Sync + 'static,
672 >(
673 this: *mut ffi::GstAppSrc,
674 _param_spec: glib::ffi::gpointer,
675 f: glib::ffi::gpointer,
676 ) {
677 unsafe {
678 let f: &F = &*(f as *const F);
679 f(&from_glib_borrow(this))
680 }
681 }
682 unsafe {
683 let f: Box_<F> = Box_::new(f);
684 connect_raw(
685 self.as_ptr() as *mut _,
686 c"notify::leaky-type".as_ptr(),
687 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
688 notify_leaky_type_trampoline::<F> as *const (),
689 )),
690 Box_::into_raw(f),
691 )
692 }
693 }
694
695 #[cfg(feature = "v1_20")]
696 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
697 #[doc(alias = "max-buffers")]
698 pub fn connect_max_buffers_notify<F: Fn(&Self) + Send + Sync + 'static>(
699 &self,
700 f: F,
701 ) -> SignalHandlerId {
702 unsafe extern "C" fn notify_max_buffers_trampoline<
703 F: Fn(&AppSrc) + Send + Sync + 'static,
704 >(
705 this: *mut ffi::GstAppSrc,
706 _param_spec: glib::ffi::gpointer,
707 f: glib::ffi::gpointer,
708 ) {
709 unsafe {
710 let f: &F = &*(f as *const F);
711 f(&from_glib_borrow(this))
712 }
713 }
714 unsafe {
715 let f: Box_<F> = Box_::new(f);
716 connect_raw(
717 self.as_ptr() as *mut _,
718 c"notify::max-buffers".as_ptr(),
719 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
720 notify_max_buffers_trampoline::<F> as *const (),
721 )),
722 Box_::into_raw(f),
723 )
724 }
725 }
726
727 #[doc(alias = "max-bytes")]
728 pub fn connect_max_bytes_notify<F: Fn(&Self) + Send + Sync + 'static>(
729 &self,
730 f: F,
731 ) -> SignalHandlerId {
732 unsafe extern "C" fn notify_max_bytes_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
733 this: *mut ffi::GstAppSrc,
734 _param_spec: glib::ffi::gpointer,
735 f: glib::ffi::gpointer,
736 ) {
737 unsafe {
738 let f: &F = &*(f as *const F);
739 f(&from_glib_borrow(this))
740 }
741 }
742 unsafe {
743 let f: Box_<F> = Box_::new(f);
744 connect_raw(
745 self.as_ptr() as *mut _,
746 c"notify::max-bytes".as_ptr(),
747 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
748 notify_max_bytes_trampoline::<F> as *const (),
749 )),
750 Box_::into_raw(f),
751 )
752 }
753 }
754
755 #[doc(alias = "max-latency")]
756 pub fn connect_max_latency_notify<F: Fn(&Self) + Send + Sync + 'static>(
757 &self,
758 f: F,
759 ) -> SignalHandlerId {
760 unsafe extern "C" fn notify_max_latency_trampoline<
761 F: Fn(&AppSrc) + Send + Sync + 'static,
762 >(
763 this: *mut ffi::GstAppSrc,
764 _param_spec: glib::ffi::gpointer,
765 f: glib::ffi::gpointer,
766 ) {
767 unsafe {
768 let f: &F = &*(f as *const F);
769 f(&from_glib_borrow(this))
770 }
771 }
772 unsafe {
773 let f: Box_<F> = Box_::new(f);
774 connect_raw(
775 self.as_ptr() as *mut _,
776 c"notify::max-latency".as_ptr(),
777 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
778 notify_max_latency_trampoline::<F> as *const (),
779 )),
780 Box_::into_raw(f),
781 )
782 }
783 }
784
785 #[cfg(feature = "v1_20")]
786 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
787 #[doc(alias = "max-time")]
788 pub fn connect_max_time_notify<F: Fn(&Self) + Send + Sync + 'static>(
789 &self,
790 f: F,
791 ) -> SignalHandlerId {
792 unsafe extern "C" fn notify_max_time_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
793 this: *mut ffi::GstAppSrc,
794 _param_spec: glib::ffi::gpointer,
795 f: glib::ffi::gpointer,
796 ) {
797 unsafe {
798 let f: &F = &*(f as *const F);
799 f(&from_glib_borrow(this))
800 }
801 }
802 unsafe {
803 let f: Box_<F> = Box_::new(f);
804 connect_raw(
805 self.as_ptr() as *mut _,
806 c"notify::max-time".as_ptr(),
807 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
808 notify_max_time_trampoline::<F> as *const (),
809 )),
810 Box_::into_raw(f),
811 )
812 }
813 }
814
815 #[doc(alias = "min-latency")]
816 pub fn connect_min_latency_notify<F: Fn(&Self) + Send + Sync + 'static>(
817 &self,
818 f: F,
819 ) -> SignalHandlerId {
820 unsafe extern "C" fn notify_min_latency_trampoline<
821 F: Fn(&AppSrc) + Send + Sync + 'static,
822 >(
823 this: *mut ffi::GstAppSrc,
824 _param_spec: glib::ffi::gpointer,
825 f: glib::ffi::gpointer,
826 ) {
827 unsafe {
828 let f: &F = &*(f as *const F);
829 f(&from_glib_borrow(this))
830 }
831 }
832 unsafe {
833 let f: Box_<F> = Box_::new(f);
834 connect_raw(
835 self.as_ptr() as *mut _,
836 c"notify::min-latency".as_ptr(),
837 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
838 notify_min_latency_trampoline::<F> as *const (),
839 )),
840 Box_::into_raw(f),
841 )
842 }
843 }
844
845 #[doc(alias = "min-percent")]
846 pub fn connect_min_percent_notify<F: Fn(&Self) + Send + Sync + 'static>(
847 &self,
848 f: F,
849 ) -> SignalHandlerId {
850 unsafe extern "C" fn notify_min_percent_trampoline<
851 F: Fn(&AppSrc) + Send + Sync + 'static,
852 >(
853 this: *mut ffi::GstAppSrc,
854 _param_spec: glib::ffi::gpointer,
855 f: glib::ffi::gpointer,
856 ) {
857 unsafe {
858 let f: &F = &*(f as *const F);
859 f(&from_glib_borrow(this))
860 }
861 }
862 unsafe {
863 let f: Box_<F> = Box_::new(f);
864 connect_raw(
865 self.as_ptr() as *mut _,
866 c"notify::min-percent".as_ptr(),
867 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
868 notify_min_percent_trampoline::<F> as *const (),
869 )),
870 Box_::into_raw(f),
871 )
872 }
873 }
874
875 #[cfg(feature = "v1_28")]
876 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
877 #[doc(alias = "out")]
878 pub fn connect_out_notify<F: Fn(&Self) + Send + Sync + 'static>(
879 &self,
880 f: F,
881 ) -> SignalHandlerId {
882 unsafe extern "C" fn notify_out_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
883 this: *mut ffi::GstAppSrc,
884 _param_spec: glib::ffi::gpointer,
885 f: glib::ffi::gpointer,
886 ) {
887 unsafe {
888 let f: &F = &*(f as *const F);
889 f(&from_glib_borrow(this))
890 }
891 }
892 unsafe {
893 let f: Box_<F> = Box_::new(f);
894 connect_raw(
895 self.as_ptr() as *mut _,
896 c"notify::out".as_ptr(),
897 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
898 notify_out_trampoline::<F> as *const (),
899 )),
900 Box_::into_raw(f),
901 )
902 }
903 }
904
905 #[cfg(feature = "v1_28")]
906 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
907 #[doc(alias = "silent")]
908 pub fn connect_silent_notify<F: Fn(&Self) + Send + Sync + 'static>(
909 &self,
910 f: F,
911 ) -> SignalHandlerId {
912 unsafe extern "C" fn notify_silent_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
913 this: *mut ffi::GstAppSrc,
914 _param_spec: glib::ffi::gpointer,
915 f: glib::ffi::gpointer,
916 ) {
917 unsafe {
918 let f: &F = &*(f as *const F);
919 f(&from_glib_borrow(this))
920 }
921 }
922 unsafe {
923 let f: Box_<F> = Box_::new(f);
924 connect_raw(
925 self.as_ptr() as *mut _,
926 c"notify::silent".as_ptr(),
927 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
928 notify_silent_trampoline::<F> as *const (),
929 )),
930 Box_::into_raw(f),
931 )
932 }
933 }
934
935 #[doc(alias = "size")]
936 pub fn connect_size_notify<F: Fn(&Self) + Send + Sync + 'static>(
937 &self,
938 f: F,
939 ) -> SignalHandlerId {
940 unsafe extern "C" fn notify_size_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
941 this: *mut ffi::GstAppSrc,
942 _param_spec: glib::ffi::gpointer,
943 f: glib::ffi::gpointer,
944 ) {
945 unsafe {
946 let f: &F = &*(f as *const F);
947 f(&from_glib_borrow(this))
948 }
949 }
950 unsafe {
951 let f: Box_<F> = Box_::new(f);
952 connect_raw(
953 self.as_ptr() as *mut _,
954 c"notify::size".as_ptr(),
955 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
956 notify_size_trampoline::<F> as *const (),
957 )),
958 Box_::into_raw(f),
959 )
960 }
961 }
962
963 #[doc(alias = "stream-type")]
964 pub fn connect_stream_type_notify<F: Fn(&Self) + Send + Sync + 'static>(
965 &self,
966 f: F,
967 ) -> SignalHandlerId {
968 unsafe extern "C" fn notify_stream_type_trampoline<
969 F: Fn(&AppSrc) + Send + Sync + 'static,
970 >(
971 this: *mut ffi::GstAppSrc,
972 _param_spec: glib::ffi::gpointer,
973 f: glib::ffi::gpointer,
974 ) {
975 unsafe {
976 let f: &F = &*(f as *const F);
977 f(&from_glib_borrow(this))
978 }
979 }
980 unsafe {
981 let f: Box_<F> = Box_::new(f);
982 connect_raw(
983 self.as_ptr() as *mut _,
984 c"notify::stream-type".as_ptr(),
985 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
986 notify_stream_type_trampoline::<F> as *const (),
987 )),
988 Box_::into_raw(f),
989 )
990 }
991 }
992}
993
994unsafe impl Send for AppSrc {}
995unsafe impl Sync for AppSrc {}