1#[cfg(feature = "v1_20")]
7#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
8use crate::RTPHeaderExtension;
9use crate::ffi;
10#[cfg(feature = "v1_20")]
11#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
12use glib::object::ObjectType as _;
13use glib::{
14 prelude::*,
15 signal::{SignalHandlerId, connect_raw},
16 translate::*,
17};
18use std::boxed::Box as Box_;
19
20glib::wrapper! {
21 #[doc(alias = "GstRTPBasePayload")]
22 pub struct RTPBasePayload(Object<ffi::GstRTPBasePayload, ffi::GstRTPBasePayloadClass>) @extends gst::Element, gst::Object;
23
24 match fn {
25 type_ => || ffi::gst_rtp_base_payload_get_type(),
26 }
27}
28
29impl RTPBasePayload {
30 pub const NONE: Option<&'static RTPBasePayload> = None;
31}
32
33unsafe impl Send for RTPBasePayload {}
34unsafe impl Sync for RTPBasePayload {}
35
36pub trait RTPBasePayloadExt: IsA<RTPBasePayload> + 'static {
37 #[cfg(feature = "v1_16")]
38 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
39 #[doc(alias = "gst_rtp_base_payload_allocate_output_buffer")]
40 fn allocate_output_buffer(&self, payload_len: u32, pad_len: u8, csrc_count: u8) -> gst::Buffer {
41 unsafe {
42 from_glib_full(ffi::gst_rtp_base_payload_allocate_output_buffer(
43 self.as_ref().to_glib_none().0,
44 payload_len,
45 pad_len,
46 csrc_count,
47 ))
48 }
49 }
50
51 #[cfg(feature = "v1_16")]
52 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
53 #[doc(alias = "gst_rtp_base_payload_get_source_count")]
54 #[doc(alias = "get_source_count")]
55 fn source_count(&self, buffer: &gst::Buffer) -> u32 {
56 unsafe {
57 ffi::gst_rtp_base_payload_get_source_count(
58 self.as_ref().to_glib_none().0,
59 buffer.to_glib_none().0,
60 )
61 }
62 }
63
64 #[doc(alias = "gst_rtp_base_payload_is_filled")]
65 fn is_filled(&self, size: u32, duration: impl Into<Option<gst::ClockTime>>) -> bool {
66 unsafe {
67 from_glib(ffi::gst_rtp_base_payload_is_filled(
68 self.as_ref().to_glib_none().0,
69 size,
70 duration.into().into_glib(),
71 ))
72 }
73 }
74
75 #[cfg(feature = "v1_16")]
76 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
77 #[doc(alias = "gst_rtp_base_payload_is_source_info_enabled")]
78 fn is_source_info_enabled(&self) -> bool {
79 unsafe {
80 from_glib(ffi::gst_rtp_base_payload_is_source_info_enabled(
81 self.as_ref().to_glib_none().0,
82 ))
83 }
84 }
85
86 #[doc(alias = "gst_rtp_base_payload_push")]
87 fn push(&self, buffer: gst::Buffer) -> Result<gst::FlowSuccess, gst::FlowError> {
88 unsafe {
89 try_from_glib(ffi::gst_rtp_base_payload_push(
90 self.as_ref().to_glib_none().0,
91 buffer.into_glib_ptr(),
92 ))
93 }
94 }
95
96 #[doc(alias = "gst_rtp_base_payload_push_list")]
97 fn push_list(&self, list: gst::BufferList) -> Result<gst::FlowSuccess, gst::FlowError> {
98 unsafe {
99 try_from_glib(ffi::gst_rtp_base_payload_push_list(
100 self.as_ref().to_glib_none().0,
101 list.into_glib_ptr(),
102 ))
103 }
104 }
105
106 #[doc(alias = "gst_rtp_base_payload_set_options")]
107 fn set_options(&self, media: &str, dynamic: bool, encoding_name: &str, clock_rate: u32) {
108 unsafe {
109 ffi::gst_rtp_base_payload_set_options(
110 self.as_ref().to_glib_none().0,
111 media.to_glib_none().0,
112 dynamic.into_glib(),
113 encoding_name.to_glib_none().0,
114 clock_rate,
115 );
116 }
117 }
118
119 #[cfg(feature = "v1_16")]
120 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
121 #[doc(alias = "gst_rtp_base_payload_set_source_info_enabled")]
122 fn set_source_info_enabled(&self, enable: bool) {
123 unsafe {
124 ffi::gst_rtp_base_payload_set_source_info_enabled(
125 self.as_ref().to_glib_none().0,
126 enable.into_glib(),
127 );
128 }
129 }
130
131 #[cfg(feature = "v1_20")]
132 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
133 #[doc(alias = "auto-header-extension")]
134 fn is_auto_header_extension(&self) -> bool {
135 ObjectExt::property(self.as_ref(), "auto-header-extension")
136 }
137
138 #[cfg(feature = "v1_20")]
139 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
140 #[doc(alias = "auto-header-extension")]
141 fn set_auto_header_extension(&self, auto_header_extension: bool) {
142 ObjectExt::set_property(
143 self.as_ref(),
144 "auto-header-extension",
145 auto_header_extension,
146 )
147 }
148
149 #[doc(alias = "max-ptime")]
150 fn max_ptime(&self) -> i64 {
151 ObjectExt::property(self.as_ref(), "max-ptime")
152 }
153
154 #[doc(alias = "max-ptime")]
155 fn set_max_ptime(&self, max_ptime: i64) {
156 ObjectExt::set_property(self.as_ref(), "max-ptime", max_ptime)
157 }
158
159 #[doc(alias = "min-ptime")]
160 fn min_ptime(&self) -> i64 {
161 ObjectExt::property(self.as_ref(), "min-ptime")
162 }
163
164 #[doc(alias = "min-ptime")]
165 fn set_min_ptime(&self, min_ptime: i64) {
166 ObjectExt::set_property(self.as_ref(), "min-ptime", min_ptime)
167 }
168
169 fn mtu(&self) -> u32 {
170 ObjectExt::property(self.as_ref(), "mtu")
171 }
172
173 fn set_mtu(&self, mtu: u32) {
174 ObjectExt::set_property(self.as_ref(), "mtu", mtu)
175 }
176
177 #[cfg(feature = "v1_16")]
178 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
179 #[doc(alias = "onvif-no-rate-control")]
180 fn is_onvif_no_rate_control(&self) -> bool {
181 ObjectExt::property(self.as_ref(), "onvif-no-rate-control")
182 }
183
184 #[cfg(feature = "v1_16")]
185 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
186 #[doc(alias = "onvif-no-rate-control")]
187 fn set_onvif_no_rate_control(&self, onvif_no_rate_control: bool) {
188 ObjectExt::set_property(
189 self.as_ref(),
190 "onvif-no-rate-control",
191 onvif_no_rate_control,
192 )
193 }
194
195 #[doc(alias = "perfect-rtptime")]
196 fn is_perfect_rtptime(&self) -> bool {
197 ObjectExt::property(self.as_ref(), "perfect-rtptime")
198 }
199
200 #[doc(alias = "perfect-rtptime")]
201 fn set_perfect_rtptime(&self, perfect_rtptime: bool) {
202 ObjectExt::set_property(self.as_ref(), "perfect-rtptime", perfect_rtptime)
203 }
204
205 fn pt(&self) -> u32 {
206 ObjectExt::property(self.as_ref(), "pt")
207 }
208
209 fn set_pt(&self, pt: u32) {
210 ObjectExt::set_property(self.as_ref(), "pt", pt)
211 }
212
213 #[doc(alias = "ptime-multiple")]
214 fn ptime_multiple(&self) -> i64 {
215 ObjectExt::property(self.as_ref(), "ptime-multiple")
216 }
217
218 #[doc(alias = "ptime-multiple")]
219 fn set_ptime_multiple(&self, ptime_multiple: i64) {
220 ObjectExt::set_property(self.as_ref(), "ptime-multiple", ptime_multiple)
221 }
222
223 #[cfg(feature = "v1_18")]
224 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
225 #[doc(alias = "scale-rtptime")]
226 fn is_scale_rtptime(&self) -> bool {
227 ObjectExt::property(self.as_ref(), "scale-rtptime")
228 }
229
230 #[cfg(feature = "v1_18")]
231 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
232 #[doc(alias = "scale-rtptime")]
233 fn set_scale_rtptime(&self, scale_rtptime: bool) {
234 ObjectExt::set_property(self.as_ref(), "scale-rtptime", scale_rtptime)
235 }
236
237 fn seqnum(&self) -> u32 {
238 ObjectExt::property(self.as_ref(), "seqnum")
239 }
240
241 #[doc(alias = "seqnum-offset")]
242 fn seqnum_offset(&self) -> i32 {
243 ObjectExt::property(self.as_ref(), "seqnum-offset")
244 }
245
246 #[doc(alias = "seqnum-offset")]
247 fn set_seqnum_offset(&self, seqnum_offset: i32) {
248 ObjectExt::set_property(self.as_ref(), "seqnum-offset", seqnum_offset)
249 }
250
251 #[cfg(feature = "v1_16")]
252 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
253 #[doc(alias = "source-info")]
254 fn is_source_info(&self) -> bool {
255 ObjectExt::property(self.as_ref(), "source-info")
256 }
257
258 #[cfg(feature = "v1_16")]
259 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
260 #[doc(alias = "source-info")]
261 fn set_source_info(&self, source_info: bool) {
262 ObjectExt::set_property(self.as_ref(), "source-info", source_info)
263 }
264
265 fn ssrc(&self) -> u32 {
266 ObjectExt::property(self.as_ref(), "ssrc")
267 }
268
269 fn set_ssrc(&self, ssrc: u32) {
270 ObjectExt::set_property(self.as_ref(), "ssrc", ssrc)
271 }
272
273 fn stats(&self) -> Option<gst::Structure> {
274 ObjectExt::property(self.as_ref(), "stats")
275 }
276
277 fn timestamp(&self) -> u32 {
278 ObjectExt::property(self.as_ref(), "timestamp")
279 }
280
281 #[doc(alias = "timestamp-offset")]
282 fn timestamp_offset(&self) -> u32 {
283 ObjectExt::property(self.as_ref(), "timestamp-offset")
284 }
285
286 #[doc(alias = "timestamp-offset")]
287 fn set_timestamp_offset(&self, timestamp_offset: u32) {
288 ObjectExt::set_property(self.as_ref(), "timestamp-offset", timestamp_offset)
289 }
290
291 #[cfg(feature = "v1_20")]
292 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
293 #[doc(alias = "add-extension")]
294 fn connect_add_extension<F: Fn(&Self, &RTPHeaderExtension) + Send + Sync + 'static>(
295 &self,
296 f: F,
297 ) -> SignalHandlerId {
298 unsafe extern "C" fn add_extension_trampoline<
299 P: IsA<RTPBasePayload>,
300 F: Fn(&P, &RTPHeaderExtension) + Send + Sync + 'static,
301 >(
302 this: *mut ffi::GstRTPBasePayload,
303 ext: *mut ffi::GstRTPHeaderExtension,
304 f: glib::ffi::gpointer,
305 ) {
306 unsafe {
307 let f: &F = &*(f as *const F);
308 f(
309 RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref(),
310 &from_glib_full(ext),
311 )
312 }
313 }
314 unsafe {
315 let f: Box_<F> = Box_::new(f);
316 connect_raw(
317 self.as_ptr() as *mut _,
318 c"add-extension".as_ptr(),
319 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
320 add_extension_trampoline::<Self, F> as *const (),
321 )),
322 Box_::into_raw(f),
323 )
324 }
325 }
326
327 #[cfg(feature = "v1_20")]
328 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
329 fn emit_add_extension(&self, ext: &RTPHeaderExtension) {
330 self.emit_by_name::<()>("add-extension", &[&ext]);
331 }
332
333 #[cfg(feature = "v1_20")]
334 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
335 #[doc(alias = "clear-extensions")]
336 fn connect_clear_extensions<F: Fn(&Self) + Send + Sync + 'static>(
337 &self,
338 f: F,
339 ) -> SignalHandlerId {
340 unsafe extern "C" fn clear_extensions_trampoline<
341 P: IsA<RTPBasePayload>,
342 F: Fn(&P) + Send + Sync + 'static,
343 >(
344 this: *mut ffi::GstRTPBasePayload,
345 f: glib::ffi::gpointer,
346 ) {
347 unsafe {
348 let f: &F = &*(f as *const F);
349 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
350 }
351 }
352 unsafe {
353 let f: Box_<F> = Box_::new(f);
354 connect_raw(
355 self.as_ptr() as *mut _,
356 c"clear-extensions".as_ptr(),
357 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
358 clear_extensions_trampoline::<Self, F> as *const (),
359 )),
360 Box_::into_raw(f),
361 )
362 }
363 }
364
365 #[cfg(feature = "v1_20")]
366 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
367 fn emit_clear_extensions(&self) {
368 self.emit_by_name::<()>("clear-extensions", &[]);
369 }
370
371 #[cfg(feature = "v1_20")]
372 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
373 #[doc(alias = "request-extension")]
374 fn connect_request_extension<
375 F: Fn(&Self, u32, &str) -> Option<RTPHeaderExtension> + Send + Sync + 'static,
376 >(
377 &self,
378 f: F,
379 ) -> SignalHandlerId {
380 unsafe extern "C" fn request_extension_trampoline<
381 P: IsA<RTPBasePayload>,
382 F: Fn(&P, u32, &str) -> Option<RTPHeaderExtension> + Send + Sync + 'static,
383 >(
384 this: *mut ffi::GstRTPBasePayload,
385 ext_id: std::ffi::c_uint,
386 ext_uri: *mut std::ffi::c_char,
387 f: glib::ffi::gpointer,
388 ) -> *mut ffi::GstRTPHeaderExtension {
389 unsafe {
390 let f: &F = &*(f as *const F);
391 f(
392 RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref(),
393 ext_id,
394 &glib::GString::from_glib_borrow(ext_uri),
395 )
396 .to_glib_full()
397 }
398 }
399 unsafe {
400 let f: Box_<F> = Box_::new(f);
401 connect_raw(
402 self.as_ptr() as *mut _,
403 c"request-extension".as_ptr(),
404 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
405 request_extension_trampoline::<Self, F> as *const (),
406 )),
407 Box_::into_raw(f),
408 )
409 }
410 }
411
412 #[cfg(feature = "v1_20")]
413 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
414 #[doc(alias = "auto-header-extension")]
415 fn connect_auto_header_extension_notify<F: Fn(&Self) + Send + Sync + 'static>(
416 &self,
417 f: F,
418 ) -> SignalHandlerId {
419 unsafe extern "C" fn notify_auto_header_extension_trampoline<
420 P: IsA<RTPBasePayload>,
421 F: Fn(&P) + Send + Sync + 'static,
422 >(
423 this: *mut ffi::GstRTPBasePayload,
424 _param_spec: glib::ffi::gpointer,
425 f: glib::ffi::gpointer,
426 ) {
427 unsafe {
428 let f: &F = &*(f as *const F);
429 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
430 }
431 }
432 unsafe {
433 let f: Box_<F> = Box_::new(f);
434 connect_raw(
435 self.as_ptr() as *mut _,
436 c"notify::auto-header-extension".as_ptr(),
437 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
438 notify_auto_header_extension_trampoline::<Self, F> as *const (),
439 )),
440 Box_::into_raw(f),
441 )
442 }
443 }
444
445 #[doc(alias = "max-ptime")]
446 fn connect_max_ptime_notify<F: Fn(&Self) + Send + Sync + 'static>(
447 &self,
448 f: F,
449 ) -> SignalHandlerId {
450 unsafe extern "C" fn notify_max_ptime_trampoline<
451 P: IsA<RTPBasePayload>,
452 F: Fn(&P) + Send + Sync + 'static,
453 >(
454 this: *mut ffi::GstRTPBasePayload,
455 _param_spec: glib::ffi::gpointer,
456 f: glib::ffi::gpointer,
457 ) {
458 unsafe {
459 let f: &F = &*(f as *const F);
460 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
461 }
462 }
463 unsafe {
464 let f: Box_<F> = Box_::new(f);
465 connect_raw(
466 self.as_ptr() as *mut _,
467 c"notify::max-ptime".as_ptr(),
468 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
469 notify_max_ptime_trampoline::<Self, F> as *const (),
470 )),
471 Box_::into_raw(f),
472 )
473 }
474 }
475
476 #[doc(alias = "min-ptime")]
477 fn connect_min_ptime_notify<F: Fn(&Self) + Send + Sync + 'static>(
478 &self,
479 f: F,
480 ) -> SignalHandlerId {
481 unsafe extern "C" fn notify_min_ptime_trampoline<
482 P: IsA<RTPBasePayload>,
483 F: Fn(&P) + Send + Sync + 'static,
484 >(
485 this: *mut ffi::GstRTPBasePayload,
486 _param_spec: glib::ffi::gpointer,
487 f: glib::ffi::gpointer,
488 ) {
489 unsafe {
490 let f: &F = &*(f as *const F);
491 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
492 }
493 }
494 unsafe {
495 let f: Box_<F> = Box_::new(f);
496 connect_raw(
497 self.as_ptr() as *mut _,
498 c"notify::min-ptime".as_ptr(),
499 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
500 notify_min_ptime_trampoline::<Self, F> as *const (),
501 )),
502 Box_::into_raw(f),
503 )
504 }
505 }
506
507 #[doc(alias = "mtu")]
508 fn connect_mtu_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
509 unsafe extern "C" fn notify_mtu_trampoline<
510 P: IsA<RTPBasePayload>,
511 F: Fn(&P) + Send + Sync + 'static,
512 >(
513 this: *mut ffi::GstRTPBasePayload,
514 _param_spec: glib::ffi::gpointer,
515 f: glib::ffi::gpointer,
516 ) {
517 unsafe {
518 let f: &F = &*(f as *const F);
519 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
520 }
521 }
522 unsafe {
523 let f: Box_<F> = Box_::new(f);
524 connect_raw(
525 self.as_ptr() as *mut _,
526 c"notify::mtu".as_ptr(),
527 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
528 notify_mtu_trampoline::<Self, F> as *const (),
529 )),
530 Box_::into_raw(f),
531 )
532 }
533 }
534
535 #[cfg(feature = "v1_16")]
536 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
537 #[doc(alias = "onvif-no-rate-control")]
538 fn connect_onvif_no_rate_control_notify<F: Fn(&Self) + Send + Sync + 'static>(
539 &self,
540 f: F,
541 ) -> SignalHandlerId {
542 unsafe extern "C" fn notify_onvif_no_rate_control_trampoline<
543 P: IsA<RTPBasePayload>,
544 F: Fn(&P) + Send + Sync + 'static,
545 >(
546 this: *mut ffi::GstRTPBasePayload,
547 _param_spec: glib::ffi::gpointer,
548 f: glib::ffi::gpointer,
549 ) {
550 unsafe {
551 let f: &F = &*(f as *const F);
552 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
553 }
554 }
555 unsafe {
556 let f: Box_<F> = Box_::new(f);
557 connect_raw(
558 self.as_ptr() as *mut _,
559 c"notify::onvif-no-rate-control".as_ptr(),
560 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
561 notify_onvif_no_rate_control_trampoline::<Self, F> as *const (),
562 )),
563 Box_::into_raw(f),
564 )
565 }
566 }
567
568 #[doc(alias = "perfect-rtptime")]
569 fn connect_perfect_rtptime_notify<F: Fn(&Self) + Send + Sync + 'static>(
570 &self,
571 f: F,
572 ) -> SignalHandlerId {
573 unsafe extern "C" fn notify_perfect_rtptime_trampoline<
574 P: IsA<RTPBasePayload>,
575 F: Fn(&P) + Send + Sync + 'static,
576 >(
577 this: *mut ffi::GstRTPBasePayload,
578 _param_spec: glib::ffi::gpointer,
579 f: glib::ffi::gpointer,
580 ) {
581 unsafe {
582 let f: &F = &*(f as *const F);
583 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
584 }
585 }
586 unsafe {
587 let f: Box_<F> = Box_::new(f);
588 connect_raw(
589 self.as_ptr() as *mut _,
590 c"notify::perfect-rtptime".as_ptr(),
591 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
592 notify_perfect_rtptime_trampoline::<Self, F> as *const (),
593 )),
594 Box_::into_raw(f),
595 )
596 }
597 }
598
599 #[doc(alias = "pt")]
600 fn connect_pt_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
601 unsafe extern "C" fn notify_pt_trampoline<
602 P: IsA<RTPBasePayload>,
603 F: Fn(&P) + Send + Sync + 'static,
604 >(
605 this: *mut ffi::GstRTPBasePayload,
606 _param_spec: glib::ffi::gpointer,
607 f: glib::ffi::gpointer,
608 ) {
609 unsafe {
610 let f: &F = &*(f as *const F);
611 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
612 }
613 }
614 unsafe {
615 let f: Box_<F> = Box_::new(f);
616 connect_raw(
617 self.as_ptr() as *mut _,
618 c"notify::pt".as_ptr(),
619 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
620 notify_pt_trampoline::<Self, F> as *const (),
621 )),
622 Box_::into_raw(f),
623 )
624 }
625 }
626
627 #[doc(alias = "ptime-multiple")]
628 fn connect_ptime_multiple_notify<F: Fn(&Self) + Send + Sync + 'static>(
629 &self,
630 f: F,
631 ) -> SignalHandlerId {
632 unsafe extern "C" fn notify_ptime_multiple_trampoline<
633 P: IsA<RTPBasePayload>,
634 F: Fn(&P) + Send + Sync + 'static,
635 >(
636 this: *mut ffi::GstRTPBasePayload,
637 _param_spec: glib::ffi::gpointer,
638 f: glib::ffi::gpointer,
639 ) {
640 unsafe {
641 let f: &F = &*(f as *const F);
642 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
643 }
644 }
645 unsafe {
646 let f: Box_<F> = Box_::new(f);
647 connect_raw(
648 self.as_ptr() as *mut _,
649 c"notify::ptime-multiple".as_ptr(),
650 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
651 notify_ptime_multiple_trampoline::<Self, F> as *const (),
652 )),
653 Box_::into_raw(f),
654 )
655 }
656 }
657
658 #[cfg(feature = "v1_18")]
659 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
660 #[doc(alias = "scale-rtptime")]
661 fn connect_scale_rtptime_notify<F: Fn(&Self) + Send + Sync + 'static>(
662 &self,
663 f: F,
664 ) -> SignalHandlerId {
665 unsafe extern "C" fn notify_scale_rtptime_trampoline<
666 P: IsA<RTPBasePayload>,
667 F: Fn(&P) + Send + Sync + 'static,
668 >(
669 this: *mut ffi::GstRTPBasePayload,
670 _param_spec: glib::ffi::gpointer,
671 f: glib::ffi::gpointer,
672 ) {
673 unsafe {
674 let f: &F = &*(f as *const F);
675 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
676 }
677 }
678 unsafe {
679 let f: Box_<F> = Box_::new(f);
680 connect_raw(
681 self.as_ptr() as *mut _,
682 c"notify::scale-rtptime".as_ptr(),
683 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
684 notify_scale_rtptime_trampoline::<Self, F> as *const (),
685 )),
686 Box_::into_raw(f),
687 )
688 }
689 }
690
691 #[doc(alias = "seqnum")]
692 fn connect_seqnum_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
693 unsafe extern "C" fn notify_seqnum_trampoline<
694 P: IsA<RTPBasePayload>,
695 F: Fn(&P) + Send + Sync + 'static,
696 >(
697 this: *mut ffi::GstRTPBasePayload,
698 _param_spec: glib::ffi::gpointer,
699 f: glib::ffi::gpointer,
700 ) {
701 unsafe {
702 let f: &F = &*(f as *const F);
703 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
704 }
705 }
706 unsafe {
707 let f: Box_<F> = Box_::new(f);
708 connect_raw(
709 self.as_ptr() as *mut _,
710 c"notify::seqnum".as_ptr(),
711 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
712 notify_seqnum_trampoline::<Self, F> as *const (),
713 )),
714 Box_::into_raw(f),
715 )
716 }
717 }
718
719 #[doc(alias = "seqnum-offset")]
720 fn connect_seqnum_offset_notify<F: Fn(&Self) + Send + Sync + 'static>(
721 &self,
722 f: F,
723 ) -> SignalHandlerId {
724 unsafe extern "C" fn notify_seqnum_offset_trampoline<
725 P: IsA<RTPBasePayload>,
726 F: Fn(&P) + Send + Sync + 'static,
727 >(
728 this: *mut ffi::GstRTPBasePayload,
729 _param_spec: glib::ffi::gpointer,
730 f: glib::ffi::gpointer,
731 ) {
732 unsafe {
733 let f: &F = &*(f as *const F);
734 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
735 }
736 }
737 unsafe {
738 let f: Box_<F> = Box_::new(f);
739 connect_raw(
740 self.as_ptr() as *mut _,
741 c"notify::seqnum-offset".as_ptr(),
742 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
743 notify_seqnum_offset_trampoline::<Self, F> as *const (),
744 )),
745 Box_::into_raw(f),
746 )
747 }
748 }
749
750 #[cfg(feature = "v1_16")]
751 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
752 #[doc(alias = "source-info")]
753 fn connect_source_info_notify<F: Fn(&Self) + Send + Sync + 'static>(
754 &self,
755 f: F,
756 ) -> SignalHandlerId {
757 unsafe extern "C" fn notify_source_info_trampoline<
758 P: IsA<RTPBasePayload>,
759 F: Fn(&P) + Send + Sync + 'static,
760 >(
761 this: *mut ffi::GstRTPBasePayload,
762 _param_spec: glib::ffi::gpointer,
763 f: glib::ffi::gpointer,
764 ) {
765 unsafe {
766 let f: &F = &*(f as *const F);
767 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
768 }
769 }
770 unsafe {
771 let f: Box_<F> = Box_::new(f);
772 connect_raw(
773 self.as_ptr() as *mut _,
774 c"notify::source-info".as_ptr(),
775 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
776 notify_source_info_trampoline::<Self, F> as *const (),
777 )),
778 Box_::into_raw(f),
779 )
780 }
781 }
782
783 #[doc(alias = "ssrc")]
784 fn connect_ssrc_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
785 unsafe extern "C" fn notify_ssrc_trampoline<
786 P: IsA<RTPBasePayload>,
787 F: Fn(&P) + Send + Sync + 'static,
788 >(
789 this: *mut ffi::GstRTPBasePayload,
790 _param_spec: glib::ffi::gpointer,
791 f: glib::ffi::gpointer,
792 ) {
793 unsafe {
794 let f: &F = &*(f as *const F);
795 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
796 }
797 }
798 unsafe {
799 let f: Box_<F> = Box_::new(f);
800 connect_raw(
801 self.as_ptr() as *mut _,
802 c"notify::ssrc".as_ptr(),
803 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
804 notify_ssrc_trampoline::<Self, F> as *const (),
805 )),
806 Box_::into_raw(f),
807 )
808 }
809 }
810
811 #[doc(alias = "stats")]
812 fn connect_stats_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
813 unsafe extern "C" fn notify_stats_trampoline<
814 P: IsA<RTPBasePayload>,
815 F: Fn(&P) + Send + Sync + 'static,
816 >(
817 this: *mut ffi::GstRTPBasePayload,
818 _param_spec: glib::ffi::gpointer,
819 f: glib::ffi::gpointer,
820 ) {
821 unsafe {
822 let f: &F = &*(f as *const F);
823 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
824 }
825 }
826 unsafe {
827 let f: Box_<F> = Box_::new(f);
828 connect_raw(
829 self.as_ptr() as *mut _,
830 c"notify::stats".as_ptr(),
831 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
832 notify_stats_trampoline::<Self, F> as *const (),
833 )),
834 Box_::into_raw(f),
835 )
836 }
837 }
838
839 #[doc(alias = "timestamp")]
840 fn connect_timestamp_notify<F: Fn(&Self) + Send + Sync + 'static>(
841 &self,
842 f: F,
843 ) -> SignalHandlerId {
844 unsafe extern "C" fn notify_timestamp_trampoline<
845 P: IsA<RTPBasePayload>,
846 F: Fn(&P) + Send + Sync + 'static,
847 >(
848 this: *mut ffi::GstRTPBasePayload,
849 _param_spec: glib::ffi::gpointer,
850 f: glib::ffi::gpointer,
851 ) {
852 unsafe {
853 let f: &F = &*(f as *const F);
854 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
855 }
856 }
857 unsafe {
858 let f: Box_<F> = Box_::new(f);
859 connect_raw(
860 self.as_ptr() as *mut _,
861 c"notify::timestamp".as_ptr(),
862 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
863 notify_timestamp_trampoline::<Self, F> as *const (),
864 )),
865 Box_::into_raw(f),
866 )
867 }
868 }
869
870 #[doc(alias = "timestamp-offset")]
871 fn connect_timestamp_offset_notify<F: Fn(&Self) + Send + Sync + 'static>(
872 &self,
873 f: F,
874 ) -> SignalHandlerId {
875 unsafe extern "C" fn notify_timestamp_offset_trampoline<
876 P: IsA<RTPBasePayload>,
877 F: Fn(&P) + Send + Sync + 'static,
878 >(
879 this: *mut ffi::GstRTPBasePayload,
880 _param_spec: glib::ffi::gpointer,
881 f: glib::ffi::gpointer,
882 ) {
883 unsafe {
884 let f: &F = &*(f as *const F);
885 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
886 }
887 }
888 unsafe {
889 let f: Box_<F> = Box_::new(f);
890 connect_raw(
891 self.as_ptr() as *mut _,
892 c"notify::timestamp-offset".as_ptr(),
893 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
894 notify_timestamp_offset_trampoline::<Self, F> as *const (),
895 )),
896 Box_::into_raw(f),
897 )
898 }
899 }
900}
901
902impl<O: IsA<RTPBasePayload>> RTPBasePayloadExt for O {}