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