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