gstreamer_rtp/auto/rtp_base_payload.rs
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
6use 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 /// Provides a base class for RTP payloaders
22 ///
23 /// This is an Abstract Base Class, you cannot instantiate it.
24 ///
25 /// ## Properties
26 ///
27 ///
28 /// #### `auto-header-extension`
29 /// If enabled, the payloader will automatically try to enable all the
30 /// RTP header extensions provided in the src caps, saving the application
31 /// the need to handle these extensions manually using the
32 /// GstRTPBasePayload::request-extension: signal.
33 ///
34 /// Readable | Writeable
35 ///
36 ///
37 /// #### `extensions`
38 /// A list of already enabled RTP header extensions. This may be useful for finding
39 /// out which extensions are already enabled (with add-extension signal) and picking a non-conflicting
40 /// ID for a new extension that needs to be added on top of the existing ones.
41 ///
42 /// Note that the value returned by reading this property is not dynamically updated when the set of
43 /// enabled extensions changes by any of existing action signals. Rather, it represents the current state
44 /// at the time the property is read.
45 ///
46 /// Dynamic updates of this property can be received by subscribing to its corresponding "notify" signal, i.e.
47 /// "notify::extensions".
48 ///
49 /// Readable
50 ///
51 ///
52 /// #### `max-ptime`
53 /// Readable | Writeable
54 ///
55 ///
56 /// #### `min-ptime`
57 /// Minimum duration of the packet data in ns (can't go above MTU)
58 ///
59 /// Readable | Writeable
60 ///
61 ///
62 /// #### `mtu`
63 /// Readable | Writeable
64 ///
65 ///
66 /// #### `onvif-no-rate-control`
67 /// Make the payloader timestamp packets according to the Rate-Control=no
68 /// behaviour specified in the ONVIF replay spec.
69 ///
70 /// Readable | Writeable
71 ///
72 ///
73 /// #### `perfect-rtptime`
74 /// Try to use the offset fields to generate perfect RTP timestamps. When this
75 /// option is disabled, RTP timestamps are generated from GST_BUFFER_PTS of
76 /// each payloaded buffer. The PTSes of buffers may not necessarily increment
77 /// with the amount of data in each input buffer, consider e.g. the case where
78 /// the buffer arrives from a network which means that the PTS is unrelated to
79 /// the amount of data. Because the RTP timestamps are generated from
80 /// GST_BUFFER_PTS this can result in RTP timestamps that also don't increment
81 /// with the amount of data in the payloaded packet. To circumvent this it is
82 /// possible to set the perfect rtptime option enabled. When this option is
83 /// enabled the payloader will increment the RTP timestamps based on
84 /// GST_BUFFER_OFFSET which relates to the amount of data in each packet
85 /// rather than the GST_BUFFER_PTS of each buffer and therefore the RTP
86 /// timestamps will more closely correlate with the amount of data in each
87 /// buffer. Currently GstRTPBasePayload is limited to handling perfect RTP
88 /// timestamps for audio streams.
89 ///
90 /// Readable | Writeable
91 ///
92 ///
93 /// #### `pt`
94 /// Readable | Writeable
95 ///
96 ///
97 /// #### `ptime-multiple`
98 /// Force buffers to be multiples of this duration in ns (0 disables)
99 ///
100 /// Readable | Writeable
101 ///
102 ///
103 /// #### `scale-rtptime`
104 /// Make the RTP packets' timestamps be scaled with the segment's rate
105 /// (corresponding to RTSP speed parameter). Disabling this property means
106 /// the timestamps will not be affected by the set delivery speed (RTSP speed).
107 ///
108 /// Example: A server wants to allow streaming a recorded video in double
109 /// speed but still have the timestamps correspond to the position in the
110 /// video. This is achieved by the client setting RTSP Speed to 2 while the
111 /// server has this property disabled.
112 ///
113 /// Readable | Writeable
114 ///
115 ///
116 /// #### `seqnum`
117 /// Readable
118 ///
119 ///
120 /// #### `seqnum-offset`
121 /// Readable | Writeable
122 ///
123 ///
124 /// #### `source-info`
125 /// Enable writing the CSRC field in allocated RTP header based on RTP source
126 /// information found in the input buffer's `GstRTPSourceMeta`.
127 ///
128 /// Readable | Writeable
129 ///
130 ///
131 /// #### `ssrc`
132 /// Readable | Writeable
133 ///
134 ///
135 /// #### `stats`
136 /// Various payloader statistics retrieved atomically (and are therefore
137 /// synchroized with each other), these can be used e.g. to generate an
138 /// RTP-Info header. This property return a GstStructure named
139 /// application/x-rtp-payload-stats containing the following fields relating to
140 /// the last processed buffer and current state of the stream being payloaded:
141 ///
142 /// * `clock-rate` :`G_TYPE_UINT`, clock-rate of the stream
143 /// * `running-time` :`G_TYPE_UINT64`, running time
144 /// * `seqnum` :`G_TYPE_UINT`, sequence number, same as [`seqnum`][struct@crate::RTPBasePayload#seqnum]
145 /// * `timestamp` :`G_TYPE_UINT`, RTP timestamp, same as [`timestamp`][struct@crate::RTPBasePayload#timestamp]
146 /// * `ssrc` :`G_TYPE_UINT`, The SSRC in use
147 /// * `pt` :`G_TYPE_UINT`, The Payload type in use, same as [`pt`][struct@crate::RTPBasePayload#pt]
148 /// * `seqnum-offset` :`G_TYPE_UINT`, The current offset added to the seqnum
149 /// * `timestamp-offset` :`G_TYPE_UINT`, The current offset added to the timestamp
150 ///
151 /// Readable
152 ///
153 ///
154 /// #### `timestamp`
155 /// Readable
156 ///
157 ///
158 /// #### `timestamp-offset`
159 /// Readable | Writeable
160 /// <details><summary><h4>Object</h4></summary>
161 ///
162 ///
163 /// #### `name`
164 /// Readable | Writeable | Construct
165 ///
166 ///
167 /// #### `parent`
168 /// The parent of the object. Please note, that when changing the 'parent'
169 /// property, we don't emit `GObject::notify` and [`deep-notify`][struct@crate::gst::Object#deep-notify]
170 /// signals due to locking issues. In some cases one can use
171 /// `GstBin::element-added` or `GstBin::element-removed` signals on the parent to
172 /// achieve a similar effect.
173 ///
174 /// Readable | Writeable
175 /// </details>
176 ///
177 /// ## Signals
178 ///
179 ///
180 /// #### `add-extension`
181 /// Add `ext` as an extension for writing part of an RTP header extension onto
182 /// outgoing RTP packets.
183 ///
184 /// Action
185 ///
186 ///
187 /// #### `clear-extensions`
188 /// Clear all RTP header extensions used by this payloader.
189 ///
190 /// Action
191 ///
192 ///
193 /// #### `request-extension`
194 /// The returned `ext` must be configured with the correct `ext_id` and with the
195 /// necessary attributes as required by the extension implementation.
196 ///
197 ///
198 /// <details><summary><h4>Element</h4></summary>
199 ///
200 ///
201 /// #### `no-more-pads`
202 /// This signals that the element will not generate more dynamic pads.
203 /// Note that this signal will usually be emitted from the context of
204 /// the streaming thread.
205 ///
206 ///
207 ///
208 ///
209 /// #### `pad-added`
210 /// a new `GstPad` has been added to the element. Note that this signal will
211 /// usually be emitted from the context of the streaming thread. Also keep in
212 /// mind that if you add new elements to the pipeline in the signal handler
213 /// you will need to set them to the desired target state with
214 /// [`ElementExtManual::set_state()`][crate::gst::prelude::ElementExtManual::set_state()] or [`ElementExtManual::sync_state_with_parent()`][crate::gst::prelude::ElementExtManual::sync_state_with_parent()].
215 ///
216 ///
217 ///
218 ///
219 /// #### `pad-removed`
220 /// a `GstPad` has been removed from the element
221 ///
222 ///
223 /// </details>
224 /// <details><summary><h4>Object</h4></summary>
225 ///
226 ///
227 /// #### `deep-notify`
228 /// The deep notify signal is used to be notified of property changes. It is
229 /// typically attached to the toplevel bin to receive notifications from all
230 /// the elements contained in that bin.
231 ///
232 /// Detailed
233 /// </details>
234 ///
235 /// # Implements
236 ///
237 /// [`RTPBasePayloadExt`][trait@crate::prelude::RTPBasePayloadExt], [`trait@gst::prelude::ElementExt`], [`trait@gst::prelude::ObjectExt`], [`RTPBasePayloadExtManual`][trait@crate::prelude::RTPBasePayloadExtManual]
238 #[doc(alias = "GstRTPBasePayload")]
239 pub struct RTPBasePayload(Object<ffi::GstRTPBasePayload, ffi::GstRTPBasePayloadClass>) @extends gst::Element, gst::Object;
240
241 match fn {
242 type_ => || ffi::gst_rtp_base_payload_get_type(),
243 }
244}
245
246impl RTPBasePayload {
247 pub const NONE: Option<&'static RTPBasePayload> = None;
248}
249
250unsafe impl Send for RTPBasePayload {}
251unsafe impl Sync for RTPBasePayload {}
252
253/// Trait containing all [`struct@RTPBasePayload`] methods.
254///
255/// # Implementors
256///
257/// [`RTPBasePayload`][struct@crate::RTPBasePayload]
258pub trait RTPBasePayloadExt: IsA<RTPBasePayload> + 'static {
259 /// Allocate a new [`gst::Buffer`][crate::gst::Buffer] with enough data to hold an RTP packet with
260 /// minimum `csrc_count` CSRCs, a payload length of `payload_len` and padding of
261 /// `pad_len`. If `self` has [`source-info`][struct@crate::RTPBasePayload#source-info] [`true`] additional
262 /// CSRCs may be allocated and filled with RTP source information.
263 /// ## `payload_len`
264 /// the length of the payload
265 /// ## `pad_len`
266 /// the amount of padding
267 /// ## `csrc_count`
268 /// the minimum number of CSRC entries
269 ///
270 /// # Returns
271 ///
272 /// A newly allocated buffer that can hold an RTP packet with given
273 /// parameters.
274 #[cfg(feature = "v1_16")]
275 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
276 #[doc(alias = "gst_rtp_base_payload_allocate_output_buffer")]
277 fn allocate_output_buffer(&self, payload_len: u32, pad_len: u8, csrc_count: u8) -> gst::Buffer {
278 unsafe {
279 from_glib_full(ffi::gst_rtp_base_payload_allocate_output_buffer(
280 self.as_ref().to_glib_none().0,
281 payload_len,
282 pad_len,
283 csrc_count,
284 ))
285 }
286 }
287
288 /// Count the total number of RTP sources found in the meta of `buffer`, which
289 /// will be automically added by [`allocate_output_buffer()`][Self::allocate_output_buffer()].
290 /// If [`source-info`][struct@crate::RTPBasePayload#source-info] is [`false`] the count will be 0.
291 /// ## `buffer`
292 /// a [`gst::Buffer`][crate::gst::Buffer], typically the buffer to payload
293 ///
294 /// # Returns
295 ///
296 /// The number of sources.
297 #[cfg(feature = "v1_16")]
298 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
299 #[doc(alias = "gst_rtp_base_payload_get_source_count")]
300 #[doc(alias = "get_source_count")]
301 fn source_count(&self, buffer: &gst::Buffer) -> u32 {
302 unsafe {
303 ffi::gst_rtp_base_payload_get_source_count(
304 self.as_ref().to_glib_none().0,
305 buffer.to_glib_none().0,
306 )
307 }
308 }
309
310 /// Check if the packet with `size` and `duration` would exceed the configured
311 /// maximum size.
312 /// ## `size`
313 /// the size of the packet
314 /// ## `duration`
315 /// the duration of the packet
316 ///
317 /// # Returns
318 ///
319 /// [`true`] if the packet of `size` and `duration` would exceed the
320 /// configured MTU or max_ptime.
321 #[doc(alias = "gst_rtp_base_payload_is_filled")]
322 fn is_filled(&self, size: u32, duration: impl Into<Option<gst::ClockTime>>) -> bool {
323 unsafe {
324 from_glib(ffi::gst_rtp_base_payload_is_filled(
325 self.as_ref().to_glib_none().0,
326 size,
327 duration.into().into_glib(),
328 ))
329 }
330 }
331
332 /// Queries whether the payloader will add contributing sources (CSRCs) to the
333 /// RTP header from `GstRTPSourceMeta`.
334 ///
335 /// # Returns
336 ///
337 /// [`true`] if source-info is enabled.
338 #[cfg(feature = "v1_16")]
339 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
340 #[doc(alias = "gst_rtp_base_payload_is_source_info_enabled")]
341 fn is_source_info_enabled(&self) -> bool {
342 unsafe {
343 from_glib(ffi::gst_rtp_base_payload_is_source_info_enabled(
344 self.as_ref().to_glib_none().0,
345 ))
346 }
347 }
348
349 /// Push `buffer` to the peer element of the payloader. The SSRC, payload type,
350 /// seqnum and timestamp of the RTP buffer will be updated first.
351 ///
352 /// This function takes ownership of `buffer`.
353 /// ## `buffer`
354 /// a [`gst::Buffer`][crate::gst::Buffer]
355 ///
356 /// # Returns
357 ///
358 /// a [`gst::FlowReturn`][crate::gst::FlowReturn].
359 #[doc(alias = "gst_rtp_base_payload_push")]
360 fn push(&self, buffer: gst::Buffer) -> Result<gst::FlowSuccess, gst::FlowError> {
361 unsafe {
362 try_from_glib(ffi::gst_rtp_base_payload_push(
363 self.as_ref().to_glib_none().0,
364 buffer.into_glib_ptr(),
365 ))
366 }
367 }
368
369 /// Push `list` to the peer element of the payloader. The SSRC, payload type,
370 /// seqnum and timestamp of the RTP buffer will be updated first.
371 ///
372 /// This function takes ownership of `list`.
373 /// ## `list`
374 /// a [`gst::BufferList`][crate::gst::BufferList]
375 ///
376 /// # Returns
377 ///
378 /// a [`gst::FlowReturn`][crate::gst::FlowReturn].
379 #[doc(alias = "gst_rtp_base_payload_push_list")]
380 fn push_list(&self, list: gst::BufferList) -> Result<gst::FlowSuccess, gst::FlowError> {
381 unsafe {
382 try_from_glib(ffi::gst_rtp_base_payload_push_list(
383 self.as_ref().to_glib_none().0,
384 list.into_glib_ptr(),
385 ))
386 }
387 }
388
389 /// Set the rtp options of the payloader. These options will be set in the caps
390 /// of the payloader. Subclasses must call this method before calling
391 /// [`push()`][Self::push()] or `gst_rtp_base_payload_set_outcaps()`.
392 /// ## `media`
393 /// the media type (typically "audio" or "video")
394 /// ## `dynamic`
395 /// if the payload type is dynamic
396 /// ## `encoding_name`
397 /// the encoding name
398 /// ## `clock_rate`
399 /// the clock rate of the media
400 #[doc(alias = "gst_rtp_base_payload_set_options")]
401 fn set_options(&self, media: &str, dynamic: bool, encoding_name: &str, clock_rate: u32) {
402 unsafe {
403 ffi::gst_rtp_base_payload_set_options(
404 self.as_ref().to_glib_none().0,
405 media.to_glib_none().0,
406 dynamic.into_glib(),
407 encoding_name.to_glib_none().0,
408 clock_rate,
409 );
410 }
411 }
412
413 /// Enable or disable adding contributing sources to RTP packets from
414 /// `GstRTPSourceMeta`.
415 /// ## `enable`
416 /// whether to add contributing sources to RTP packets
417 #[cfg(feature = "v1_16")]
418 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
419 #[doc(alias = "gst_rtp_base_payload_set_source_info_enabled")]
420 fn set_source_info_enabled(&self, enable: bool) {
421 unsafe {
422 ffi::gst_rtp_base_payload_set_source_info_enabled(
423 self.as_ref().to_glib_none().0,
424 enable.into_glib(),
425 );
426 }
427 }
428
429 /// If enabled, the payloader will automatically try to enable all the
430 /// RTP header extensions provided in the src caps, saving the application
431 /// the need to handle these extensions manually using the
432 /// GstRTPBasePayload::request-extension: signal.
433 #[cfg(feature = "v1_20")]
434 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
435 #[doc(alias = "auto-header-extension")]
436 fn is_auto_header_extension(&self) -> bool {
437 ObjectExt::property(self.as_ref(), "auto-header-extension")
438 }
439
440 /// If enabled, the payloader will automatically try to enable all the
441 /// RTP header extensions provided in the src caps, saving the application
442 /// the need to handle these extensions manually using the
443 /// GstRTPBasePayload::request-extension: signal.
444 #[cfg(feature = "v1_20")]
445 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
446 #[doc(alias = "auto-header-extension")]
447 fn set_auto_header_extension(&self, auto_header_extension: bool) {
448 ObjectExt::set_property(
449 self.as_ref(),
450 "auto-header-extension",
451 auto_header_extension,
452 )
453 }
454
455 #[doc(alias = "max-ptime")]
456 fn max_ptime(&self) -> i64 {
457 ObjectExt::property(self.as_ref(), "max-ptime")
458 }
459
460 #[doc(alias = "max-ptime")]
461 fn set_max_ptime(&self, max_ptime: i64) {
462 ObjectExt::set_property(self.as_ref(), "max-ptime", max_ptime)
463 }
464
465 /// Minimum duration of the packet data in ns (can't go above MTU)
466 #[doc(alias = "min-ptime")]
467 fn min_ptime(&self) -> i64 {
468 ObjectExt::property(self.as_ref(), "min-ptime")
469 }
470
471 /// Minimum duration of the packet data in ns (can't go above MTU)
472 #[doc(alias = "min-ptime")]
473 fn set_min_ptime(&self, min_ptime: i64) {
474 ObjectExt::set_property(self.as_ref(), "min-ptime", min_ptime)
475 }
476
477 fn mtu(&self) -> u32 {
478 ObjectExt::property(self.as_ref(), "mtu")
479 }
480
481 fn set_mtu(&self, mtu: u32) {
482 ObjectExt::set_property(self.as_ref(), "mtu", mtu)
483 }
484
485 /// Make the payloader timestamp packets according to the Rate-Control=no
486 /// behaviour specified in the ONVIF replay spec.
487 #[cfg(feature = "v1_16")]
488 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
489 #[doc(alias = "onvif-no-rate-control")]
490 fn is_onvif_no_rate_control(&self) -> bool {
491 ObjectExt::property(self.as_ref(), "onvif-no-rate-control")
492 }
493
494 /// Make the payloader timestamp packets according to the Rate-Control=no
495 /// behaviour specified in the ONVIF replay spec.
496 #[cfg(feature = "v1_16")]
497 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
498 #[doc(alias = "onvif-no-rate-control")]
499 fn set_onvif_no_rate_control(&self, onvif_no_rate_control: bool) {
500 ObjectExt::set_property(
501 self.as_ref(),
502 "onvif-no-rate-control",
503 onvif_no_rate_control,
504 )
505 }
506
507 /// Try to use the offset fields to generate perfect RTP timestamps. When this
508 /// option is disabled, RTP timestamps are generated from GST_BUFFER_PTS of
509 /// each payloaded buffer. The PTSes of buffers may not necessarily increment
510 /// with the amount of data in each input buffer, consider e.g. the case where
511 /// the buffer arrives from a network which means that the PTS is unrelated to
512 /// the amount of data. Because the RTP timestamps are generated from
513 /// GST_BUFFER_PTS this can result in RTP timestamps that also don't increment
514 /// with the amount of data in the payloaded packet. To circumvent this it is
515 /// possible to set the perfect rtptime option enabled. When this option is
516 /// enabled the payloader will increment the RTP timestamps based on
517 /// GST_BUFFER_OFFSET which relates to the amount of data in each packet
518 /// rather than the GST_BUFFER_PTS of each buffer and therefore the RTP
519 /// timestamps will more closely correlate with the amount of data in each
520 /// buffer. Currently GstRTPBasePayload is limited to handling perfect RTP
521 /// timestamps for audio streams.
522 #[doc(alias = "perfect-rtptime")]
523 fn is_perfect_rtptime(&self) -> bool {
524 ObjectExt::property(self.as_ref(), "perfect-rtptime")
525 }
526
527 /// Try to use the offset fields to generate perfect RTP timestamps. When this
528 /// option is disabled, RTP timestamps are generated from GST_BUFFER_PTS of
529 /// each payloaded buffer. The PTSes of buffers may not necessarily increment
530 /// with the amount of data in each input buffer, consider e.g. the case where
531 /// the buffer arrives from a network which means that the PTS is unrelated to
532 /// the amount of data. Because the RTP timestamps are generated from
533 /// GST_BUFFER_PTS this can result in RTP timestamps that also don't increment
534 /// with the amount of data in the payloaded packet. To circumvent this it is
535 /// possible to set the perfect rtptime option enabled. When this option is
536 /// enabled the payloader will increment the RTP timestamps based on
537 /// GST_BUFFER_OFFSET which relates to the amount of data in each packet
538 /// rather than the GST_BUFFER_PTS of each buffer and therefore the RTP
539 /// timestamps will more closely correlate with the amount of data in each
540 /// buffer. Currently GstRTPBasePayload is limited to handling perfect RTP
541 /// timestamps for audio streams.
542 #[doc(alias = "perfect-rtptime")]
543 fn set_perfect_rtptime(&self, perfect_rtptime: bool) {
544 ObjectExt::set_property(self.as_ref(), "perfect-rtptime", perfect_rtptime)
545 }
546
547 fn pt(&self) -> u32 {
548 ObjectExt::property(self.as_ref(), "pt")
549 }
550
551 fn set_pt(&self, pt: u32) {
552 ObjectExt::set_property(self.as_ref(), "pt", pt)
553 }
554
555 /// Force buffers to be multiples of this duration in ns (0 disables)
556 #[doc(alias = "ptime-multiple")]
557 fn ptime_multiple(&self) -> i64 {
558 ObjectExt::property(self.as_ref(), "ptime-multiple")
559 }
560
561 /// Force buffers to be multiples of this duration in ns (0 disables)
562 #[doc(alias = "ptime-multiple")]
563 fn set_ptime_multiple(&self, ptime_multiple: i64) {
564 ObjectExt::set_property(self.as_ref(), "ptime-multiple", ptime_multiple)
565 }
566
567 /// Make the RTP packets' timestamps be scaled with the segment's rate
568 /// (corresponding to RTSP speed parameter). Disabling this property means
569 /// the timestamps will not be affected by the set delivery speed (RTSP speed).
570 ///
571 /// Example: A server wants to allow streaming a recorded video in double
572 /// speed but still have the timestamps correspond to the position in the
573 /// video. This is achieved by the client setting RTSP Speed to 2 while the
574 /// server has this property disabled.
575 #[cfg(feature = "v1_18")]
576 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
577 #[doc(alias = "scale-rtptime")]
578 fn is_scale_rtptime(&self) -> bool {
579 ObjectExt::property(self.as_ref(), "scale-rtptime")
580 }
581
582 /// Make the RTP packets' timestamps be scaled with the segment's rate
583 /// (corresponding to RTSP speed parameter). Disabling this property means
584 /// the timestamps will not be affected by the set delivery speed (RTSP speed).
585 ///
586 /// Example: A server wants to allow streaming a recorded video in double
587 /// speed but still have the timestamps correspond to the position in the
588 /// video. This is achieved by the client setting RTSP Speed to 2 while the
589 /// server has this property disabled.
590 #[cfg(feature = "v1_18")]
591 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
592 #[doc(alias = "scale-rtptime")]
593 fn set_scale_rtptime(&self, scale_rtptime: bool) {
594 ObjectExt::set_property(self.as_ref(), "scale-rtptime", scale_rtptime)
595 }
596
597 fn seqnum(&self) -> u32 {
598 ObjectExt::property(self.as_ref(), "seqnum")
599 }
600
601 #[doc(alias = "seqnum-offset")]
602 fn seqnum_offset(&self) -> i32 {
603 ObjectExt::property(self.as_ref(), "seqnum-offset")
604 }
605
606 #[doc(alias = "seqnum-offset")]
607 fn set_seqnum_offset(&self, seqnum_offset: i32) {
608 ObjectExt::set_property(self.as_ref(), "seqnum-offset", seqnum_offset)
609 }
610
611 /// Enable writing the CSRC field in allocated RTP header based on RTP source
612 /// information found in the input buffer's `GstRTPSourceMeta`.
613 #[cfg(feature = "v1_16")]
614 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
615 #[doc(alias = "source-info")]
616 fn is_source_info(&self) -> bool {
617 ObjectExt::property(self.as_ref(), "source-info")
618 }
619
620 /// Enable writing the CSRC field in allocated RTP header based on RTP source
621 /// information found in the input buffer's `GstRTPSourceMeta`.
622 #[cfg(feature = "v1_16")]
623 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
624 #[doc(alias = "source-info")]
625 fn set_source_info(&self, source_info: bool) {
626 ObjectExt::set_property(self.as_ref(), "source-info", source_info)
627 }
628
629 fn ssrc(&self) -> u32 {
630 ObjectExt::property(self.as_ref(), "ssrc")
631 }
632
633 fn set_ssrc(&self, ssrc: u32) {
634 ObjectExt::set_property(self.as_ref(), "ssrc", ssrc)
635 }
636
637 /// Various payloader statistics retrieved atomically (and are therefore
638 /// synchroized with each other), these can be used e.g. to generate an
639 /// RTP-Info header. This property return a GstStructure named
640 /// application/x-rtp-payload-stats containing the following fields relating to
641 /// the last processed buffer and current state of the stream being payloaded:
642 ///
643 /// * `clock-rate` :`G_TYPE_UINT`, clock-rate of the stream
644 /// * `running-time` :`G_TYPE_UINT64`, running time
645 /// * `seqnum` :`G_TYPE_UINT`, sequence number, same as [`seqnum`][struct@crate::RTPBasePayload#seqnum]
646 /// * `timestamp` :`G_TYPE_UINT`, RTP timestamp, same as [`timestamp`][struct@crate::RTPBasePayload#timestamp]
647 /// * `ssrc` :`G_TYPE_UINT`, The SSRC in use
648 /// * `pt` :`G_TYPE_UINT`, The Payload type in use, same as [`pt`][struct@crate::RTPBasePayload#pt]
649 /// * `seqnum-offset` :`G_TYPE_UINT`, The current offset added to the seqnum
650 /// * `timestamp-offset` :`G_TYPE_UINT`, The current offset added to the timestamp
651 fn stats(&self) -> Option<gst::Structure> {
652 ObjectExt::property(self.as_ref(), "stats")
653 }
654
655 fn timestamp(&self) -> u32 {
656 ObjectExt::property(self.as_ref(), "timestamp")
657 }
658
659 #[doc(alias = "timestamp-offset")]
660 fn timestamp_offset(&self) -> u32 {
661 ObjectExt::property(self.as_ref(), "timestamp-offset")
662 }
663
664 #[doc(alias = "timestamp-offset")]
665 fn set_timestamp_offset(&self, timestamp_offset: u32) {
666 ObjectExt::set_property(self.as_ref(), "timestamp-offset", timestamp_offset)
667 }
668
669 /// Add `ext` as an extension for writing part of an RTP header extension onto
670 /// outgoing RTP packets.
671 /// ## `ext`
672 /// the [`RTPHeaderExtension`][crate::RTPHeaderExtension]
673 #[cfg(feature = "v1_20")]
674 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
675 #[doc(alias = "add-extension")]
676 fn connect_add_extension<F: Fn(&Self, &RTPHeaderExtension) + Send + Sync + 'static>(
677 &self,
678 f: F,
679 ) -> SignalHandlerId {
680 unsafe extern "C" fn add_extension_trampoline<
681 P: IsA<RTPBasePayload>,
682 F: Fn(&P, &RTPHeaderExtension) + Send + Sync + 'static,
683 >(
684 this: *mut ffi::GstRTPBasePayload,
685 ext: *mut ffi::GstRTPHeaderExtension,
686 f: glib::ffi::gpointer,
687 ) {
688 let f: &F = &*(f as *const F);
689 f(
690 RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref(),
691 &from_glib_full(ext),
692 )
693 }
694 unsafe {
695 let f: Box_<F> = Box_::new(f);
696 connect_raw(
697 self.as_ptr() as *mut _,
698 c"add-extension".as_ptr() as *const _,
699 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
700 add_extension_trampoline::<Self, F> as *const (),
701 )),
702 Box_::into_raw(f),
703 )
704 }
705 }
706
707 #[cfg(feature = "v1_20")]
708 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
709 fn emit_add_extension(&self, ext: &RTPHeaderExtension) {
710 self.emit_by_name::<()>("add-extension", &[&ext]);
711 }
712
713 /// Clear all RTP header extensions used by this payloader.
714 #[cfg(feature = "v1_20")]
715 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
716 #[doc(alias = "clear-extensions")]
717 fn connect_clear_extensions<F: Fn(&Self) + Send + Sync + 'static>(
718 &self,
719 f: F,
720 ) -> SignalHandlerId {
721 unsafe extern "C" fn clear_extensions_trampoline<
722 P: IsA<RTPBasePayload>,
723 F: Fn(&P) + Send + Sync + 'static,
724 >(
725 this: *mut ffi::GstRTPBasePayload,
726 f: glib::ffi::gpointer,
727 ) {
728 let f: &F = &*(f as *const F);
729 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
730 }
731 unsafe {
732 let f: Box_<F> = Box_::new(f);
733 connect_raw(
734 self.as_ptr() as *mut _,
735 c"clear-extensions".as_ptr() as *const _,
736 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
737 clear_extensions_trampoline::<Self, 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 fn emit_clear_extensions(&self) {
747 self.emit_by_name::<()>("clear-extensions", &[]);
748 }
749
750 /// The returned `ext` must be configured with the correct `ext_id` and with the
751 /// necessary attributes as required by the extension implementation.
752 /// ## `ext_id`
753 /// the extension id being requested
754 /// ## `ext_uri`
755 /// the extension URI being requested
756 ///
757 /// # Returns
758 ///
759 /// the [`RTPHeaderExtension`][crate::RTPHeaderExtension] for `ext_id`, or [`None`]
760 #[cfg(feature = "v1_20")]
761 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
762 #[doc(alias = "request-extension")]
763 fn connect_request_extension<
764 F: Fn(&Self, u32, &str) -> Option<RTPHeaderExtension> + Send + Sync + 'static,
765 >(
766 &self,
767 f: F,
768 ) -> SignalHandlerId {
769 unsafe extern "C" fn request_extension_trampoline<
770 P: IsA<RTPBasePayload>,
771 F: Fn(&P, u32, &str) -> Option<RTPHeaderExtension> + Send + Sync + 'static,
772 >(
773 this: *mut ffi::GstRTPBasePayload,
774 ext_id: std::ffi::c_uint,
775 ext_uri: *mut std::ffi::c_char,
776 f: glib::ffi::gpointer,
777 ) -> *mut ffi::GstRTPHeaderExtension {
778 let f: &F = &*(f as *const F);
779 f(
780 RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref(),
781 ext_id,
782 &glib::GString::from_glib_borrow(ext_uri),
783 )
784 .to_glib_full()
785 }
786 unsafe {
787 let f: Box_<F> = Box_::new(f);
788 connect_raw(
789 self.as_ptr() as *mut _,
790 c"request-extension".as_ptr() as *const _,
791 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
792 request_extension_trampoline::<Self, F> as *const (),
793 )),
794 Box_::into_raw(f),
795 )
796 }
797 }
798
799 #[cfg(feature = "v1_20")]
800 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
801 #[doc(alias = "auto-header-extension")]
802 fn connect_auto_header_extension_notify<F: Fn(&Self) + Send + Sync + 'static>(
803 &self,
804 f: F,
805 ) -> SignalHandlerId {
806 unsafe extern "C" fn notify_auto_header_extension_trampoline<
807 P: IsA<RTPBasePayload>,
808 F: Fn(&P) + Send + Sync + 'static,
809 >(
810 this: *mut ffi::GstRTPBasePayload,
811 _param_spec: glib::ffi::gpointer,
812 f: glib::ffi::gpointer,
813 ) {
814 let f: &F = &*(f as *const F);
815 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
816 }
817 unsafe {
818 let f: Box_<F> = Box_::new(f);
819 connect_raw(
820 self.as_ptr() as *mut _,
821 c"notify::auto-header-extension".as_ptr() as *const _,
822 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
823 notify_auto_header_extension_trampoline::<Self, F> as *const (),
824 )),
825 Box_::into_raw(f),
826 )
827 }
828 }
829
830 #[doc(alias = "max-ptime")]
831 fn connect_max_ptime_notify<F: Fn(&Self) + Send + Sync + 'static>(
832 &self,
833 f: F,
834 ) -> SignalHandlerId {
835 unsafe extern "C" fn notify_max_ptime_trampoline<
836 P: IsA<RTPBasePayload>,
837 F: Fn(&P) + Send + Sync + 'static,
838 >(
839 this: *mut ffi::GstRTPBasePayload,
840 _param_spec: glib::ffi::gpointer,
841 f: glib::ffi::gpointer,
842 ) {
843 let f: &F = &*(f as *const F);
844 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
845 }
846 unsafe {
847 let f: Box_<F> = Box_::new(f);
848 connect_raw(
849 self.as_ptr() as *mut _,
850 c"notify::max-ptime".as_ptr() as *const _,
851 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
852 notify_max_ptime_trampoline::<Self, F> as *const (),
853 )),
854 Box_::into_raw(f),
855 )
856 }
857 }
858
859 #[doc(alias = "min-ptime")]
860 fn connect_min_ptime_notify<F: Fn(&Self) + Send + Sync + 'static>(
861 &self,
862 f: F,
863 ) -> SignalHandlerId {
864 unsafe extern "C" fn notify_min_ptime_trampoline<
865 P: IsA<RTPBasePayload>,
866 F: Fn(&P) + Send + Sync + 'static,
867 >(
868 this: *mut ffi::GstRTPBasePayload,
869 _param_spec: glib::ffi::gpointer,
870 f: glib::ffi::gpointer,
871 ) {
872 let f: &F = &*(f as *const F);
873 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
874 }
875 unsafe {
876 let f: Box_<F> = Box_::new(f);
877 connect_raw(
878 self.as_ptr() as *mut _,
879 c"notify::min-ptime".as_ptr() as *const _,
880 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
881 notify_min_ptime_trampoline::<Self, F> as *const (),
882 )),
883 Box_::into_raw(f),
884 )
885 }
886 }
887
888 #[doc(alias = "mtu")]
889 fn connect_mtu_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
890 unsafe extern "C" fn notify_mtu_trampoline<
891 P: IsA<RTPBasePayload>,
892 F: Fn(&P) + Send + Sync + 'static,
893 >(
894 this: *mut ffi::GstRTPBasePayload,
895 _param_spec: glib::ffi::gpointer,
896 f: glib::ffi::gpointer,
897 ) {
898 let f: &F = &*(f as *const F);
899 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
900 }
901 unsafe {
902 let f: Box_<F> = Box_::new(f);
903 connect_raw(
904 self.as_ptr() as *mut _,
905 c"notify::mtu".as_ptr() as *const _,
906 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
907 notify_mtu_trampoline::<Self, F> as *const (),
908 )),
909 Box_::into_raw(f),
910 )
911 }
912 }
913
914 #[cfg(feature = "v1_16")]
915 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
916 #[doc(alias = "onvif-no-rate-control")]
917 fn connect_onvif_no_rate_control_notify<F: Fn(&Self) + Send + Sync + 'static>(
918 &self,
919 f: F,
920 ) -> SignalHandlerId {
921 unsafe extern "C" fn notify_onvif_no_rate_control_trampoline<
922 P: IsA<RTPBasePayload>,
923 F: Fn(&P) + Send + Sync + 'static,
924 >(
925 this: *mut ffi::GstRTPBasePayload,
926 _param_spec: glib::ffi::gpointer,
927 f: glib::ffi::gpointer,
928 ) {
929 let f: &F = &*(f as *const F);
930 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
931 }
932 unsafe {
933 let f: Box_<F> = Box_::new(f);
934 connect_raw(
935 self.as_ptr() as *mut _,
936 c"notify::onvif-no-rate-control".as_ptr() as *const _,
937 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
938 notify_onvif_no_rate_control_trampoline::<Self, F> as *const (),
939 )),
940 Box_::into_raw(f),
941 )
942 }
943 }
944
945 #[doc(alias = "perfect-rtptime")]
946 fn connect_perfect_rtptime_notify<F: Fn(&Self) + Send + Sync + 'static>(
947 &self,
948 f: F,
949 ) -> SignalHandlerId {
950 unsafe extern "C" fn notify_perfect_rtptime_trampoline<
951 P: IsA<RTPBasePayload>,
952 F: Fn(&P) + Send + Sync + 'static,
953 >(
954 this: *mut ffi::GstRTPBasePayload,
955 _param_spec: glib::ffi::gpointer,
956 f: glib::ffi::gpointer,
957 ) {
958 let f: &F = &*(f as *const F);
959 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
960 }
961 unsafe {
962 let f: Box_<F> = Box_::new(f);
963 connect_raw(
964 self.as_ptr() as *mut _,
965 c"notify::perfect-rtptime".as_ptr() as *const _,
966 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
967 notify_perfect_rtptime_trampoline::<Self, F> as *const (),
968 )),
969 Box_::into_raw(f),
970 )
971 }
972 }
973
974 #[doc(alias = "pt")]
975 fn connect_pt_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
976 unsafe extern "C" fn notify_pt_trampoline<
977 P: IsA<RTPBasePayload>,
978 F: Fn(&P) + Send + Sync + 'static,
979 >(
980 this: *mut ffi::GstRTPBasePayload,
981 _param_spec: glib::ffi::gpointer,
982 f: glib::ffi::gpointer,
983 ) {
984 let f: &F = &*(f as *const F);
985 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
986 }
987 unsafe {
988 let f: Box_<F> = Box_::new(f);
989 connect_raw(
990 self.as_ptr() as *mut _,
991 c"notify::pt".as_ptr() as *const _,
992 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
993 notify_pt_trampoline::<Self, F> as *const (),
994 )),
995 Box_::into_raw(f),
996 )
997 }
998 }
999
1000 #[doc(alias = "ptime-multiple")]
1001 fn connect_ptime_multiple_notify<F: Fn(&Self) + Send + Sync + 'static>(
1002 &self,
1003 f: F,
1004 ) -> SignalHandlerId {
1005 unsafe extern "C" fn notify_ptime_multiple_trampoline<
1006 P: IsA<RTPBasePayload>,
1007 F: Fn(&P) + Send + Sync + 'static,
1008 >(
1009 this: *mut ffi::GstRTPBasePayload,
1010 _param_spec: glib::ffi::gpointer,
1011 f: glib::ffi::gpointer,
1012 ) {
1013 let f: &F = &*(f as *const F);
1014 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
1015 }
1016 unsafe {
1017 let f: Box_<F> = Box_::new(f);
1018 connect_raw(
1019 self.as_ptr() as *mut _,
1020 c"notify::ptime-multiple".as_ptr() as *const _,
1021 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1022 notify_ptime_multiple_trampoline::<Self, F> as *const (),
1023 )),
1024 Box_::into_raw(f),
1025 )
1026 }
1027 }
1028
1029 #[cfg(feature = "v1_18")]
1030 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
1031 #[doc(alias = "scale-rtptime")]
1032 fn connect_scale_rtptime_notify<F: Fn(&Self) + Send + Sync + 'static>(
1033 &self,
1034 f: F,
1035 ) -> SignalHandlerId {
1036 unsafe extern "C" fn notify_scale_rtptime_trampoline<
1037 P: IsA<RTPBasePayload>,
1038 F: Fn(&P) + Send + Sync + 'static,
1039 >(
1040 this: *mut ffi::GstRTPBasePayload,
1041 _param_spec: glib::ffi::gpointer,
1042 f: glib::ffi::gpointer,
1043 ) {
1044 let f: &F = &*(f as *const F);
1045 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
1046 }
1047 unsafe {
1048 let f: Box_<F> = Box_::new(f);
1049 connect_raw(
1050 self.as_ptr() as *mut _,
1051 c"notify::scale-rtptime".as_ptr() as *const _,
1052 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1053 notify_scale_rtptime_trampoline::<Self, F> as *const (),
1054 )),
1055 Box_::into_raw(f),
1056 )
1057 }
1058 }
1059
1060 #[doc(alias = "seqnum")]
1061 fn connect_seqnum_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
1062 unsafe extern "C" fn notify_seqnum_trampoline<
1063 P: IsA<RTPBasePayload>,
1064 F: Fn(&P) + Send + Sync + 'static,
1065 >(
1066 this: *mut ffi::GstRTPBasePayload,
1067 _param_spec: glib::ffi::gpointer,
1068 f: glib::ffi::gpointer,
1069 ) {
1070 let f: &F = &*(f as *const F);
1071 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
1072 }
1073 unsafe {
1074 let f: Box_<F> = Box_::new(f);
1075 connect_raw(
1076 self.as_ptr() as *mut _,
1077 c"notify::seqnum".as_ptr() as *const _,
1078 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1079 notify_seqnum_trampoline::<Self, F> as *const (),
1080 )),
1081 Box_::into_raw(f),
1082 )
1083 }
1084 }
1085
1086 #[doc(alias = "seqnum-offset")]
1087 fn connect_seqnum_offset_notify<F: Fn(&Self) + Send + Sync + 'static>(
1088 &self,
1089 f: F,
1090 ) -> SignalHandlerId {
1091 unsafe extern "C" fn notify_seqnum_offset_trampoline<
1092 P: IsA<RTPBasePayload>,
1093 F: Fn(&P) + Send + Sync + 'static,
1094 >(
1095 this: *mut ffi::GstRTPBasePayload,
1096 _param_spec: glib::ffi::gpointer,
1097 f: glib::ffi::gpointer,
1098 ) {
1099 let f: &F = &*(f as *const F);
1100 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
1101 }
1102 unsafe {
1103 let f: Box_<F> = Box_::new(f);
1104 connect_raw(
1105 self.as_ptr() as *mut _,
1106 c"notify::seqnum-offset".as_ptr() as *const _,
1107 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1108 notify_seqnum_offset_trampoline::<Self, F> as *const (),
1109 )),
1110 Box_::into_raw(f),
1111 )
1112 }
1113 }
1114
1115 #[cfg(feature = "v1_16")]
1116 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
1117 #[doc(alias = "source-info")]
1118 fn connect_source_info_notify<F: Fn(&Self) + Send + Sync + 'static>(
1119 &self,
1120 f: F,
1121 ) -> SignalHandlerId {
1122 unsafe extern "C" fn notify_source_info_trampoline<
1123 P: IsA<RTPBasePayload>,
1124 F: Fn(&P) + Send + Sync + 'static,
1125 >(
1126 this: *mut ffi::GstRTPBasePayload,
1127 _param_spec: glib::ffi::gpointer,
1128 f: glib::ffi::gpointer,
1129 ) {
1130 let f: &F = &*(f as *const F);
1131 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
1132 }
1133 unsafe {
1134 let f: Box_<F> = Box_::new(f);
1135 connect_raw(
1136 self.as_ptr() as *mut _,
1137 c"notify::source-info".as_ptr() as *const _,
1138 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1139 notify_source_info_trampoline::<Self, F> as *const (),
1140 )),
1141 Box_::into_raw(f),
1142 )
1143 }
1144 }
1145
1146 #[doc(alias = "ssrc")]
1147 fn connect_ssrc_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
1148 unsafe extern "C" fn notify_ssrc_trampoline<
1149 P: IsA<RTPBasePayload>,
1150 F: Fn(&P) + Send + Sync + 'static,
1151 >(
1152 this: *mut ffi::GstRTPBasePayload,
1153 _param_spec: glib::ffi::gpointer,
1154 f: glib::ffi::gpointer,
1155 ) {
1156 let f: &F = &*(f as *const F);
1157 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
1158 }
1159 unsafe {
1160 let f: Box_<F> = Box_::new(f);
1161 connect_raw(
1162 self.as_ptr() as *mut _,
1163 c"notify::ssrc".as_ptr() as *const _,
1164 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1165 notify_ssrc_trampoline::<Self, F> as *const (),
1166 )),
1167 Box_::into_raw(f),
1168 )
1169 }
1170 }
1171
1172 #[doc(alias = "stats")]
1173 fn connect_stats_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
1174 unsafe extern "C" fn notify_stats_trampoline<
1175 P: IsA<RTPBasePayload>,
1176 F: Fn(&P) + Send + Sync + 'static,
1177 >(
1178 this: *mut ffi::GstRTPBasePayload,
1179 _param_spec: glib::ffi::gpointer,
1180 f: glib::ffi::gpointer,
1181 ) {
1182 let f: &F = &*(f as *const F);
1183 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
1184 }
1185 unsafe {
1186 let f: Box_<F> = Box_::new(f);
1187 connect_raw(
1188 self.as_ptr() as *mut _,
1189 c"notify::stats".as_ptr() as *const _,
1190 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1191 notify_stats_trampoline::<Self, F> as *const (),
1192 )),
1193 Box_::into_raw(f),
1194 )
1195 }
1196 }
1197
1198 #[doc(alias = "timestamp")]
1199 fn connect_timestamp_notify<F: Fn(&Self) + Send + Sync + 'static>(
1200 &self,
1201 f: F,
1202 ) -> SignalHandlerId {
1203 unsafe extern "C" fn notify_timestamp_trampoline<
1204 P: IsA<RTPBasePayload>,
1205 F: Fn(&P) + Send + Sync + 'static,
1206 >(
1207 this: *mut ffi::GstRTPBasePayload,
1208 _param_spec: glib::ffi::gpointer,
1209 f: glib::ffi::gpointer,
1210 ) {
1211 let f: &F = &*(f as *const F);
1212 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
1213 }
1214 unsafe {
1215 let f: Box_<F> = Box_::new(f);
1216 connect_raw(
1217 self.as_ptr() as *mut _,
1218 c"notify::timestamp".as_ptr() as *const _,
1219 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1220 notify_timestamp_trampoline::<Self, F> as *const (),
1221 )),
1222 Box_::into_raw(f),
1223 )
1224 }
1225 }
1226
1227 #[doc(alias = "timestamp-offset")]
1228 fn connect_timestamp_offset_notify<F: Fn(&Self) + Send + Sync + 'static>(
1229 &self,
1230 f: F,
1231 ) -> SignalHandlerId {
1232 unsafe extern "C" fn notify_timestamp_offset_trampoline<
1233 P: IsA<RTPBasePayload>,
1234 F: Fn(&P) + Send + Sync + 'static,
1235 >(
1236 this: *mut ffi::GstRTPBasePayload,
1237 _param_spec: glib::ffi::gpointer,
1238 f: glib::ffi::gpointer,
1239 ) {
1240 let f: &F = &*(f as *const F);
1241 f(RTPBasePayload::from_glib_borrow(this).unsafe_cast_ref())
1242 }
1243 unsafe {
1244 let f: Box_<F> = Box_::new(f);
1245 connect_raw(
1246 self.as_ptr() as *mut _,
1247 c"notify::timestamp-offset".as_ptr() as *const _,
1248 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1249 notify_timestamp_offset_trampoline::<Self, F> as *const (),
1250 )),
1251 Box_::into_raw(f),
1252 )
1253 }
1254 }
1255}
1256
1257impl<O: IsA<RTPBasePayload>> RTPBasePayloadExt for O {}