1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
4// DO NOT EDIT
5
6#[cfg(feature = "v1_20")]
7#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
8use crate::AppLeakyType;
9use crate::AppStreamType;
10use glib::{
11 prelude::*,
12 signal::{connect_raw, SignalHandlerId},
13 translate::*,
14};
15use std::{boxed::Box as Box_, mem::transmute};
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 pub fn current_level_buffers(&self) -> u64 {
43 unsafe { ffi::gst_app_src_get_current_level_buffers(self.to_glib_none().0) }
44 }
45
46 #[doc(alias = "gst_app_src_get_current_level_bytes")]
47 #[doc(alias = "get_current_level_bytes")]
48 pub fn current_level_bytes(&self) -> u64 {
49 unsafe { ffi::gst_app_src_get_current_level_bytes(self.to_glib_none().0) }
50 }
51
52 #[cfg(feature = "v1_20")]
53 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
54 #[doc(alias = "gst_app_src_get_current_level_time")]
55 #[doc(alias = "get_current_level_time")]
56 pub fn current_level_time(&self) -> Option<gst::ClockTime> {
57 unsafe {
58 from_glib(ffi::gst_app_src_get_current_level_time(
59 self.to_glib_none().0,
60 ))
61 }
62 }
63
64 #[doc(alias = "gst_app_src_get_duration")]
65 #[doc(alias = "get_duration")]
66 pub fn duration(&self) -> Option<gst::ClockTime> {
67 unsafe { from_glib(ffi::gst_app_src_get_duration(self.to_glib_none().0)) }
68 }
69
70 #[cfg(feature = "v1_20")]
71 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
72 #[doc(alias = "gst_app_src_get_leaky_type")]
73 #[doc(alias = "get_leaky_type")]
74 pub fn leaky_type(&self) -> AppLeakyType {
75 unsafe { from_glib(ffi::gst_app_src_get_leaky_type(self.to_glib_none().0)) }
76 }
77
78 #[cfg(feature = "v1_20")]
79 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
80 #[doc(alias = "gst_app_src_get_max_buffers")]
81 #[doc(alias = "get_max_buffers")]
82 pub fn max_buffers(&self) -> u64 {
83 unsafe { ffi::gst_app_src_get_max_buffers(self.to_glib_none().0) }
84 }
85
86 #[doc(alias = "gst_app_src_get_max_bytes")]
87 #[doc(alias = "get_max_bytes")]
88 pub fn max_bytes(&self) -> u64 {
89 unsafe { ffi::gst_app_src_get_max_bytes(self.to_glib_none().0) }
90 }
91
92 #[cfg(feature = "v1_20")]
93 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
94 #[doc(alias = "gst_app_src_get_max_time")]
95 #[doc(alias = "get_max_time")]
96 pub fn max_time(&self) -> Option<gst::ClockTime> {
97 unsafe { from_glib(ffi::gst_app_src_get_max_time(self.to_glib_none().0)) }
98 }
99
100 #[doc(alias = "gst_app_src_get_size")]
101 #[doc(alias = "get_size")]
102 pub fn size(&self) -> i64 {
103 unsafe { ffi::gst_app_src_get_size(self.to_glib_none().0) }
104 }
105
106 #[doc(alias = "gst_app_src_get_stream_type")]
107 #[doc(alias = "get_stream_type")]
108 pub fn stream_type(&self) -> AppStreamType {
109 unsafe { from_glib(ffi::gst_app_src_get_stream_type(self.to_glib_none().0)) }
110 }
111
112 #[doc(alias = "gst_app_src_push_buffer")]
113 pub fn push_buffer(&self, buffer: gst::Buffer) -> Result<gst::FlowSuccess, gst::FlowError> {
114 unsafe {
115 try_from_glib(ffi::gst_app_src_push_buffer(
116 self.to_glib_none().0,
117 buffer.into_glib_ptr(),
118 ))
119 }
120 }
121
122 #[doc(alias = "gst_app_src_push_buffer_list")]
123 pub fn push_buffer_list(
124 &self,
125 buffer_list: gst::BufferList,
126 ) -> Result<gst::FlowSuccess, gst::FlowError> {
127 unsafe {
128 try_from_glib(ffi::gst_app_src_push_buffer_list(
129 self.to_glib_none().0,
130 buffer_list.into_glib_ptr(),
131 ))
132 }
133 }
134
135 #[doc(alias = "gst_app_src_push_sample")]
136 pub fn push_sample(&self, sample: &gst::Sample) -> Result<gst::FlowSuccess, gst::FlowError> {
137 unsafe {
138 try_from_glib(ffi::gst_app_src_push_sample(
139 self.to_glib_none().0,
140 sample.to_glib_none().0,
141 ))
142 }
143 }
144
145 //#[doc(alias = "gst_app_src_set_callbacks")]
146 //pub fn set_callbacks(&self, callbacks: /*Ignored*/&mut AppSrcCallbacks, user_data: /*Unimplemented*/Option<Basic: Pointer>) {
147 // unsafe { TODO: call ffi:gst_app_src_set_callbacks() }
148 //}
149
150 #[doc(alias = "gst_app_src_set_caps")]
151 pub fn set_caps(&self, caps: Option<&gst::Caps>) {
152 unsafe {
153 ffi::gst_app_src_set_caps(self.to_glib_none().0, caps.to_glib_none().0);
154 }
155 }
156
157 #[doc(alias = "gst_app_src_set_duration")]
158 pub fn set_duration(&self, duration: impl Into<Option<gst::ClockTime>>) {
159 unsafe {
160 ffi::gst_app_src_set_duration(self.to_glib_none().0, duration.into().into_glib());
161 }
162 }
163
164 #[cfg(feature = "v1_20")]
165 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
166 #[doc(alias = "gst_app_src_set_leaky_type")]
167 pub fn set_leaky_type(&self, leaky: AppLeakyType) {
168 unsafe {
169 ffi::gst_app_src_set_leaky_type(self.to_glib_none().0, leaky.into_glib());
170 }
171 }
172
173 #[cfg(feature = "v1_20")]
174 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
175 #[doc(alias = "gst_app_src_set_max_buffers")]
176 pub fn set_max_buffers(&self, max: u64) {
177 unsafe {
178 ffi::gst_app_src_set_max_buffers(self.to_glib_none().0, max);
179 }
180 }
181
182 #[doc(alias = "gst_app_src_set_max_bytes")]
183 pub fn set_max_bytes(&self, max: u64) {
184 unsafe {
185 ffi::gst_app_src_set_max_bytes(self.to_glib_none().0, max);
186 }
187 }
188
189 #[cfg(feature = "v1_20")]
190 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
191 #[doc(alias = "gst_app_src_set_max_time")]
192 pub fn set_max_time(&self, max: impl Into<Option<gst::ClockTime>>) {
193 unsafe {
194 ffi::gst_app_src_set_max_time(self.to_glib_none().0, max.into().into_glib());
195 }
196 }
197
198 #[doc(alias = "gst_app_src_set_size")]
199 pub fn set_size(&self, size: i64) {
200 unsafe {
201 ffi::gst_app_src_set_size(self.to_glib_none().0, size);
202 }
203 }
204
205 #[doc(alias = "gst_app_src_set_stream_type")]
206 pub fn set_stream_type(&self, type_: AppStreamType) {
207 unsafe {
208 ffi::gst_app_src_set_stream_type(self.to_glib_none().0, type_.into_glib());
209 }
210 }
211
212 pub fn is_block(&self) -> bool {
213 ObjectExt::property(self, "block")
214 }
215
216 pub fn set_block(&self, block: bool) {
217 ObjectExt::set_property(self, "block", block)
218 }
219
220 pub fn format(&self) -> gst::Format {
221 ObjectExt::property(self, "format")
222 }
223
224 pub fn set_format(&self, format: gst::Format) {
225 ObjectExt::set_property(self, "format", format)
226 }
227
228 #[cfg(feature = "v1_18")]
229 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
230 #[doc(alias = "handle-segment-change")]
231 pub fn is_handle_segment_change(&self) -> bool {
232 ObjectExt::property(self, "handle-segment-change")
233 }
234
235 #[cfg(feature = "v1_18")]
236 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
237 #[doc(alias = "handle-segment-change")]
238 pub fn set_handle_segment_change(&self, handle_segment_change: bool) {
239 ObjectExt::set_property(self, "handle-segment-change", handle_segment_change)
240 }
241
242 #[doc(alias = "is-live")]
243 pub fn is_live(&self) -> bool {
244 ObjectExt::property(self, "is-live")
245 }
246
247 #[doc(alias = "is-live")]
248 pub fn set_is_live(&self, is_live: bool) {
249 ObjectExt::set_property(self, "is-live", is_live)
250 }
251
252 #[doc(alias = "max-latency")]
253 pub fn max_latency(&self) -> i64 {
254 ObjectExt::property(self, "max-latency")
255 }
256
257 #[doc(alias = "max-latency")]
258 pub fn set_max_latency(&self, max_latency: i64) {
259 ObjectExt::set_property(self, "max-latency", max_latency)
260 }
261
262 #[doc(alias = "min-latency")]
263 pub fn min_latency(&self) -> i64 {
264 ObjectExt::property(self, "min-latency")
265 }
266
267 #[doc(alias = "min-latency")]
268 pub fn set_min_latency(&self, min_latency: i64) {
269 ObjectExt::set_property(self, "min-latency", min_latency)
270 }
271
272 #[doc(alias = "min-percent")]
273 pub fn min_percent(&self) -> u32 {
274 ObjectExt::property(self, "min-percent")
275 }
276
277 #[doc(alias = "min-percent")]
278 pub fn set_min_percent(&self, min_percent: u32) {
279 ObjectExt::set_property(self, "min-percent", min_percent)
280 }
281
282 #[doc(alias = "block")]
283 pub fn connect_block_notify<F: Fn(&Self) + Send + Sync + 'static>(
284 &self,
285 f: F,
286 ) -> SignalHandlerId {
287 unsafe extern "C" fn notify_block_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
288 this: *mut ffi::GstAppSrc,
289 _param_spec: glib::ffi::gpointer,
290 f: glib::ffi::gpointer,
291 ) {
292 let f: &F = &*(f as *const F);
293 f(&from_glib_borrow(this))
294 }
295 unsafe {
296 let f: Box_<F> = Box_::new(f);
297 connect_raw(
298 self.as_ptr() as *mut _,
299 b"notify::block\0".as_ptr() as *const _,
300 Some(transmute::<_, unsafe extern "C" fn()>(
301 notify_block_trampoline::<F> as *const (),
302 )),
303 Box_::into_raw(f),
304 )
305 }
306 }
307
308 #[doc(alias = "caps")]
309 pub fn connect_caps_notify<F: Fn(&Self) + Send + Sync + 'static>(
310 &self,
311 f: F,
312 ) -> SignalHandlerId {
313 unsafe extern "C" fn notify_caps_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
314 this: *mut ffi::GstAppSrc,
315 _param_spec: glib::ffi::gpointer,
316 f: glib::ffi::gpointer,
317 ) {
318 let f: &F = &*(f as *const F);
319 f(&from_glib_borrow(this))
320 }
321 unsafe {
322 let f: Box_<F> = Box_::new(f);
323 connect_raw(
324 self.as_ptr() as *mut _,
325 b"notify::caps\0".as_ptr() as *const _,
326 Some(transmute::<_, unsafe extern "C" fn()>(
327 notify_caps_trampoline::<F> as *const (),
328 )),
329 Box_::into_raw(f),
330 )
331 }
332 }
333
334 #[cfg(feature = "v1_20")]
335 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
336 #[doc(alias = "current-level-buffers")]
337 pub fn connect_current_level_buffers_notify<F: Fn(&Self) + Send + Sync + 'static>(
338 &self,
339 f: F,
340 ) -> SignalHandlerId {
341 unsafe extern "C" fn notify_current_level_buffers_trampoline<
342 F: Fn(&AppSrc) + Send + Sync + 'static,
343 >(
344 this: *mut ffi::GstAppSrc,
345 _param_spec: glib::ffi::gpointer,
346 f: glib::ffi::gpointer,
347 ) {
348 let f: &F = &*(f as *const F);
349 f(&from_glib_borrow(this))
350 }
351 unsafe {
352 let f: Box_<F> = Box_::new(f);
353 connect_raw(
354 self.as_ptr() as *mut _,
355 b"notify::current-level-buffers\0".as_ptr() as *const _,
356 Some(transmute::<_, unsafe extern "C" fn()>(
357 notify_current_level_buffers_trampoline::<F> as *const (),
358 )),
359 Box_::into_raw(f),
360 )
361 }
362 }
363
364 #[doc(alias = "current-level-bytes")]
365 pub fn connect_current_level_bytes_notify<F: Fn(&Self) + Send + Sync + 'static>(
366 &self,
367 f: F,
368 ) -> SignalHandlerId {
369 unsafe extern "C" fn notify_current_level_bytes_trampoline<
370 F: Fn(&AppSrc) + Send + Sync + 'static,
371 >(
372 this: *mut ffi::GstAppSrc,
373 _param_spec: glib::ffi::gpointer,
374 f: glib::ffi::gpointer,
375 ) {
376 let f: &F = &*(f as *const F);
377 f(&from_glib_borrow(this))
378 }
379 unsafe {
380 let f: Box_<F> = Box_::new(f);
381 connect_raw(
382 self.as_ptr() as *mut _,
383 b"notify::current-level-bytes\0".as_ptr() as *const _,
384 Some(transmute::<_, unsafe extern "C" fn()>(
385 notify_current_level_bytes_trampoline::<F> as *const (),
386 )),
387 Box_::into_raw(f),
388 )
389 }
390 }
391
392 #[cfg(feature = "v1_20")]
393 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
394 #[doc(alias = "current-level-time")]
395 pub fn connect_current_level_time_notify<F: Fn(&Self) + Send + Sync + 'static>(
396 &self,
397 f: F,
398 ) -> SignalHandlerId {
399 unsafe extern "C" fn notify_current_level_time_trampoline<
400 F: Fn(&AppSrc) + Send + Sync + 'static,
401 >(
402 this: *mut ffi::GstAppSrc,
403 _param_spec: glib::ffi::gpointer,
404 f: glib::ffi::gpointer,
405 ) {
406 let f: &F = &*(f as *const F);
407 f(&from_glib_borrow(this))
408 }
409 unsafe {
410 let f: Box_<F> = Box_::new(f);
411 connect_raw(
412 self.as_ptr() as *mut _,
413 b"notify::current-level-time\0".as_ptr() as *const _,
414 Some(transmute::<_, unsafe extern "C" fn()>(
415 notify_current_level_time_trampoline::<F> as *const (),
416 )),
417 Box_::into_raw(f),
418 )
419 }
420 }
421
422 #[doc(alias = "duration")]
423 pub fn connect_duration_notify<F: Fn(&Self) + Send + Sync + 'static>(
424 &self,
425 f: F,
426 ) -> SignalHandlerId {
427 unsafe extern "C" fn notify_duration_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
428 this: *mut ffi::GstAppSrc,
429 _param_spec: glib::ffi::gpointer,
430 f: glib::ffi::gpointer,
431 ) {
432 let f: &F = &*(f as *const F);
433 f(&from_glib_borrow(this))
434 }
435 unsafe {
436 let f: Box_<F> = Box_::new(f);
437 connect_raw(
438 self.as_ptr() as *mut _,
439 b"notify::duration\0".as_ptr() as *const _,
440 Some(transmute::<_, unsafe extern "C" fn()>(
441 notify_duration_trampoline::<F> as *const (),
442 )),
443 Box_::into_raw(f),
444 )
445 }
446 }
447
448 #[doc(alias = "format")]
449 pub fn connect_format_notify<F: Fn(&Self) + Send + Sync + 'static>(
450 &self,
451 f: F,
452 ) -> SignalHandlerId {
453 unsafe extern "C" fn notify_format_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
454 this: *mut ffi::GstAppSrc,
455 _param_spec: glib::ffi::gpointer,
456 f: glib::ffi::gpointer,
457 ) {
458 let f: &F = &*(f as *const F);
459 f(&from_glib_borrow(this))
460 }
461 unsafe {
462 let f: Box_<F> = Box_::new(f);
463 connect_raw(
464 self.as_ptr() as *mut _,
465 b"notify::format\0".as_ptr() as *const _,
466 Some(transmute::<_, unsafe extern "C" fn()>(
467 notify_format_trampoline::<F> as *const (),
468 )),
469 Box_::into_raw(f),
470 )
471 }
472 }
473
474 #[cfg(feature = "v1_18")]
475 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
476 #[doc(alias = "handle-segment-change")]
477 pub fn connect_handle_segment_change_notify<F: Fn(&Self) + Send + Sync + 'static>(
478 &self,
479 f: F,
480 ) -> SignalHandlerId {
481 unsafe extern "C" fn notify_handle_segment_change_trampoline<
482 F: Fn(&AppSrc) + Send + Sync + 'static,
483 >(
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 b"notify::handle-segment-change\0".as_ptr() as *const _,
496 Some(transmute::<_, unsafe extern "C" fn()>(
497 notify_handle_segment_change_trampoline::<F> as *const (),
498 )),
499 Box_::into_raw(f),
500 )
501 }
502 }
503
504 #[doc(alias = "is-live")]
505 pub fn connect_is_live_notify<F: Fn(&Self) + Send + Sync + 'static>(
506 &self,
507 f: F,
508 ) -> SignalHandlerId {
509 unsafe extern "C" fn notify_is_live_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 b"notify::is-live\0".as_ptr() as *const _,
522 Some(transmute::<_, unsafe extern "C" fn()>(
523 notify_is_live_trampoline::<F> as *const (),
524 )),
525 Box_::into_raw(f),
526 )
527 }
528 }
529
530 #[cfg(feature = "v1_20")]
531 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
532 #[doc(alias = "leaky-type")]
533 pub fn connect_leaky_type_notify<F: Fn(&Self) + Send + Sync + 'static>(
534 &self,
535 f: F,
536 ) -> SignalHandlerId {
537 unsafe extern "C" fn notify_leaky_type_trampoline<
538 F: Fn(&AppSrc) + Send + Sync + 'static,
539 >(
540 this: *mut ffi::GstAppSrc,
541 _param_spec: glib::ffi::gpointer,
542 f: glib::ffi::gpointer,
543 ) {
544 let f: &F = &*(f as *const F);
545 f(&from_glib_borrow(this))
546 }
547 unsafe {
548 let f: Box_<F> = Box_::new(f);
549 connect_raw(
550 self.as_ptr() as *mut _,
551 b"notify::leaky-type\0".as_ptr() as *const _,
552 Some(transmute::<_, unsafe extern "C" fn()>(
553 notify_leaky_type_trampoline::<F> as *const (),
554 )),
555 Box_::into_raw(f),
556 )
557 }
558 }
559
560 #[cfg(feature = "v1_20")]
561 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
562 #[doc(alias = "max-buffers")]
563 pub fn connect_max_buffers_notify<F: Fn(&Self) + Send + Sync + 'static>(
564 &self,
565 f: F,
566 ) -> SignalHandlerId {
567 unsafe extern "C" fn notify_max_buffers_trampoline<
568 F: Fn(&AppSrc) + Send + Sync + 'static,
569 >(
570 this: *mut ffi::GstAppSrc,
571 _param_spec: glib::ffi::gpointer,
572 f: glib::ffi::gpointer,
573 ) {
574 let f: &F = &*(f as *const F);
575 f(&from_glib_borrow(this))
576 }
577 unsafe {
578 let f: Box_<F> = Box_::new(f);
579 connect_raw(
580 self.as_ptr() as *mut _,
581 b"notify::max-buffers\0".as_ptr() as *const _,
582 Some(transmute::<_, unsafe extern "C" fn()>(
583 notify_max_buffers_trampoline::<F> as *const (),
584 )),
585 Box_::into_raw(f),
586 )
587 }
588 }
589
590 #[doc(alias = "max-bytes")]
591 pub fn connect_max_bytes_notify<F: Fn(&Self) + Send + Sync + 'static>(
592 &self,
593 f: F,
594 ) -> SignalHandlerId {
595 unsafe extern "C" fn notify_max_bytes_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
596 this: *mut ffi::GstAppSrc,
597 _param_spec: glib::ffi::gpointer,
598 f: glib::ffi::gpointer,
599 ) {
600 let f: &F = &*(f as *const F);
601 f(&from_glib_borrow(this))
602 }
603 unsafe {
604 let f: Box_<F> = Box_::new(f);
605 connect_raw(
606 self.as_ptr() as *mut _,
607 b"notify::max-bytes\0".as_ptr() as *const _,
608 Some(transmute::<_, unsafe extern "C" fn()>(
609 notify_max_bytes_trampoline::<F> as *const (),
610 )),
611 Box_::into_raw(f),
612 )
613 }
614 }
615
616 #[doc(alias = "max-latency")]
617 pub fn connect_max_latency_notify<F: Fn(&Self) + Send + Sync + 'static>(
618 &self,
619 f: F,
620 ) -> SignalHandlerId {
621 unsafe extern "C" fn notify_max_latency_trampoline<
622 F: Fn(&AppSrc) + Send + Sync + 'static,
623 >(
624 this: *mut ffi::GstAppSrc,
625 _param_spec: glib::ffi::gpointer,
626 f: glib::ffi::gpointer,
627 ) {
628 let f: &F = &*(f as *const F);
629 f(&from_glib_borrow(this))
630 }
631 unsafe {
632 let f: Box_<F> = Box_::new(f);
633 connect_raw(
634 self.as_ptr() as *mut _,
635 b"notify::max-latency\0".as_ptr() as *const _,
636 Some(transmute::<_, unsafe extern "C" fn()>(
637 notify_max_latency_trampoline::<F> as *const (),
638 )),
639 Box_::into_raw(f),
640 )
641 }
642 }
643
644 #[cfg(feature = "v1_20")]
645 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
646 #[doc(alias = "max-time")]
647 pub fn connect_max_time_notify<F: Fn(&Self) + Send + Sync + 'static>(
648 &self,
649 f: F,
650 ) -> SignalHandlerId {
651 unsafe extern "C" fn notify_max_time_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
652 this: *mut ffi::GstAppSrc,
653 _param_spec: glib::ffi::gpointer,
654 f: glib::ffi::gpointer,
655 ) {
656 let f: &F = &*(f as *const F);
657 f(&from_glib_borrow(this))
658 }
659 unsafe {
660 let f: Box_<F> = Box_::new(f);
661 connect_raw(
662 self.as_ptr() as *mut _,
663 b"notify::max-time\0".as_ptr() as *const _,
664 Some(transmute::<_, unsafe extern "C" fn()>(
665 notify_max_time_trampoline::<F> as *const (),
666 )),
667 Box_::into_raw(f),
668 )
669 }
670 }
671
672 #[doc(alias = "min-latency")]
673 pub fn connect_min_latency_notify<F: Fn(&Self) + Send + Sync + 'static>(
674 &self,
675 f: F,
676 ) -> SignalHandlerId {
677 unsafe extern "C" fn notify_min_latency_trampoline<
678 F: Fn(&AppSrc) + Send + Sync + 'static,
679 >(
680 this: *mut ffi::GstAppSrc,
681 _param_spec: glib::ffi::gpointer,
682 f: glib::ffi::gpointer,
683 ) {
684 let f: &F = &*(f as *const F);
685 f(&from_glib_borrow(this))
686 }
687 unsafe {
688 let f: Box_<F> = Box_::new(f);
689 connect_raw(
690 self.as_ptr() as *mut _,
691 b"notify::min-latency\0".as_ptr() as *const _,
692 Some(transmute::<_, unsafe extern "C" fn()>(
693 notify_min_latency_trampoline::<F> as *const (),
694 )),
695 Box_::into_raw(f),
696 )
697 }
698 }
699
700 #[doc(alias = "min-percent")]
701 pub fn connect_min_percent_notify<F: Fn(&Self) + Send + Sync + 'static>(
702 &self,
703 f: F,
704 ) -> SignalHandlerId {
705 unsafe extern "C" fn notify_min_percent_trampoline<
706 F: Fn(&AppSrc) + Send + Sync + 'static,
707 >(
708 this: *mut ffi::GstAppSrc,
709 _param_spec: glib::ffi::gpointer,
710 f: glib::ffi::gpointer,
711 ) {
712 let f: &F = &*(f as *const F);
713 f(&from_glib_borrow(this))
714 }
715 unsafe {
716 let f: Box_<F> = Box_::new(f);
717 connect_raw(
718 self.as_ptr() as *mut _,
719 b"notify::min-percent\0".as_ptr() as *const _,
720 Some(transmute::<_, unsafe extern "C" fn()>(
721 notify_min_percent_trampoline::<F> as *const (),
722 )),
723 Box_::into_raw(f),
724 )
725 }
726 }
727
728 #[doc(alias = "size")]
729 pub fn connect_size_notify<F: Fn(&Self) + Send + Sync + 'static>(
730 &self,
731 f: F,
732 ) -> SignalHandlerId {
733 unsafe extern "C" fn notify_size_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
734 this: *mut ffi::GstAppSrc,
735 _param_spec: glib::ffi::gpointer,
736 f: glib::ffi::gpointer,
737 ) {
738 let f: &F = &*(f as *const F);
739 f(&from_glib_borrow(this))
740 }
741 unsafe {
742 let f: Box_<F> = Box_::new(f);
743 connect_raw(
744 self.as_ptr() as *mut _,
745 b"notify::size\0".as_ptr() as *const _,
746 Some(transmute::<_, unsafe extern "C" fn()>(
747 notify_size_trampoline::<F> as *const (),
748 )),
749 Box_::into_raw(f),
750 )
751 }
752 }
753
754 #[doc(alias = "stream-type")]
755 pub fn connect_stream_type_notify<F: Fn(&Self) + Send + Sync + 'static>(
756 &self,
757 f: F,
758 ) -> SignalHandlerId {
759 unsafe extern "C" fn notify_stream_type_trampoline<
760 F: Fn(&AppSrc) + Send + Sync + 'static,
761 >(
762 this: *mut ffi::GstAppSrc,
763 _param_spec: glib::ffi::gpointer,
764 f: glib::ffi::gpointer,
765 ) {
766 let f: &F = &*(f as *const F);
767 f(&from_glib_borrow(this))
768 }
769 unsafe {
770 let f: Box_<F> = Box_::new(f);
771 connect_raw(
772 self.as_ptr() as *mut _,
773 b"notify::stream-type\0".as_ptr() as *const _,
774 Some(transmute::<_, unsafe extern "C" fn()>(
775 notify_stream_type_trampoline::<F> as *const (),
776 )),
777 Box_::into_raw(f),
778 )
779 }
780 }
781}
782
783unsafe impl Send for AppSrc {}
784unsafe impl Sync for AppSrc {}
785