1use crate::ffi;
7#[cfg(feature = "v1_20")]
8#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
9use crate::RTPHeaderExtension;
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::{connect_raw, SignalHandlerId},
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 let f: &F = &*(f as *const F);
307 f(
308 RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref(),
309 &from_glib_full(ext),
310 )
311 }
312 unsafe {
313 let f: Box_<F> = Box_::new(f);
314 connect_raw(
315 self.as_ptr() as *mut _,
316 c"add-extension".as_ptr() as *const _,
317 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
318 add_extension_trampoline::<Self, F> as *const (),
319 )),
320 Box_::into_raw(f),
321 )
322 }
323 }
324
325 #[cfg(feature = "v1_20")]
326 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
327 fn emit_add_extension(&self, ext: &RTPHeaderExtension) {
328 self.emit_by_name::<()>("add-extension", &[&ext]);
329 }
330
331 #[cfg(feature = "v1_20")]
332 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
333 #[doc(alias = "clear-extensions")]
334 fn connect_clear_extensions<F: Fn(&Self) + Send + Sync + 'static>(
335 &self,
336 f: F,
337 ) -> SignalHandlerId {
338 unsafe extern "C" fn clear_extensions_trampoline<
339 P: IsA<RTPBasePayload>,
340 F: Fn(&P) + Send + Sync + 'static,
341 >(
342 this: *mut ffi::GstRTPBasePayload,
343 f: glib::ffi::gpointer,
344 ) {
345 let f: &F = &*(f as *const F);
346 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
347 }
348 unsafe {
349 let f: Box_<F> = Box_::new(f);
350 connect_raw(
351 self.as_ptr() as *mut _,
352 c"clear-extensions".as_ptr() as *const _,
353 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
354 clear_extensions_trampoline::<Self, F> as *const (),
355 )),
356 Box_::into_raw(f),
357 )
358 }
359 }
360
361 #[cfg(feature = "v1_20")]
362 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
363 fn emit_clear_extensions(&self) {
364 self.emit_by_name::<()>("clear-extensions", &[]);
365 }
366
367 #[cfg(feature = "v1_20")]
368 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
369 #[doc(alias = "request-extension")]
370 fn connect_request_extension<
371 F: Fn(&Self, u32, &str) -> Option<RTPHeaderExtension> + Send + Sync + 'static,
372 >(
373 &self,
374 f: F,
375 ) -> SignalHandlerId {
376 unsafe extern "C" fn request_extension_trampoline<
377 P: IsA<RTPBasePayload>,
378 F: Fn(&P, u32, &str) -> Option<RTPHeaderExtension> + Send + Sync + 'static,
379 >(
380 this: *mut ffi::GstRTPBasePayload,
381 ext_id: std::ffi::c_uint,
382 ext_uri: *mut std::ffi::c_char,
383 f: glib::ffi::gpointer,
384 ) -> *mut ffi::GstRTPHeaderExtension {
385 let f: &F = &*(f as *const F);
386 f(
387 RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref(),
388 ext_id,
389 &glib::GString::from_glib_borrow(ext_uri),
390 )
391 .to_glib_full()
392 }
393 unsafe {
394 let f: Box_<F> = Box_::new(f);
395 connect_raw(
396 self.as_ptr() as *mut _,
397 c"request-extension".as_ptr() as *const _,
398 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
399 request_extension_trampoline::<Self, F> as *const (),
400 )),
401 Box_::into_raw(f),
402 )
403 }
404 }
405
406 #[cfg(feature = "v1_20")]
407 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
408 #[doc(alias = "auto-header-extension")]
409 fn connect_auto_header_extension_notify<F: Fn(&Self) + Send + Sync + 'static>(
410 &self,
411 f: F,
412 ) -> SignalHandlerId {
413 unsafe extern "C" fn notify_auto_header_extension_trampoline<
414 P: IsA<RTPBasePayload>,
415 F: Fn(&P) + Send + Sync + 'static,
416 >(
417 this: *mut ffi::GstRTPBasePayload,
418 _param_spec: glib::ffi::gpointer,
419 f: glib::ffi::gpointer,
420 ) {
421 let f: &F = &*(f as *const F);
422 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
423 }
424 unsafe {
425 let f: Box_<F> = Box_::new(f);
426 connect_raw(
427 self.as_ptr() as *mut _,
428 c"notify::auto-header-extension".as_ptr() as *const _,
429 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
430 notify_auto_header_extension_trampoline::<Self, F> as *const (),
431 )),
432 Box_::into_raw(f),
433 )
434 }
435 }
436
437 #[doc(alias = "max-ptime")]
438 fn connect_max_ptime_notify<F: Fn(&Self) + Send + Sync + 'static>(
439 &self,
440 f: F,
441 ) -> SignalHandlerId {
442 unsafe extern "C" fn notify_max_ptime_trampoline<
443 P: IsA<RTPBasePayload>,
444 F: Fn(&P) + Send + Sync + 'static,
445 >(
446 this: *mut ffi::GstRTPBasePayload,
447 _param_spec: glib::ffi::gpointer,
448 f: glib::ffi::gpointer,
449 ) {
450 let f: &F = &*(f as *const F);
451 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
452 }
453 unsafe {
454 let f: Box_<F> = Box_::new(f);
455 connect_raw(
456 self.as_ptr() as *mut _,
457 c"notify::max-ptime".as_ptr() as *const _,
458 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
459 notify_max_ptime_trampoline::<Self, F> as *const (),
460 )),
461 Box_::into_raw(f),
462 )
463 }
464 }
465
466 #[doc(alias = "min-ptime")]
467 fn connect_min_ptime_notify<F: Fn(&Self) + Send + Sync + 'static>(
468 &self,
469 f: F,
470 ) -> SignalHandlerId {
471 unsafe extern "C" fn notify_min_ptime_trampoline<
472 P: IsA<RTPBasePayload>,
473 F: Fn(&P) + Send + Sync + 'static,
474 >(
475 this: *mut ffi::GstRTPBasePayload,
476 _param_spec: glib::ffi::gpointer,
477 f: glib::ffi::gpointer,
478 ) {
479 let f: &F = &*(f as *const F);
480 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
481 }
482 unsafe {
483 let f: Box_<F> = Box_::new(f);
484 connect_raw(
485 self.as_ptr() as *mut _,
486 c"notify::min-ptime".as_ptr() as *const _,
487 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
488 notify_min_ptime_trampoline::<Self, F> as *const (),
489 )),
490 Box_::into_raw(f),
491 )
492 }
493 }
494
495 #[doc(alias = "mtu")]
496 fn connect_mtu_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
497 unsafe extern "C" fn notify_mtu_trampoline<
498 P: IsA<RTPBasePayload>,
499 F: Fn(&P) + Send + Sync + 'static,
500 >(
501 this: *mut ffi::GstRTPBasePayload,
502 _param_spec: glib::ffi::gpointer,
503 f: glib::ffi::gpointer,
504 ) {
505 let f: &F = &*(f as *const F);
506 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
507 }
508 unsafe {
509 let f: Box_<F> = Box_::new(f);
510 connect_raw(
511 self.as_ptr() as *mut _,
512 c"notify::mtu".as_ptr() as *const _,
513 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
514 notify_mtu_trampoline::<Self, F> as *const (),
515 )),
516 Box_::into_raw(f),
517 )
518 }
519 }
520
521 #[cfg(feature = "v1_16")]
522 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
523 #[doc(alias = "onvif-no-rate-control")]
524 fn connect_onvif_no_rate_control_notify<F: Fn(&Self) + Send + Sync + 'static>(
525 &self,
526 f: F,
527 ) -> SignalHandlerId {
528 unsafe extern "C" fn notify_onvif_no_rate_control_trampoline<
529 P: IsA<RTPBasePayload>,
530 F: Fn(&P) + Send + Sync + 'static,
531 >(
532 this: *mut ffi::GstRTPBasePayload,
533 _param_spec: glib::ffi::gpointer,
534 f: glib::ffi::gpointer,
535 ) {
536 let f: &F = &*(f as *const F);
537 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
538 }
539 unsafe {
540 let f: Box_<F> = Box_::new(f);
541 connect_raw(
542 self.as_ptr() as *mut _,
543 c"notify::onvif-no-rate-control".as_ptr() as *const _,
544 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
545 notify_onvif_no_rate_control_trampoline::<Self, F> as *const (),
546 )),
547 Box_::into_raw(f),
548 )
549 }
550 }
551
552 #[doc(alias = "perfect-rtptime")]
553 fn connect_perfect_rtptime_notify<F: Fn(&Self) + Send + Sync + 'static>(
554 &self,
555 f: F,
556 ) -> SignalHandlerId {
557 unsafe extern "C" fn notify_perfect_rtptime_trampoline<
558 P: IsA<RTPBasePayload>,
559 F: Fn(&P) + Send + Sync + 'static,
560 >(
561 this: *mut ffi::GstRTPBasePayload,
562 _param_spec: glib::ffi::gpointer,
563 f: glib::ffi::gpointer,
564 ) {
565 let f: &F = &*(f as *const F);
566 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
567 }
568 unsafe {
569 let f: Box_<F> = Box_::new(f);
570 connect_raw(
571 self.as_ptr() as *mut _,
572 c"notify::perfect-rtptime".as_ptr() as *const _,
573 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
574 notify_perfect_rtptime_trampoline::<Self, F> as *const (),
575 )),
576 Box_::into_raw(f),
577 )
578 }
579 }
580
581 #[doc(alias = "pt")]
582 fn connect_pt_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
583 unsafe extern "C" fn notify_pt_trampoline<
584 P: IsA<RTPBasePayload>,
585 F: Fn(&P) + Send + Sync + 'static,
586 >(
587 this: *mut ffi::GstRTPBasePayload,
588 _param_spec: glib::ffi::gpointer,
589 f: glib::ffi::gpointer,
590 ) {
591 let f: &F = &*(f as *const F);
592 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
593 }
594 unsafe {
595 let f: Box_<F> = Box_::new(f);
596 connect_raw(
597 self.as_ptr() as *mut _,
598 c"notify::pt".as_ptr() as *const _,
599 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
600 notify_pt_trampoline::<Self, F> as *const (),
601 )),
602 Box_::into_raw(f),
603 )
604 }
605 }
606
607 #[doc(alias = "ptime-multiple")]
608 fn connect_ptime_multiple_notify<F: Fn(&Self) + Send + Sync + 'static>(
609 &self,
610 f: F,
611 ) -> SignalHandlerId {
612 unsafe extern "C" fn notify_ptime_multiple_trampoline<
613 P: IsA<RTPBasePayload>,
614 F: Fn(&P) + Send + Sync + 'static,
615 >(
616 this: *mut ffi::GstRTPBasePayload,
617 _param_spec: glib::ffi::gpointer,
618 f: glib::ffi::gpointer,
619 ) {
620 let f: &F = &*(f as *const F);
621 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
622 }
623 unsafe {
624 let f: Box_<F> = Box_::new(f);
625 connect_raw(
626 self.as_ptr() as *mut _,
627 c"notify::ptime-multiple".as_ptr() as *const _,
628 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
629 notify_ptime_multiple_trampoline::<Self, F> as *const (),
630 )),
631 Box_::into_raw(f),
632 )
633 }
634 }
635
636 #[cfg(feature = "v1_18")]
637 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
638 #[doc(alias = "scale-rtptime")]
639 fn connect_scale_rtptime_notify<F: Fn(&Self) + Send + Sync + 'static>(
640 &self,
641 f: F,
642 ) -> SignalHandlerId {
643 unsafe extern "C" fn notify_scale_rtptime_trampoline<
644 P: IsA<RTPBasePayload>,
645 F: Fn(&P) + Send + Sync + 'static,
646 >(
647 this: *mut ffi::GstRTPBasePayload,
648 _param_spec: glib::ffi::gpointer,
649 f: glib::ffi::gpointer,
650 ) {
651 let f: &F = &*(f as *const F);
652 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
653 }
654 unsafe {
655 let f: Box_<F> = Box_::new(f);
656 connect_raw(
657 self.as_ptr() as *mut _,
658 c"notify::scale-rtptime".as_ptr() as *const _,
659 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
660 notify_scale_rtptime_trampoline::<Self, F> as *const (),
661 )),
662 Box_::into_raw(f),
663 )
664 }
665 }
666
667 #[doc(alias = "seqnum")]
668 fn connect_seqnum_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
669 unsafe extern "C" fn notify_seqnum_trampoline<
670 P: IsA<RTPBasePayload>,
671 F: Fn(&P) + Send + Sync + 'static,
672 >(
673 this: *mut ffi::GstRTPBasePayload,
674 _param_spec: glib::ffi::gpointer,
675 f: glib::ffi::gpointer,
676 ) {
677 let f: &F = &*(f as *const F);
678 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
679 }
680 unsafe {
681 let f: Box_<F> = Box_::new(f);
682 connect_raw(
683 self.as_ptr() as *mut _,
684 c"notify::seqnum".as_ptr() as *const _,
685 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
686 notify_seqnum_trampoline::<Self, F> as *const (),
687 )),
688 Box_::into_raw(f),
689 )
690 }
691 }
692
693 #[doc(alias = "seqnum-offset")]
694 fn connect_seqnum_offset_notify<F: Fn(&Self) + Send + Sync + 'static>(
695 &self,
696 f: F,
697 ) -> SignalHandlerId {
698 unsafe extern "C" fn notify_seqnum_offset_trampoline<
699 P: IsA<RTPBasePayload>,
700 F: Fn(&P) + Send + Sync + 'static,
701 >(
702 this: *mut ffi::GstRTPBasePayload,
703 _param_spec: glib::ffi::gpointer,
704 f: glib::ffi::gpointer,
705 ) {
706 let f: &F = &*(f as *const F);
707 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
708 }
709 unsafe {
710 let f: Box_<F> = Box_::new(f);
711 connect_raw(
712 self.as_ptr() as *mut _,
713 c"notify::seqnum-offset".as_ptr() as *const _,
714 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
715 notify_seqnum_offset_trampoline::<Self, F> as *const (),
716 )),
717 Box_::into_raw(f),
718 )
719 }
720 }
721
722 #[cfg(feature = "v1_16")]
723 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
724 #[doc(alias = "source-info")]
725 fn connect_source_info_notify<F: Fn(&Self) + Send + Sync + 'static>(
726 &self,
727 f: F,
728 ) -> SignalHandlerId {
729 unsafe extern "C" fn notify_source_info_trampoline<
730 P: IsA<RTPBasePayload>,
731 F: Fn(&P) + Send + Sync + 'static,
732 >(
733 this: *mut ffi::GstRTPBasePayload,
734 _param_spec: glib::ffi::gpointer,
735 f: glib::ffi::gpointer,
736 ) {
737 let f: &F = &*(f as *const F);
738 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
739 }
740 unsafe {
741 let f: Box_<F> = Box_::new(f);
742 connect_raw(
743 self.as_ptr() as *mut _,
744 c"notify::source-info".as_ptr() as *const _,
745 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
746 notify_source_info_trampoline::<Self, F> as *const (),
747 )),
748 Box_::into_raw(f),
749 )
750 }
751 }
752
753 #[doc(alias = "ssrc")]
754 fn connect_ssrc_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
755 unsafe extern "C" fn notify_ssrc_trampoline<
756 P: IsA<RTPBasePayload>,
757 F: Fn(&P) + Send + Sync + 'static,
758 >(
759 this: *mut ffi::GstRTPBasePayload,
760 _param_spec: glib::ffi::gpointer,
761 f: glib::ffi::gpointer,
762 ) {
763 let f: &F = &*(f as *const F);
764 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
765 }
766 unsafe {
767 let f: Box_<F> = Box_::new(f);
768 connect_raw(
769 self.as_ptr() as *mut _,
770 c"notify::ssrc".as_ptr() as *const _,
771 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
772 notify_ssrc_trampoline::<Self, F> as *const (),
773 )),
774 Box_::into_raw(f),
775 )
776 }
777 }
778
779 #[doc(alias = "stats")]
780 fn connect_stats_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
781 unsafe extern "C" fn notify_stats_trampoline<
782 P: IsA<RTPBasePayload>,
783 F: Fn(&P) + Send + Sync + 'static,
784 >(
785 this: *mut ffi::GstRTPBasePayload,
786 _param_spec: glib::ffi::gpointer,
787 f: glib::ffi::gpointer,
788 ) {
789 let f: &F = &*(f as *const F);
790 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
791 }
792 unsafe {
793 let f: Box_<F> = Box_::new(f);
794 connect_raw(
795 self.as_ptr() as *mut _,
796 c"notify::stats".as_ptr() as *const _,
797 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
798 notify_stats_trampoline::<Self, F> as *const (),
799 )),
800 Box_::into_raw(f),
801 )
802 }
803 }
804
805 #[doc(alias = "timestamp")]
806 fn connect_timestamp_notify<F: Fn(&Self) + Send + Sync + 'static>(
807 &self,
808 f: F,
809 ) -> SignalHandlerId {
810 unsafe extern "C" fn notify_timestamp_trampoline<
811 P: IsA<RTPBasePayload>,
812 F: Fn(&P) + Send + Sync + 'static,
813 >(
814 this: *mut ffi::GstRTPBasePayload,
815 _param_spec: glib::ffi::gpointer,
816 f: glib::ffi::gpointer,
817 ) {
818 let f: &F = &*(f as *const F);
819 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
820 }
821 unsafe {
822 let f: Box_<F> = Box_::new(f);
823 connect_raw(
824 self.as_ptr() as *mut _,
825 c"notify::timestamp".as_ptr() as *const _,
826 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
827 notify_timestamp_trampoline::<Self, F> as *const (),
828 )),
829 Box_::into_raw(f),
830 )
831 }
832 }
833
834 #[doc(alias = "timestamp-offset")]
835 fn connect_timestamp_offset_notify<F: Fn(&Self) + Send + Sync + 'static>(
836 &self,
837 f: F,
838 ) -> SignalHandlerId {
839 unsafe extern "C" fn notify_timestamp_offset_trampoline<
840 P: IsA<RTPBasePayload>,
841 F: Fn(&P) + Send + Sync + 'static,
842 >(
843 this: *mut ffi::GstRTPBasePayload,
844 _param_spec: glib::ffi::gpointer,
845 f: glib::ffi::gpointer,
846 ) {
847 let f: &F = &*(f as *const F);
848 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
849 }
850 unsafe {
851 let f: Box_<F> = Box_::new(f);
852 connect_raw(
853 self.as_ptr() as *mut _,
854 c"notify::timestamp-offset".as_ptr() as *const _,
855 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
856 notify_timestamp_offset_trampoline::<Self, F> as *const (),
857 )),
858 Box_::into_raw(f),
859 )
860 }
861 }
862}
863
864impl<O: IsA<RTPBasePayload>> RTPBasePayloadExt for O {}