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")]
213 #[doc(alias = "size")]
214 pub fn set_size(&self, size: i64) {
215 unsafe {
216 ffi::gst_app_src_set_size(self.to_glib_none().0, size);
217 }
218 }
219
220 #[doc(alias = "gst_app_src_set_stream_type")]
221 #[doc(alias = "stream-type")]
222 pub fn set_stream_type(&self, type_: AppStreamType) {
223 unsafe {
224 ffi::gst_app_src_set_stream_type(self.to_glib_none().0, type_.into_glib());
225 }
226 }
227
228 pub fn is_block(&self) -> bool {
229 ObjectExt::property(self, "block")
230 }
231
232 pub fn set_block(&self, block: bool) {
233 ObjectExt::set_property(self, "block", block)
234 }
235
236 #[cfg(feature = "v1_28")]
237 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
238 pub fn dropped(&self) -> u64 {
239 ObjectExt::property(self, "dropped")
240 }
241
242 pub fn format(&self) -> gst::Format {
243 ObjectExt::property(self, "format")
244 }
245
246 pub fn set_format(&self, format: gst::Format) {
247 ObjectExt::set_property(self, "format", format)
248 }
249
250 #[cfg(feature = "v1_18")]
251 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
252 #[doc(alias = "handle-segment-change")]
253 pub fn is_handle_segment_change(&self) -> bool {
254 ObjectExt::property(self, "handle-segment-change")
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 set_handle_segment_change(&self, handle_segment_change: bool) {
261 ObjectExt::set_property(self, "handle-segment-change", handle_segment_change)
262 }
263
264 #[cfg(feature = "v1_28")]
265 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
266 #[doc(alias = "in")]
267 pub fn get_in(&self) -> u64 {
268 ObjectExt::property(self, "in")
269 }
270
271 #[doc(alias = "is-live")]
272 pub fn is_live(&self) -> bool {
273 ObjectExt::property(self, "is-live")
274 }
275
276 #[doc(alias = "is-live")]
277 pub fn set_is_live(&self, is_live: bool) {
278 ObjectExt::set_property(self, "is-live", is_live)
279 }
280
281 #[doc(alias = "max-latency")]
282 pub fn max_latency(&self) -> i64 {
283 ObjectExt::property(self, "max-latency")
284 }
285
286 #[doc(alias = "max-latency")]
287 pub fn set_max_latency(&self, max_latency: i64) {
288 ObjectExt::set_property(self, "max-latency", max_latency)
289 }
290
291 #[doc(alias = "min-latency")]
292 pub fn min_latency(&self) -> i64 {
293 ObjectExt::property(self, "min-latency")
294 }
295
296 #[doc(alias = "min-latency")]
297 pub fn set_min_latency(&self, min_latency: i64) {
298 ObjectExt::set_property(self, "min-latency", min_latency)
299 }
300
301 #[doc(alias = "min-percent")]
302 pub fn min_percent(&self) -> u32 {
303 ObjectExt::property(self, "min-percent")
304 }
305
306 #[doc(alias = "min-percent")]
307 pub fn set_min_percent(&self, min_percent: u32) {
308 ObjectExt::set_property(self, "min-percent", min_percent)
309 }
310
311 #[cfg(feature = "v1_28")]
312 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
313 pub fn out(&self) -> u64 {
314 ObjectExt::property(self, "out")
315 }
316
317 #[cfg(feature = "v1_28")]
318 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
319 pub fn is_silent(&self) -> bool {
320 ObjectExt::property(self, "silent")
321 }
322
323 #[cfg(feature = "v1_28")]
324 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
325 pub fn set_silent(&self, silent: bool) {
326 ObjectExt::set_property(self, "silent", silent)
327 }
328
329 #[doc(alias = "block")]
330 pub fn connect_block_notify<F: Fn(&Self) + Send + Sync + 'static>(
331 &self,
332 f: F,
333 ) -> SignalHandlerId {
334 unsafe extern "C" fn notify_block_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
335 this: *mut ffi::GstAppSrc,
336 _param_spec: glib::ffi::gpointer,
337 f: glib::ffi::gpointer,
338 ) {
339 let f: &F = &*(f as *const F);
340 f(&from_glib_borrow(this))
341 }
342 unsafe {
343 let f: Box_<F> = Box_::new(f);
344 connect_raw(
345 self.as_ptr() as *mut _,
346 c"notify::block".as_ptr() as *const _,
347 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
348 notify_block_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(&AppSrc) + Send + Sync + 'static>(
361 this: *mut ffi::GstAppSrc,
362 _param_spec: glib::ffi::gpointer,
363 f: glib::ffi::gpointer,
364 ) {
365 let f: &F = &*(f as *const F);
366 f(&from_glib_borrow(this))
367 }
368 unsafe {
369 let f: Box_<F> = Box_::new(f);
370 connect_raw(
371 self.as_ptr() as *mut _,
372 c"notify::caps".as_ptr() as *const _,
373 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
374 notify_caps_trampoline::<F> as *const (),
375 )),
376 Box_::into_raw(f),
377 )
378 }
379 }
380
381 #[cfg(feature = "v1_20")]
382 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
383 #[doc(alias = "current-level-buffers")]
384 pub fn connect_current_level_buffers_notify<F: Fn(&Self) + Send + Sync + 'static>(
385 &self,
386 f: F,
387 ) -> SignalHandlerId {
388 unsafe extern "C" fn notify_current_level_buffers_trampoline<
389 F: Fn(&AppSrc) + Send + Sync + 'static,
390 >(
391 this: *mut ffi::GstAppSrc,
392 _param_spec: glib::ffi::gpointer,
393 f: glib::ffi::gpointer,
394 ) {
395 let f: &F = &*(f as *const F);
396 f(&from_glib_borrow(this))
397 }
398 unsafe {
399 let f: Box_<F> = Box_::new(f);
400 connect_raw(
401 self.as_ptr() as *mut _,
402 c"notify::current-level-buffers".as_ptr() as *const _,
403 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
404 notify_current_level_buffers_trampoline::<F> as *const (),
405 )),
406 Box_::into_raw(f),
407 )
408 }
409 }
410
411 #[doc(alias = "current-level-bytes")]
412 pub fn connect_current_level_bytes_notify<F: Fn(&Self) + Send + Sync + 'static>(
413 &self,
414 f: F,
415 ) -> SignalHandlerId {
416 unsafe extern "C" fn notify_current_level_bytes_trampoline<
417 F: Fn(&AppSrc) + Send + Sync + 'static,
418 >(
419 this: *mut ffi::GstAppSrc,
420 _param_spec: glib::ffi::gpointer,
421 f: glib::ffi::gpointer,
422 ) {
423 let f: &F = &*(f as *const F);
424 f(&from_glib_borrow(this))
425 }
426 unsafe {
427 let f: Box_<F> = Box_::new(f);
428 connect_raw(
429 self.as_ptr() as *mut _,
430 c"notify::current-level-bytes".as_ptr() as *const _,
431 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
432 notify_current_level_bytes_trampoline::<F> as *const (),
433 )),
434 Box_::into_raw(f),
435 )
436 }
437 }
438
439 #[cfg(feature = "v1_20")]
440 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
441 #[doc(alias = "current-level-time")]
442 pub fn connect_current_level_time_notify<F: Fn(&Self) + Send + Sync + 'static>(
443 &self,
444 f: F,
445 ) -> SignalHandlerId {
446 unsafe extern "C" fn notify_current_level_time_trampoline<
447 F: Fn(&AppSrc) + Send + Sync + 'static,
448 >(
449 this: *mut ffi::GstAppSrc,
450 _param_spec: glib::ffi::gpointer,
451 f: glib::ffi::gpointer,
452 ) {
453 let f: &F = &*(f as *const F);
454 f(&from_glib_borrow(this))
455 }
456 unsafe {
457 let f: Box_<F> = Box_::new(f);
458 connect_raw(
459 self.as_ptr() as *mut _,
460 c"notify::current-level-time".as_ptr() as *const _,
461 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
462 notify_current_level_time_trampoline::<F> as *const (),
463 )),
464 Box_::into_raw(f),
465 )
466 }
467 }
468
469 #[cfg(feature = "v1_28")]
470 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
471 #[doc(alias = "dropped")]
472 pub fn connect_dropped_notify<F: Fn(&Self) + Send + Sync + 'static>(
473 &self,
474 f: F,
475 ) -> SignalHandlerId {
476 unsafe extern "C" fn notify_dropped_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
477 this: *mut ffi::GstAppSrc,
478 _param_spec: glib::ffi::gpointer,
479 f: glib::ffi::gpointer,
480 ) {
481 let f: &F = &*(f as *const F);
482 f(&from_glib_borrow(this))
483 }
484 unsafe {
485 let f: Box_<F> = Box_::new(f);
486 connect_raw(
487 self.as_ptr() as *mut _,
488 c"notify::dropped".as_ptr() as *const _,
489 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
490 notify_dropped_trampoline::<F> as *const (),
491 )),
492 Box_::into_raw(f),
493 )
494 }
495 }
496
497 #[doc(alias = "duration")]
498 pub fn connect_duration_notify<F: Fn(&Self) + Send + Sync + 'static>(
499 &self,
500 f: F,
501 ) -> SignalHandlerId {
502 unsafe extern "C" fn notify_duration_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
503 this: *mut ffi::GstAppSrc,
504 _param_spec: glib::ffi::gpointer,
505 f: glib::ffi::gpointer,
506 ) {
507 let f: &F = &*(f as *const F);
508 f(&from_glib_borrow(this))
509 }
510 unsafe {
511 let f: Box_<F> = Box_::new(f);
512 connect_raw(
513 self.as_ptr() as *mut _,
514 c"notify::duration".as_ptr() as *const _,
515 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
516 notify_duration_trampoline::<F> as *const (),
517 )),
518 Box_::into_raw(f),
519 )
520 }
521 }
522
523 #[doc(alias = "format")]
524 pub fn connect_format_notify<F: Fn(&Self) + Send + Sync + 'static>(
525 &self,
526 f: F,
527 ) -> SignalHandlerId {
528 unsafe extern "C" fn notify_format_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
529 this: *mut ffi::GstAppSrc,
530 _param_spec: glib::ffi::gpointer,
531 f: glib::ffi::gpointer,
532 ) {
533 let f: &F = &*(f as *const F);
534 f(&from_glib_borrow(this))
535 }
536 unsafe {
537 let f: Box_<F> = Box_::new(f);
538 connect_raw(
539 self.as_ptr() as *mut _,
540 c"notify::format".as_ptr() as *const _,
541 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
542 notify_format_trampoline::<F> as *const (),
543 )),
544 Box_::into_raw(f),
545 )
546 }
547 }
548
549 #[cfg(feature = "v1_18")]
550 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
551 #[doc(alias = "handle-segment-change")]
552 pub fn connect_handle_segment_change_notify<F: Fn(&Self) + Send + Sync + 'static>(
553 &self,
554 f: F,
555 ) -> SignalHandlerId {
556 unsafe extern "C" fn notify_handle_segment_change_trampoline<
557 F: Fn(&AppSrc) + Send + Sync + 'static,
558 >(
559 this: *mut ffi::GstAppSrc,
560 _param_spec: glib::ffi::gpointer,
561 f: glib::ffi::gpointer,
562 ) {
563 let f: &F = &*(f as *const F);
564 f(&from_glib_borrow(this))
565 }
566 unsafe {
567 let f: Box_<F> = Box_::new(f);
568 connect_raw(
569 self.as_ptr() as *mut _,
570 c"notify::handle-segment-change".as_ptr() as *const _,
571 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
572 notify_handle_segment_change_trampoline::<F> as *const (),
573 )),
574 Box_::into_raw(f),
575 )
576 }
577 }
578
579 #[cfg(feature = "v1_28")]
580 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
581 #[doc(alias = "in")]
582 pub fn connect_in_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
583 unsafe extern "C" fn notify_in_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
584 this: *mut ffi::GstAppSrc,
585 _param_spec: glib::ffi::gpointer,
586 f: glib::ffi::gpointer,
587 ) {
588 let f: &F = &*(f as *const F);
589 f(&from_glib_borrow(this))
590 }
591 unsafe {
592 let f: Box_<F> = Box_::new(f);
593 connect_raw(
594 self.as_ptr() as *mut _,
595 c"notify::in".as_ptr() as *const _,
596 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
597 notify_in_trampoline::<F> as *const (),
598 )),
599 Box_::into_raw(f),
600 )
601 }
602 }
603
604 #[doc(alias = "is-live")]
605 pub fn connect_is_live_notify<F: Fn(&Self) + Send + Sync + 'static>(
606 &self,
607 f: F,
608 ) -> SignalHandlerId {
609 unsafe extern "C" fn notify_is_live_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
610 this: *mut ffi::GstAppSrc,
611 _param_spec: glib::ffi::gpointer,
612 f: glib::ffi::gpointer,
613 ) {
614 let f: &F = &*(f as *const F);
615 f(&from_glib_borrow(this))
616 }
617 unsafe {
618 let f: Box_<F> = Box_::new(f);
619 connect_raw(
620 self.as_ptr() as *mut _,
621 c"notify::is-live".as_ptr() as *const _,
622 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
623 notify_is_live_trampoline::<F> as *const (),
624 )),
625 Box_::into_raw(f),
626 )
627 }
628 }
629
630 #[cfg(feature = "v1_20")]
631 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
632 #[doc(alias = "leaky-type")]
633 pub fn connect_leaky_type_notify<F: Fn(&Self) + Send + Sync + 'static>(
634 &self,
635 f: F,
636 ) -> SignalHandlerId {
637 unsafe extern "C" fn notify_leaky_type_trampoline<
638 F: Fn(&AppSrc) + Send + Sync + 'static,
639 >(
640 this: *mut ffi::GstAppSrc,
641 _param_spec: glib::ffi::gpointer,
642 f: glib::ffi::gpointer,
643 ) {
644 let f: &F = &*(f as *const F);
645 f(&from_glib_borrow(this))
646 }
647 unsafe {
648 let f: Box_<F> = Box_::new(f);
649 connect_raw(
650 self.as_ptr() as *mut _,
651 c"notify::leaky-type".as_ptr() as *const _,
652 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
653 notify_leaky_type_trampoline::<F> as *const (),
654 )),
655 Box_::into_raw(f),
656 )
657 }
658 }
659
660 #[cfg(feature = "v1_20")]
661 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
662 #[doc(alias = "max-buffers")]
663 pub fn connect_max_buffers_notify<F: Fn(&Self) + Send + Sync + 'static>(
664 &self,
665 f: F,
666 ) -> SignalHandlerId {
667 unsafe extern "C" fn notify_max_buffers_trampoline<
668 F: Fn(&AppSrc) + Send + Sync + 'static,
669 >(
670 this: *mut ffi::GstAppSrc,
671 _param_spec: glib::ffi::gpointer,
672 f: glib::ffi::gpointer,
673 ) {
674 let f: &F = &*(f as *const F);
675 f(&from_glib_borrow(this))
676 }
677 unsafe {
678 let f: Box_<F> = Box_::new(f);
679 connect_raw(
680 self.as_ptr() as *mut _,
681 c"notify::max-buffers".as_ptr() as *const _,
682 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
683 notify_max_buffers_trampoline::<F> as *const (),
684 )),
685 Box_::into_raw(f),
686 )
687 }
688 }
689
690 #[doc(alias = "max-bytes")]
691 pub fn connect_max_bytes_notify<F: Fn(&Self) + Send + Sync + 'static>(
692 &self,
693 f: F,
694 ) -> SignalHandlerId {
695 unsafe extern "C" fn notify_max_bytes_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
696 this: *mut ffi::GstAppSrc,
697 _param_spec: glib::ffi::gpointer,
698 f: glib::ffi::gpointer,
699 ) {
700 let f: &F = &*(f as *const F);
701 f(&from_glib_borrow(this))
702 }
703 unsafe {
704 let f: Box_<F> = Box_::new(f);
705 connect_raw(
706 self.as_ptr() as *mut _,
707 c"notify::max-bytes".as_ptr() as *const _,
708 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
709 notify_max_bytes_trampoline::<F> as *const (),
710 )),
711 Box_::into_raw(f),
712 )
713 }
714 }
715
716 #[doc(alias = "max-latency")]
717 pub fn connect_max_latency_notify<F: Fn(&Self) + Send + Sync + 'static>(
718 &self,
719 f: F,
720 ) -> SignalHandlerId {
721 unsafe extern "C" fn notify_max_latency_trampoline<
722 F: Fn(&AppSrc) + Send + Sync + 'static,
723 >(
724 this: *mut ffi::GstAppSrc,
725 _param_spec: glib::ffi::gpointer,
726 f: glib::ffi::gpointer,
727 ) {
728 let f: &F = &*(f as *const F);
729 f(&from_glib_borrow(this))
730 }
731 unsafe {
732 let f: Box_<F> = Box_::new(f);
733 connect_raw(
734 self.as_ptr() as *mut _,
735 c"notify::max-latency".as_ptr() as *const _,
736 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
737 notify_max_latency_trampoline::<F> as *const (),
738 )),
739 Box_::into_raw(f),
740 )
741 }
742 }
743
744 #[cfg(feature = "v1_20")]
745 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
746 #[doc(alias = "max-time")]
747 pub fn connect_max_time_notify<F: Fn(&Self) + Send + Sync + 'static>(
748 &self,
749 f: F,
750 ) -> SignalHandlerId {
751 unsafe extern "C" fn notify_max_time_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
752 this: *mut ffi::GstAppSrc,
753 _param_spec: glib::ffi::gpointer,
754 f: glib::ffi::gpointer,
755 ) {
756 let f: &F = &*(f as *const F);
757 f(&from_glib_borrow(this))
758 }
759 unsafe {
760 let f: Box_<F> = Box_::new(f);
761 connect_raw(
762 self.as_ptr() as *mut _,
763 c"notify::max-time".as_ptr() as *const _,
764 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
765 notify_max_time_trampoline::<F> as *const (),
766 )),
767 Box_::into_raw(f),
768 )
769 }
770 }
771
772 #[doc(alias = "min-latency")]
773 pub fn connect_min_latency_notify<F: Fn(&Self) + Send + Sync + 'static>(
774 &self,
775 f: F,
776 ) -> SignalHandlerId {
777 unsafe extern "C" fn notify_min_latency_trampoline<
778 F: Fn(&AppSrc) + Send + Sync + 'static,
779 >(
780 this: *mut ffi::GstAppSrc,
781 _param_spec: glib::ffi::gpointer,
782 f: glib::ffi::gpointer,
783 ) {
784 let f: &F = &*(f as *const F);
785 f(&from_glib_borrow(this))
786 }
787 unsafe {
788 let f: Box_<F> = Box_::new(f);
789 connect_raw(
790 self.as_ptr() as *mut _,
791 c"notify::min-latency".as_ptr() as *const _,
792 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
793 notify_min_latency_trampoline::<F> as *const (),
794 )),
795 Box_::into_raw(f),
796 )
797 }
798 }
799
800 #[doc(alias = "min-percent")]
801 pub fn connect_min_percent_notify<F: Fn(&Self) + Send + Sync + 'static>(
802 &self,
803 f: F,
804 ) -> SignalHandlerId {
805 unsafe extern "C" fn notify_min_percent_trampoline<
806 F: Fn(&AppSrc) + Send + Sync + 'static,
807 >(
808 this: *mut ffi::GstAppSrc,
809 _param_spec: glib::ffi::gpointer,
810 f: glib::ffi::gpointer,
811 ) {
812 let f: &F = &*(f as *const F);
813 f(&from_glib_borrow(this))
814 }
815 unsafe {
816 let f: Box_<F> = Box_::new(f);
817 connect_raw(
818 self.as_ptr() as *mut _,
819 c"notify::min-percent".as_ptr() as *const _,
820 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
821 notify_min_percent_trampoline::<F> as *const (),
822 )),
823 Box_::into_raw(f),
824 )
825 }
826 }
827
828 #[cfg(feature = "v1_28")]
829 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
830 #[doc(alias = "out")]
831 pub fn connect_out_notify<F: Fn(&Self) + Send + Sync + 'static>(
832 &self,
833 f: F,
834 ) -> SignalHandlerId {
835 unsafe extern "C" fn notify_out_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
836 this: *mut ffi::GstAppSrc,
837 _param_spec: glib::ffi::gpointer,
838 f: glib::ffi::gpointer,
839 ) {
840 let f: &F = &*(f as *const F);
841 f(&from_glib_borrow(this))
842 }
843 unsafe {
844 let f: Box_<F> = Box_::new(f);
845 connect_raw(
846 self.as_ptr() as *mut _,
847 c"notify::out".as_ptr() as *const _,
848 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
849 notify_out_trampoline::<F> as *const (),
850 )),
851 Box_::into_raw(f),
852 )
853 }
854 }
855
856 #[cfg(feature = "v1_28")]
857 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
858 #[doc(alias = "silent")]
859 pub fn connect_silent_notify<F: Fn(&Self) + Send + Sync + 'static>(
860 &self,
861 f: F,
862 ) -> SignalHandlerId {
863 unsafe extern "C" fn notify_silent_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
864 this: *mut ffi::GstAppSrc,
865 _param_spec: glib::ffi::gpointer,
866 f: glib::ffi::gpointer,
867 ) {
868 let f: &F = &*(f as *const F);
869 f(&from_glib_borrow(this))
870 }
871 unsafe {
872 let f: Box_<F> = Box_::new(f);
873 connect_raw(
874 self.as_ptr() as *mut _,
875 c"notify::silent".as_ptr() as *const _,
876 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
877 notify_silent_trampoline::<F> as *const (),
878 )),
879 Box_::into_raw(f),
880 )
881 }
882 }
883
884 #[doc(alias = "size")]
885 pub fn connect_size_notify<F: Fn(&Self) + Send + Sync + 'static>(
886 &self,
887 f: F,
888 ) -> SignalHandlerId {
889 unsafe extern "C" fn notify_size_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
890 this: *mut ffi::GstAppSrc,
891 _param_spec: glib::ffi::gpointer,
892 f: glib::ffi::gpointer,
893 ) {
894 let f: &F = &*(f as *const F);
895 f(&from_glib_borrow(this))
896 }
897 unsafe {
898 let f: Box_<F> = Box_::new(f);
899 connect_raw(
900 self.as_ptr() as *mut _,
901 c"notify::size".as_ptr() as *const _,
902 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
903 notify_size_trampoline::<F> as *const (),
904 )),
905 Box_::into_raw(f),
906 )
907 }
908 }
909
910 #[doc(alias = "stream-type")]
911 pub fn connect_stream_type_notify<F: Fn(&Self) + Send + Sync + 'static>(
912 &self,
913 f: F,
914 ) -> SignalHandlerId {
915 unsafe extern "C" fn notify_stream_type_trampoline<
916 F: Fn(&AppSrc) + Send + Sync + 'static,
917 >(
918 this: *mut ffi::GstAppSrc,
919 _param_spec: glib::ffi::gpointer,
920 f: glib::ffi::gpointer,
921 ) {
922 let f: &F = &*(f as *const F);
923 f(&from_glib_borrow(this))
924 }
925 unsafe {
926 let f: Box_<F> = Box_::new(f);
927 connect_raw(
928 self.as_ptr() as *mut _,
929 c"notify::stream-type".as_ptr() as *const _,
930 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
931 notify_stream_type_trampoline::<F> as *const (),
932 )),
933 Box_::into_raw(f),
934 )
935 }
936 }
937}
938
939unsafe impl Send for AppSrc {}
940unsafe impl Sync for AppSrc {}