gstreamer_rtsp_server/auto/
rtsp_stream.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::{
7    ffi, RTSPAddress, RTSPAddressPool, RTSPFilterResult, RTSPPublishClockMode, RTSPStreamTransport,
8};
9use glib::{
10    object::ObjectType as _,
11    prelude::*,
12    signal::{connect_raw, SignalHandlerId},
13    translate::*,
14};
15use std::boxed::Box as Box_;
16
17glib::wrapper! {
18    /// The definition of a media stream.
19    ///
20    /// ## Properties
21    ///
22    ///
23    /// #### `control`
24    ///  Readable | Writeable
25    ///
26    ///
27    /// #### `profiles`
28    ///  Readable | Writeable
29    ///
30    ///
31    /// #### `protocols`
32    ///  Readable | Writeable
33    ///
34    /// ## Signals
35    ///
36    ///
37    /// #### `new-rtcp-encoder`
38    ///
39    ///
40    ///
41    /// #### `new-rtp-encoder`
42    ///
43    ///
44    ///
45    /// #### `new-rtp-rtcp-decoder`
46    ///
47    ///
48    /// # Implements
49    ///
50    /// [`RTSPStreamExt`][trait@crate::prelude::RTSPStreamExt], [`trait@glib::ObjectExt`]
51    #[doc(alias = "GstRTSPStream")]
52    pub struct RTSPStream(Object<ffi::GstRTSPStream, ffi::GstRTSPStreamClass>);
53
54    match fn {
55        type_ => || ffi::gst_rtsp_stream_get_type(),
56    }
57}
58
59impl RTSPStream {
60    pub const NONE: Option<&'static RTSPStream> = None;
61
62    /// Create a new media stream with index `idx` that handles RTP data on
63    /// `pad` and has a payloader element `payloader` if `pad` is a source pad
64    /// or a depayloader element `payloader` if `pad` is a sink pad.
65    /// ## `idx`
66    /// an index
67    /// ## `payloader`
68    /// a [`gst::Element`][crate::gst::Element]
69    /// ## `pad`
70    /// a [`gst::Pad`][crate::gst::Pad]
71    ///
72    /// # Returns
73    ///
74    /// a new [`RTSPStream`][crate::RTSPStream]
75    #[doc(alias = "gst_rtsp_stream_new")]
76    pub fn new(
77        idx: u32,
78        payloader: &impl IsA<gst::Element>,
79        pad: &impl IsA<gst::Pad>,
80    ) -> RTSPStream {
81        assert_initialized_main_thread!();
82        unsafe {
83            from_glib_full(ffi::gst_rtsp_stream_new(
84                idx,
85                payloader.as_ref().to_glib_none().0,
86                pad.as_ref().to_glib_none().0,
87            ))
88        }
89    }
90}
91
92unsafe impl Send for RTSPStream {}
93unsafe impl Sync for RTSPStream {}
94
95mod sealed {
96    pub trait Sealed {}
97    impl<T: super::IsA<super::RTSPStream>> Sealed for T {}
98}
99
100/// Trait containing all [`struct@RTSPStream`] methods.
101///
102/// # Implementors
103///
104/// [`RTSPStream`][struct@crate::RTSPStream]
105pub trait RTSPStreamExt: IsA<RTSPStream> + sealed::Sealed + 'static {
106    /// Add multicast client address to stream. At this point, the sockets that
107    /// will stream RTP and RTCP data to `destination` are supposed to be
108    /// allocated.
109    /// ## `destination`
110    /// a multicast address to add
111    /// ## `rtp_port`
112    /// RTP port
113    /// ## `rtcp_port`
114    /// RTCP port
115    /// ## `family`
116    /// socket family
117    ///
118    /// # Returns
119    ///
120    /// [`true`] if `destination` can be addedd and handled by `self`.
121    #[cfg(feature = "v1_16")]
122    #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
123    #[doc(alias = "gst_rtsp_stream_add_multicast_client_address")]
124    fn add_multicast_client_address(
125        &self,
126        destination: &str,
127        rtp_port: u32,
128        rtcp_port: u32,
129        family: gio::SocketFamily,
130    ) -> bool {
131        unsafe {
132            from_glib(ffi::gst_rtsp_stream_add_multicast_client_address(
133                self.as_ref().to_glib_none().0,
134                destination.to_glib_none().0,
135                rtp_port,
136                rtcp_port,
137                family.into_glib(),
138            ))
139        }
140    }
141
142    /// Add the transport in `trans` to `self`. The media of `self` will
143    /// then also be send to the values configured in `trans`. Adding the
144    /// same transport twice will not add it a second time.
145    ///
146    /// `self` must be joined to a bin.
147    ///
148    /// `trans` must contain a valid `GstRTSPTransport`.
149    /// ## `trans`
150    /// a [`RTSPStreamTransport`][crate::RTSPStreamTransport]
151    ///
152    /// # Returns
153    ///
154    /// [`true`] if `trans` was added
155    #[doc(alias = "gst_rtsp_stream_add_transport")]
156    fn add_transport(
157        &self,
158        trans: &impl IsA<RTSPStreamTransport>,
159    ) -> Result<(), glib::error::BoolError> {
160        unsafe {
161            glib::result_from_gboolean!(
162                ffi::gst_rtsp_stream_add_transport(
163                    self.as_ref().to_glib_none().0,
164                    trans.as_ref().to_glib_none().0
165                ),
166                "Failed to add transport"
167            )
168        }
169    }
170
171    //#[doc(alias = "gst_rtsp_stream_allocate_udp_sockets")]
172    //fn allocate_udp_sockets(&self, family: gio::SocketFamily, transport: /*Ignored*/&mut gst_rtsp::RTSPTransport, use_client_settings: bool) -> bool {
173    //    unsafe { TODO: call ffi:gst_rtsp_stream_allocate_udp_sockets() }
174    //}
175
176    //#[doc(alias = "gst_rtsp_stream_complete_stream")]
177    //fn complete_stream(&self, transport: /*Ignored*/&gst_rtsp::RTSPTransport) -> bool {
178    //    unsafe { TODO: call ffi:gst_rtsp_stream_complete_stream() }
179    //}
180
181    /// Get the [`RTSPAddressPool`][crate::RTSPAddressPool] used as the address pool of `self`.
182    ///
183    /// # Returns
184    ///
185    /// the [`RTSPAddressPool`][crate::RTSPAddressPool] of `self`.
186    /// `g_object_unref()` after usage.
187    #[doc(alias = "gst_rtsp_stream_get_address_pool")]
188    #[doc(alias = "get_address_pool")]
189    fn address_pool(&self) -> Option<RTSPAddressPool> {
190        unsafe {
191            from_glib_full(ffi::gst_rtsp_stream_get_address_pool(
192                self.as_ref().to_glib_none().0,
193            ))
194        }
195    }
196
197    /// Get the size of the UDP transmission buffer (in bytes)
198    ///
199    /// # Returns
200    ///
201    /// the size of the UDP TX buffer
202    #[doc(alias = "gst_rtsp_stream_get_buffer_size")]
203    #[doc(alias = "get_buffer_size")]
204    fn buffer_size(&self) -> u32 {
205        unsafe { ffi::gst_rtsp_stream_get_buffer_size(self.as_ref().to_glib_none().0) }
206    }
207
208    /// Retrieve the current caps of `self`.
209    ///
210    /// # Returns
211    ///
212    /// the [`gst::Caps`][crate::gst::Caps] of `self`.
213    /// use `gst_caps_unref()` after usage.
214    #[doc(alias = "gst_rtsp_stream_get_caps")]
215    #[doc(alias = "get_caps")]
216    fn caps(&self) -> Option<gst::Caps> {
217        unsafe {
218            from_glib_full(ffi::gst_rtsp_stream_get_caps(
219                self.as_ref().to_glib_none().0,
220            ))
221        }
222    }
223
224    /// Get the control string to identify this stream.
225    ///
226    /// # Returns
227    ///
228    /// the control string. `g_free()` after usage.
229    #[doc(alias = "gst_rtsp_stream_get_control")]
230    #[doc(alias = "get_control")]
231    fn control(&self) -> Option<glib::GString> {
232        unsafe {
233            from_glib_full(ffi::gst_rtsp_stream_get_control(
234                self.as_ref().to_glib_none().0,
235            ))
236        }
237    }
238
239    #[doc(alias = "gst_rtsp_stream_get_current_seqnum")]
240    #[doc(alias = "get_current_seqnum")]
241    fn current_seqnum(&self) -> u16 {
242        unsafe { ffi::gst_rtsp_stream_get_current_seqnum(self.as_ref().to_glib_none().0) }
243    }
244
245    /// Get the configured DSCP QoS in of the outgoing sockets.
246    ///
247    /// # Returns
248    ///
249    /// the DSCP QoS value of the outgoing sockets, or -1 if disbled.
250    #[doc(alias = "gst_rtsp_stream_get_dscp_qos")]
251    #[doc(alias = "get_dscp_qos")]
252    fn dscp_qos(&self) -> i32 {
253        unsafe { ffi::gst_rtsp_stream_get_dscp_qos(self.as_ref().to_glib_none().0) }
254    }
255
256    /// Get the stream index.
257    ///
258    /// # Returns
259    ///
260    /// the stream index.
261    #[doc(alias = "gst_rtsp_stream_get_index")]
262    #[doc(alias = "get_index")]
263    fn index(&self) -> u32 {
264        unsafe { ffi::gst_rtsp_stream_get_index(self.as_ref().to_glib_none().0) }
265    }
266
267    /// Get the previous joined bin with [`join_bin()`][Self::join_bin()] or NULL.
268    ///
269    /// # Returns
270    ///
271    /// the joined bin or NULL.
272    #[doc(alias = "gst_rtsp_stream_get_joined_bin")]
273    #[doc(alias = "get_joined_bin")]
274    fn joined_bin(&self) -> Option<gst::Bin> {
275        unsafe {
276            from_glib_full(ffi::gst_rtsp_stream_get_joined_bin(
277                self.as_ref().to_glib_none().0,
278            ))
279        }
280    }
281
282    /// Get the the maximum time-to-live value of outgoing multicast packets.
283    ///
284    /// # Returns
285    ///
286    /// the maximum time-to-live value of outgoing multicast packets.
287    #[cfg(feature = "v1_16")]
288    #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
289    #[doc(alias = "gst_rtsp_stream_get_max_mcast_ttl")]
290    #[doc(alias = "get_max_mcast_ttl")]
291    fn max_mcast_ttl(&self) -> u32 {
292        unsafe { ffi::gst_rtsp_stream_get_max_mcast_ttl(self.as_ref().to_glib_none().0) }
293    }
294
295    /// Get the configured MTU in the payloader of `self`.
296    ///
297    /// # Returns
298    ///
299    /// the MTU of the payloader.
300    #[doc(alias = "gst_rtsp_stream_get_mtu")]
301    #[doc(alias = "get_mtu")]
302    fn mtu(&self) -> u32 {
303        unsafe { ffi::gst_rtsp_stream_get_mtu(self.as_ref().to_glib_none().0) }
304    }
305
306    /// Get the multicast address of `self` for `family`. The original
307    /// [`RTSPAddress`][crate::RTSPAddress] is cached and copy is returned, so freeing the return value
308    /// won't release the address from the pool.
309    /// ## `family`
310    /// the [`gio::SocketFamily`][crate::gio::SocketFamily]
311    ///
312    /// # Returns
313    ///
314    /// the [`RTSPAddress`][crate::RTSPAddress] of `self`
315    /// or [`None`] when no address could be allocated. `gst_rtsp_address_free()`
316    /// after usage.
317    #[doc(alias = "gst_rtsp_stream_get_multicast_address")]
318    #[doc(alias = "get_multicast_address")]
319    fn multicast_address(&self, family: gio::SocketFamily) -> Option<RTSPAddress> {
320        unsafe {
321            from_glib_full(ffi::gst_rtsp_stream_get_multicast_address(
322                self.as_ref().to_glib_none().0,
323                family.into_glib(),
324            ))
325        }
326    }
327
328    /// Get all multicast client addresses that RTP data will be sent to
329    ///
330    /// # Returns
331    ///
332    /// A comma separated list of host:port pairs with destinations
333    #[cfg(feature = "v1_16")]
334    #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
335    #[doc(alias = "gst_rtsp_stream_get_multicast_client_addresses")]
336    #[doc(alias = "get_multicast_client_addresses")]
337    fn multicast_client_addresses(&self) -> glib::GString {
338        unsafe {
339            from_glib_full(ffi::gst_rtsp_stream_get_multicast_client_addresses(
340                self.as_ref().to_glib_none().0,
341            ))
342        }
343    }
344
345    /// Get the multicast interface used for `self`.
346    ///
347    /// # Returns
348    ///
349    /// the multicast interface for `self`.
350    /// `g_free()` after usage.
351    #[doc(alias = "gst_rtsp_stream_get_multicast_iface")]
352    #[doc(alias = "get_multicast_iface")]
353    fn multicast_iface(&self) -> Option<glib::GString> {
354        unsafe {
355            from_glib_full(ffi::gst_rtsp_stream_get_multicast_iface(
356                self.as_ref().to_glib_none().0,
357            ))
358        }
359    }
360
361    /// Get the allowed profiles of `self`.
362    ///
363    /// # Returns
364    ///
365    /// a [`gst_rtsp::RTSPProfile`][crate::gst_rtsp::RTSPProfile]
366    #[doc(alias = "gst_rtsp_stream_get_profiles")]
367    #[doc(alias = "get_profiles")]
368    fn profiles(&self) -> gst_rtsp::RTSPProfile {
369        unsafe {
370            from_glib(ffi::gst_rtsp_stream_get_profiles(
371                self.as_ref().to_glib_none().0,
372            ))
373        }
374    }
375
376    /// Get the allowed protocols of `self`.
377    ///
378    /// # Returns
379    ///
380    /// a [`gst_rtsp::RTSPLowerTrans`][crate::gst_rtsp::RTSPLowerTrans]
381    #[doc(alias = "gst_rtsp_stream_get_protocols")]
382    #[doc(alias = "get_protocols")]
383    fn protocols(&self) -> gst_rtsp::RTSPLowerTrans {
384        unsafe {
385            from_glib(ffi::gst_rtsp_stream_get_protocols(
386                self.as_ref().to_glib_none().0,
387            ))
388        }
389    }
390
391    /// Get the stream payload type.
392    ///
393    /// # Returns
394    ///
395    /// the stream payload type.
396    #[doc(alias = "gst_rtsp_stream_get_pt")]
397    #[doc(alias = "get_pt")]
398    fn pt(&self) -> u32 {
399        unsafe { ffi::gst_rtsp_stream_get_pt(self.as_ref().to_glib_none().0) }
400    }
401
402    /// Gets if and how the stream clock should be published according to RFC7273.
403    ///
404    /// # Returns
405    ///
406    /// The GstRTSPPublishClockMode
407    #[doc(alias = "gst_rtsp_stream_get_publish_clock_mode")]
408    #[doc(alias = "get_publish_clock_mode")]
409    fn publish_clock_mode(&self) -> RTSPPublishClockMode {
410        unsafe {
411            from_glib(ffi::gst_rtsp_stream_get_publish_clock_mode(
412                self.as_ref().to_glib_none().0,
413            ))
414        }
415    }
416
417    ///
418    /// # Returns
419    ///
420    /// whether `self` will follow the Rate-Control=no behaviour as specified
421    /// in the ONVIF replay spec.
422    #[cfg(feature = "v1_18")]
423    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
424    #[doc(alias = "gst_rtsp_stream_get_rate_control")]
425    #[doc(alias = "get_rate_control")]
426    fn is_rate_control(&self) -> bool {
427        unsafe {
428            from_glib(ffi::gst_rtsp_stream_get_rate_control(
429                self.as_ref().to_glib_none().0,
430            ))
431        }
432    }
433
434    /// Retrieve the current rate and/or applied_rate.
435    ///
436    /// # Returns
437    ///
438    /// [`true`] if rate and/or applied_rate could be determined.
439    ///
440    /// ## `rate`
441    /// the configured rate
442    ///
443    /// ## `applied_rate`
444    /// the configured applied_rate
445    #[cfg(feature = "v1_18")]
446    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
447    #[doc(alias = "gst_rtsp_stream_get_rates")]
448    #[doc(alias = "get_rates")]
449    fn rates(&self) -> Option<(f64, f64)> {
450        unsafe {
451            let mut rate = std::mem::MaybeUninit::uninit();
452            let mut applied_rate = std::mem::MaybeUninit::uninit();
453            let ret = from_glib(ffi::gst_rtsp_stream_get_rates(
454                self.as_ref().to_glib_none().0,
455                rate.as_mut_ptr(),
456                applied_rate.as_mut_ptr(),
457            ));
458            if ret {
459                Some((rate.assume_init(), applied_rate.assume_init()))
460            } else {
461                None
462            }
463        }
464    }
465
466    /// Get the payload-type used for retransmission of this stream
467    ///
468    /// # Returns
469    ///
470    /// The retransmission PT.
471    #[doc(alias = "gst_rtsp_stream_get_retransmission_pt")]
472    #[doc(alias = "get_retransmission_pt")]
473    fn retransmission_pt(&self) -> u32 {
474        unsafe { ffi::gst_rtsp_stream_get_retransmission_pt(self.as_ref().to_glib_none().0) }
475    }
476
477    /// Get the amount of time to store retransmission data.
478    ///
479    /// # Returns
480    ///
481    /// the amount of time to store retransmission data.
482    #[doc(alias = "gst_rtsp_stream_get_retransmission_time")]
483    #[doc(alias = "get_retransmission_time")]
484    fn retransmission_time(&self) -> Option<gst::ClockTime> {
485        unsafe {
486            from_glib(ffi::gst_rtsp_stream_get_retransmission_time(
487                self.as_ref().to_glib_none().0,
488            ))
489        }
490    }
491
492    /// Get the multicast RTCP socket from `self` for a `family`.
493    /// ## `family`
494    /// the socket family
495    ///
496    /// # Returns
497    ///
498    /// the multicast RTCP socket or [`None`] if no
499    /// socket could be allocated for `family`. Unref after usage
500    #[doc(alias = "gst_rtsp_stream_get_rtcp_multicast_socket")]
501    #[doc(alias = "get_rtcp_multicast_socket")]
502    fn rtcp_multicast_socket(&self, family: gio::SocketFamily) -> Option<gio::Socket> {
503        unsafe {
504            from_glib_full(ffi::gst_rtsp_stream_get_rtcp_multicast_socket(
505                self.as_ref().to_glib_none().0,
506                family.into_glib(),
507            ))
508        }
509    }
510
511    /// Get the RTCP socket from `self` for a `family`.
512    ///
513    /// `self` must be joined to a bin.
514    /// ## `family`
515    /// the socket family
516    ///
517    /// # Returns
518    ///
519    /// the RTCP socket or [`None`] if no
520    /// socket could be allocated for `family`. Unref after usage
521    #[doc(alias = "gst_rtsp_stream_get_rtcp_socket")]
522    #[doc(alias = "get_rtcp_socket")]
523    fn rtcp_socket(&self, family: gio::SocketFamily) -> Option<gio::Socket> {
524        unsafe {
525            from_glib_full(ffi::gst_rtsp_stream_get_rtcp_socket(
526                self.as_ref().to_glib_none().0,
527                family.into_glib(),
528            ))
529        }
530    }
531
532    /// Get the multicast RTP socket from `self` for a `family`.
533    /// ## `family`
534    /// the socket family
535    ///
536    /// # Returns
537    ///
538    /// the multicast RTP socket or [`None`] if no
539    ///
540    /// socket could be allocated for `family`. Unref after usage
541    #[doc(alias = "gst_rtsp_stream_get_rtp_multicast_socket")]
542    #[doc(alias = "get_rtp_multicast_socket")]
543    fn rtp_multicast_socket(&self, family: gio::SocketFamily) -> Option<gio::Socket> {
544        unsafe {
545            from_glib_full(ffi::gst_rtsp_stream_get_rtp_multicast_socket(
546                self.as_ref().to_glib_none().0,
547                family.into_glib(),
548            ))
549        }
550    }
551
552    /// Get the RTP socket from `self` for a `family`.
553    ///
554    /// `self` must be joined to a bin.
555    /// ## `family`
556    /// the socket family
557    ///
558    /// # Returns
559    ///
560    /// the RTP socket or [`None`] if no
561    /// socket could be allocated for `family`. Unref after usage
562    #[doc(alias = "gst_rtsp_stream_get_rtp_socket")]
563    #[doc(alias = "get_rtp_socket")]
564    fn rtp_socket(&self, family: gio::SocketFamily) -> Option<gio::Socket> {
565        unsafe {
566            from_glib_full(ffi::gst_rtsp_stream_get_rtp_socket(
567                self.as_ref().to_glib_none().0,
568                family.into_glib(),
569            ))
570        }
571    }
572
573    /// Retrieve the current rtptime, seq and running-time. This is used to
574    /// construct a RTPInfo reply header.
575    ///
576    /// # Returns
577    ///
578    /// [`true`] when rtptime, seq and running-time could be determined.
579    ///
580    /// ## `rtptime`
581    /// result RTP timestamp
582    ///
583    /// ## `seq`
584    /// result RTP seqnum
585    ///
586    /// ## `clock_rate`
587    /// the clock rate
588    ///
589    /// ## `running_time`
590    /// result running-time
591    #[doc(alias = "gst_rtsp_stream_get_rtpinfo")]
592    #[doc(alias = "get_rtpinfo")]
593    fn rtpinfo(&self) -> Option<(u32, u32, u32, Option<gst::ClockTime>)> {
594        unsafe {
595            let mut rtptime = std::mem::MaybeUninit::uninit();
596            let mut seq = std::mem::MaybeUninit::uninit();
597            let mut clock_rate = std::mem::MaybeUninit::uninit();
598            let mut running_time = std::mem::MaybeUninit::uninit();
599            let ret = from_glib(ffi::gst_rtsp_stream_get_rtpinfo(
600                self.as_ref().to_glib_none().0,
601                rtptime.as_mut_ptr(),
602                seq.as_mut_ptr(),
603                clock_rate.as_mut_ptr(),
604                running_time.as_mut_ptr(),
605            ));
606            if ret {
607                Some((
608                    rtptime.assume_init(),
609                    seq.assume_init(),
610                    clock_rate.assume_init(),
611                    from_glib(running_time.assume_init()),
612                ))
613            } else {
614                None
615            }
616        }
617    }
618
619    /// Get the RTP session of this stream.
620    ///
621    /// # Returns
622    ///
623    /// The RTP session of this stream. Unref after usage.
624    #[doc(alias = "gst_rtsp_stream_get_rtpsession")]
625    #[doc(alias = "get_rtpsession")]
626    fn rtpsession(&self) -> Option<glib::Object> {
627        unsafe {
628            from_glib_full(ffi::gst_rtsp_stream_get_rtpsession(
629                self.as_ref().to_glib_none().0,
630            ))
631        }
632    }
633
634    //#[doc(alias = "gst_rtsp_stream_get_server_port")]
635    //#[doc(alias = "get_server_port")]
636    //fn server_port(&self, server_port: /*Ignored*/gst_rtsp::RTSPRange, family: gio::SocketFamily) {
637    //    unsafe { TODO: call ffi:gst_rtsp_stream_get_server_port() }
638    //}
639
640    /// Get the sinkpad associated with `self`.
641    ///
642    /// # Returns
643    ///
644    /// the sinkpad. Unref after usage.
645    #[doc(alias = "gst_rtsp_stream_get_sinkpad")]
646    #[doc(alias = "get_sinkpad")]
647    fn sinkpad(&self) -> Option<gst::Pad> {
648        unsafe {
649            from_glib_full(ffi::gst_rtsp_stream_get_sinkpad(
650                self.as_ref().to_glib_none().0,
651            ))
652        }
653    }
654
655    /// Get the srcpad associated with `self`.
656    ///
657    /// # Returns
658    ///
659    /// the srcpad. Unref after usage.
660    #[doc(alias = "gst_rtsp_stream_get_srcpad")]
661    #[doc(alias = "get_srcpad")]
662    fn srcpad(&self) -> Option<gst::Pad> {
663        unsafe {
664            from_glib_full(ffi::gst_rtsp_stream_get_srcpad(
665                self.as_ref().to_glib_none().0,
666            ))
667        }
668    }
669
670    /// Get the SRTP encoder for this stream.
671    ///
672    /// # Returns
673    ///
674    /// The SRTP encoder for this stream. Unref after usage.
675    #[doc(alias = "gst_rtsp_stream_get_srtp_encoder")]
676    #[doc(alias = "get_srtp_encoder")]
677    fn srtp_encoder(&self) -> Option<gst::Element> {
678        unsafe {
679            from_glib_full(ffi::gst_rtsp_stream_get_srtp_encoder(
680                self.as_ref().to_glib_none().0,
681            ))
682        }
683    }
684
685    /// Get the SSRC used by the RTP session of this stream. This function can only
686    /// be called when `self` has been joined.
687    ///
688    /// # Returns
689    ///
690    ///
691    /// ## `ssrc`
692    /// result ssrc
693    #[doc(alias = "gst_rtsp_stream_get_ssrc")]
694    #[doc(alias = "get_ssrc")]
695    fn ssrc(&self) -> u32 {
696        unsafe {
697            let mut ssrc = std::mem::MaybeUninit::uninit();
698            ffi::gst_rtsp_stream_get_ssrc(self.as_ref().to_glib_none().0, ssrc.as_mut_ptr());
699            ssrc.assume_init()
700        }
701    }
702
703    #[doc(alias = "gst_rtsp_stream_get_ulpfec_enabled")]
704    #[doc(alias = "get_ulpfec_enabled")]
705    fn is_ulpfec_enabled(&self) -> bool {
706        unsafe {
707            from_glib(ffi::gst_rtsp_stream_get_ulpfec_enabled(
708                self.as_ref().to_glib_none().0,
709            ))
710        }
711    }
712
713    ///
714    /// # Returns
715    ///
716    /// the amount of redundancy applied when creating ULPFEC
717    /// protection packets.
718    #[cfg(feature = "v1_16")]
719    #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
720    #[doc(alias = "gst_rtsp_stream_get_ulpfec_percentage")]
721    #[doc(alias = "get_ulpfec_percentage")]
722    fn ulpfec_percentage(&self) -> u32 {
723        unsafe { ffi::gst_rtsp_stream_get_ulpfec_percentage(self.as_ref().to_glib_none().0) }
724    }
725
726    ///
727    /// # Returns
728    ///
729    /// the payload type used for ULPFEC protection packets
730    #[cfg(feature = "v1_16")]
731    #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
732    #[doc(alias = "gst_rtsp_stream_get_ulpfec_pt")]
733    #[doc(alias = "get_ulpfec_pt")]
734    fn ulpfec_pt(&self) -> u32 {
735        unsafe { ffi::gst_rtsp_stream_get_ulpfec_pt(self.as_ref().to_glib_none().0) }
736    }
737
738    /// Parse and handle a KeyMgmt header.
739    /// ## `keymgmt`
740    /// a keymgmt header
741    #[cfg(feature = "v1_16")]
742    #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
743    #[doc(alias = "gst_rtsp_stream_handle_keymgmt")]
744    fn handle_keymgmt(&self, keymgmt: &str) -> bool {
745        unsafe {
746            from_glib(ffi::gst_rtsp_stream_handle_keymgmt(
747                self.as_ref().to_glib_none().0,
748                keymgmt.to_glib_none().0,
749            ))
750        }
751    }
752
753    /// Check if `self` has the control string `control`.
754    /// ## `control`
755    /// a control string
756    ///
757    /// # Returns
758    ///
759    /// [`true`] is `self` has `control` as the control string
760    #[doc(alias = "gst_rtsp_stream_has_control")]
761    fn has_control(&self, control: Option<&str>) -> bool {
762        unsafe {
763            from_glib(ffi::gst_rtsp_stream_has_control(
764                self.as_ref().to_glib_none().0,
765                control.to_glib_none().0,
766            ))
767        }
768    }
769
770    /// Check if multicast sockets are configured to be bound to multicast addresses.
771    ///
772    /// # Returns
773    ///
774    /// [`true`] if multicast sockets are configured to be bound to multicast addresses.
775    #[cfg(feature = "v1_16")]
776    #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
777    #[doc(alias = "gst_rtsp_stream_is_bind_mcast_address")]
778    fn is_bind_mcast_address(&self) -> bool {
779        unsafe {
780            from_glib(ffi::gst_rtsp_stream_is_bind_mcast_address(
781                self.as_ref().to_glib_none().0,
782            ))
783        }
784    }
785
786    /// Check if `self` is blocking on a [`gst::Buffer`][crate::gst::Buffer].
787    ///
788    /// # Returns
789    ///
790    /// [`true`] if `self` is blocking
791    #[doc(alias = "gst_rtsp_stream_is_blocking")]
792    fn is_blocking(&self) -> bool {
793        unsafe {
794            from_glib(ffi::gst_rtsp_stream_is_blocking(
795                self.as_ref().to_glib_none().0,
796            ))
797        }
798    }
799
800    /// See [`set_client_side()`][Self::set_client_side()]
801    ///
802    /// # Returns
803    ///
804    /// TRUE if this [`RTSPStream`][crate::RTSPStream] is client-side.
805    #[doc(alias = "gst_rtsp_stream_is_client_side")]
806    fn is_client_side(&self) -> bool {
807        unsafe {
808            from_glib(ffi::gst_rtsp_stream_is_client_side(
809                self.as_ref().to_glib_none().0,
810            ))
811        }
812    }
813
814    /// Checks whether the stream is complete, contains the receiver and the sender
815    /// parts. As the stream contains sink(s) element(s), it's possible to perform
816    /// seek operations on it.
817    ///
818    /// # Returns
819    ///
820    /// [`true`] if the stream contains at least one sink element.
821    #[doc(alias = "gst_rtsp_stream_is_complete")]
822    fn is_complete(&self) -> bool {
823        unsafe {
824            from_glib(ffi::gst_rtsp_stream_is_complete(
825                self.as_ref().to_glib_none().0,
826            ))
827        }
828    }
829
830    /// Checks whether the stream is a receiver.
831    ///
832    /// # Returns
833    ///
834    /// [`true`] if the stream is a receiver and [`false`] otherwise.
835    #[doc(alias = "gst_rtsp_stream_is_receiver")]
836    fn is_receiver(&self) -> bool {
837        unsafe {
838            from_glib(ffi::gst_rtsp_stream_is_receiver(
839                self.as_ref().to_glib_none().0,
840            ))
841        }
842    }
843
844    /// Checks whether the stream is a sender.
845    ///
846    /// # Returns
847    ///
848    /// [`true`] if the stream is a sender and [`false`] otherwise.
849    #[doc(alias = "gst_rtsp_stream_is_sender")]
850    fn is_sender(&self) -> bool {
851        unsafe {
852            from_glib(ffi::gst_rtsp_stream_is_sender(
853                self.as_ref().to_glib_none().0,
854            ))
855        }
856    }
857
858    //#[doc(alias = "gst_rtsp_stream_is_transport_supported")]
859    //fn is_transport_supported(&self, transport: /*Ignored*/&mut gst_rtsp::RTSPTransport) -> bool {
860    //    unsafe { TODO: call ffi:gst_rtsp_stream_is_transport_supported() }
861    //}
862
863    /// Join the [`gst::Bin`][crate::gst::Bin] `bin` that contains the element `rtpbin`.
864    ///
865    /// `self` will link to `rtpbin`, which must be inside `bin`. The elements
866    /// added to `bin` will be set to the state given in `state`.
867    /// ## `bin`
868    /// a [`gst::Bin`][crate::gst::Bin] to join
869    /// ## `rtpbin`
870    /// a rtpbin element in `bin`
871    /// ## `state`
872    /// the target state of the new elements
873    ///
874    /// # Returns
875    ///
876    /// [`true`] on success.
877    #[doc(alias = "gst_rtsp_stream_join_bin")]
878    fn join_bin(
879        &self,
880        bin: &impl IsA<gst::Bin>,
881        rtpbin: &impl IsA<gst::Element>,
882        state: gst::State,
883    ) -> Result<(), glib::error::BoolError> {
884        unsafe {
885            glib::result_from_gboolean!(
886                ffi::gst_rtsp_stream_join_bin(
887                    self.as_ref().to_glib_none().0,
888                    bin.as_ref().to_glib_none().0,
889                    rtpbin.as_ref().to_glib_none().0,
890                    state.into_glib()
891                ),
892                "Failed to join bin"
893            )
894        }
895    }
896
897    /// Remove the elements of `self` from `bin`.
898    /// ## `bin`
899    /// a [`gst::Bin`][crate::gst::Bin]
900    /// ## `rtpbin`
901    /// a rtpbin [`gst::Element`][crate::gst::Element]
902    ///
903    /// # Returns
904    ///
905    /// [`true`] on success.
906    #[doc(alias = "gst_rtsp_stream_leave_bin")]
907    fn leave_bin(
908        &self,
909        bin: &impl IsA<gst::Bin>,
910        rtpbin: &impl IsA<gst::Element>,
911    ) -> Result<(), glib::error::BoolError> {
912        unsafe {
913            glib::result_from_gboolean!(
914                ffi::gst_rtsp_stream_leave_bin(
915                    self.as_ref().to_glib_none().0,
916                    bin.as_ref().to_glib_none().0,
917                    rtpbin.as_ref().to_glib_none().0
918                ),
919                "Failed to leave bin"
920            )
921        }
922    }
923
924    /// Handle an RTCP buffer for the stream. This method is usually called when a
925    /// message has been received from a client using the TCP transport.
926    ///
927    /// This function takes ownership of `buffer`.
928    /// ## `buffer`
929    /// a [`gst::Buffer`][crate::gst::Buffer]
930    ///
931    /// # Returns
932    ///
933    /// a GstFlowReturn.
934    #[doc(alias = "gst_rtsp_stream_recv_rtcp")]
935    fn recv_rtcp(&self, buffer: gst::Buffer) -> Result<gst::FlowSuccess, gst::FlowError> {
936        unsafe {
937            try_from_glib(ffi::gst_rtsp_stream_recv_rtcp(
938                self.as_ref().to_glib_none().0,
939                buffer.into_glib_ptr(),
940            ))
941        }
942    }
943
944    /// Handle an RTP buffer for the stream. This method is usually called when a
945    /// message has been received from a client using the TCP transport.
946    ///
947    /// This function takes ownership of `buffer`.
948    /// ## `buffer`
949    /// a [`gst::Buffer`][crate::gst::Buffer]
950    ///
951    /// # Returns
952    ///
953    /// a GstFlowReturn.
954    #[doc(alias = "gst_rtsp_stream_recv_rtp")]
955    fn recv_rtp(&self, buffer: gst::Buffer) -> Result<gst::FlowSuccess, gst::FlowError> {
956        unsafe {
957            try_from_glib(ffi::gst_rtsp_stream_recv_rtp(
958                self.as_ref().to_glib_none().0,
959                buffer.into_glib_ptr(),
960            ))
961        }
962    }
963
964    /// Remove the transport in `trans` from `self`. The media of `self` will
965    /// not be sent to the values configured in `trans`.
966    ///
967    /// `self` must be joined to a bin.
968    ///
969    /// `trans` must contain a valid `GstRTSPTransport`.
970    /// ## `trans`
971    /// a [`RTSPStreamTransport`][crate::RTSPStreamTransport]
972    ///
973    /// # Returns
974    ///
975    /// [`true`] if `trans` was removed
976    #[doc(alias = "gst_rtsp_stream_remove_transport")]
977    fn remove_transport(
978        &self,
979        trans: &impl IsA<RTSPStreamTransport>,
980    ) -> Result<(), glib::error::BoolError> {
981        unsafe {
982            glib::result_from_gboolean!(
983                ffi::gst_rtsp_stream_remove_transport(
984                    self.as_ref().to_glib_none().0,
985                    trans.as_ref().to_glib_none().0
986                ),
987                "Failed to remove transport"
988            )
989        }
990    }
991
992    /// Creating a rtxreceive bin
993    /// ## `sessid`
994    /// the session id
995    ///
996    /// # Returns
997    ///
998    /// a [`gst::Element`][crate::gst::Element].
999    #[cfg(feature = "v1_16")]
1000    #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
1001    #[doc(alias = "gst_rtsp_stream_request_aux_receiver")]
1002    fn request_aux_receiver(&self, sessid: u32) -> Option<gst::Element> {
1003        unsafe {
1004            from_glib_full(ffi::gst_rtsp_stream_request_aux_receiver(
1005                self.as_ref().to_glib_none().0,
1006                sessid,
1007            ))
1008        }
1009    }
1010
1011    /// Creating a rtxsend bin
1012    /// ## `sessid`
1013    /// the session id
1014    ///
1015    /// # Returns
1016    ///
1017    /// a [`gst::Element`][crate::gst::Element].
1018    #[doc(alias = "gst_rtsp_stream_request_aux_sender")]
1019    fn request_aux_sender(&self, sessid: u32) -> Option<gst::Element> {
1020        unsafe {
1021            from_glib_full(ffi::gst_rtsp_stream_request_aux_sender(
1022                self.as_ref().to_glib_none().0,
1023                sessid,
1024            ))
1025        }
1026    }
1027
1028    /// Creating a rtpulpfecdec element
1029    ///
1030    /// # Returns
1031    ///
1032    /// a [`gst::Element`][crate::gst::Element].
1033    #[cfg(feature = "v1_16")]
1034    #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
1035    #[doc(alias = "gst_rtsp_stream_request_ulpfec_decoder")]
1036    fn request_ulpfec_decoder(
1037        &self,
1038        rtpbin: &impl IsA<gst::Element>,
1039        sessid: u32,
1040    ) -> Option<gst::Element> {
1041        unsafe {
1042            from_glib_full(ffi::gst_rtsp_stream_request_ulpfec_decoder(
1043                self.as_ref().to_glib_none().0,
1044                rtpbin.as_ref().to_glib_none().0,
1045                sessid,
1046            ))
1047        }
1048    }
1049
1050    /// Creating a rtpulpfecenc element
1051    ///
1052    /// # Returns
1053    ///
1054    /// a [`gst::Element`][crate::gst::Element].
1055    #[cfg(feature = "v1_16")]
1056    #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
1057    #[doc(alias = "gst_rtsp_stream_request_ulpfec_encoder")]
1058    fn request_ulpfec_encoder(&self, sessid: u32) -> Option<gst::Element> {
1059        unsafe {
1060            from_glib_full(ffi::gst_rtsp_stream_request_ulpfec_encoder(
1061                self.as_ref().to_glib_none().0,
1062                sessid,
1063            ))
1064        }
1065    }
1066
1067    /// Reserve `address` and `port` as the address and port of `self`. The original
1068    /// [`RTSPAddress`][crate::RTSPAddress] is cached and copy is returned, so freeing the return value
1069    /// won't release the address from the pool.
1070    /// ## `address`
1071    /// an address
1072    /// ## `port`
1073    /// a port
1074    /// ## `n_ports`
1075    /// n_ports
1076    /// ## `ttl`
1077    /// a TTL
1078    ///
1079    /// # Returns
1080    ///
1081    /// the [`RTSPAddress`][crate::RTSPAddress] of `self` or [`None`] when
1082    /// the address could not be reserved. `gst_rtsp_address_free()` after
1083    /// usage.
1084    #[doc(alias = "gst_rtsp_stream_reserve_address")]
1085    fn reserve_address(
1086        &self,
1087        address: &str,
1088        port: u32,
1089        n_ports: u32,
1090        ttl: u32,
1091    ) -> Option<RTSPAddress> {
1092        unsafe {
1093            from_glib_full(ffi::gst_rtsp_stream_reserve_address(
1094                self.as_ref().to_glib_none().0,
1095                address.to_glib_none().0,
1096                port,
1097                n_ports,
1098                ttl,
1099            ))
1100        }
1101    }
1102
1103    /// Checks whether the individual `self` is seekable.
1104    ///
1105    /// # Returns
1106    ///
1107    /// [`true`] if `self` is seekable, else [`false`].
1108    #[doc(alias = "gst_rtsp_stream_seekable")]
1109    fn seekable(&self) -> bool {
1110        unsafe {
1111            from_glib(ffi::gst_rtsp_stream_seekable(
1112                self.as_ref().to_glib_none().0,
1113            ))
1114        }
1115    }
1116
1117    /// configure `pool` to be used as the address pool of `self`.
1118    /// ## `pool`
1119    /// a [`RTSPAddressPool`][crate::RTSPAddressPool]
1120    #[doc(alias = "gst_rtsp_stream_set_address_pool")]
1121    fn set_address_pool(&self, pool: Option<&impl IsA<RTSPAddressPool>>) {
1122        unsafe {
1123            ffi::gst_rtsp_stream_set_address_pool(
1124                self.as_ref().to_glib_none().0,
1125                pool.map(|p| p.as_ref()).to_glib_none().0,
1126            );
1127        }
1128    }
1129
1130    /// Decide whether the multicast socket should be bound to a multicast address or
1131    /// INADDR_ANY.
1132    /// ## `bind_mcast_addr`
1133    /// the new value
1134    #[cfg(feature = "v1_16")]
1135    #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
1136    #[doc(alias = "gst_rtsp_stream_set_bind_mcast_address")]
1137    fn set_bind_mcast_address(&self, bind_mcast_addr: bool) {
1138        unsafe {
1139            ffi::gst_rtsp_stream_set_bind_mcast_address(
1140                self.as_ref().to_glib_none().0,
1141                bind_mcast_addr.into_glib(),
1142            );
1143        }
1144    }
1145
1146    /// Blocks or unblocks the dataflow on `self`.
1147    /// ## `blocked`
1148    /// boolean indicating we should block or unblock
1149    ///
1150    /// # Returns
1151    ///
1152    /// [`true`] on success
1153    #[doc(alias = "gst_rtsp_stream_set_blocked")]
1154    fn set_blocked(&self, blocked: bool) -> Result<(), glib::error::BoolError> {
1155        unsafe {
1156            glib::result_from_gboolean!(
1157                ffi::gst_rtsp_stream_set_blocked(
1158                    self.as_ref().to_glib_none().0,
1159                    blocked.into_glib()
1160                ),
1161                "Failed to block/unblock the dataflow"
1162            )
1163        }
1164    }
1165
1166    /// Set the size of the UDP transmission buffer (in bytes)
1167    /// Needs to be set before the stream is joined to a bin.
1168    /// ## `size`
1169    /// the buffer size
1170    #[doc(alias = "gst_rtsp_stream_set_buffer_size")]
1171    fn set_buffer_size(&self, size: u32) {
1172        unsafe {
1173            ffi::gst_rtsp_stream_set_buffer_size(self.as_ref().to_glib_none().0, size);
1174        }
1175    }
1176
1177    /// Sets the [`RTSPStream`][crate::RTSPStream] as a 'client side' stream - used for sending
1178    /// streams to an RTSP server via RECORD. This has the practical effect
1179    /// of changing which UDP port numbers are used when setting up the local
1180    /// side of the stream sending to be either the 'server' or 'client' pair
1181    /// of a configured UDP transport.
1182    /// ## `client_side`
1183    /// TRUE if this [`RTSPStream`][crate::RTSPStream] is running on the 'client' side of
1184    /// an RTSP connection.
1185    #[doc(alias = "gst_rtsp_stream_set_client_side")]
1186    fn set_client_side(&self, client_side: bool) {
1187        unsafe {
1188            ffi::gst_rtsp_stream_set_client_side(
1189                self.as_ref().to_glib_none().0,
1190                client_side.into_glib(),
1191            );
1192        }
1193    }
1194
1195    /// Set the control string in `self`.
1196    /// ## `control`
1197    /// a control string
1198    #[doc(alias = "gst_rtsp_stream_set_control")]
1199    #[doc(alias = "control")]
1200    fn set_control(&self, control: Option<&str>) {
1201        unsafe {
1202            ffi::gst_rtsp_stream_set_control(
1203                self.as_ref().to_glib_none().0,
1204                control.to_glib_none().0,
1205            );
1206        }
1207    }
1208
1209    /// Configure the dscp qos of the outgoing sockets to `dscp_qos`.
1210    /// ## `dscp_qos`
1211    /// a new dscp qos value (0-63, or -1 to disable)
1212    #[doc(alias = "gst_rtsp_stream_set_dscp_qos")]
1213    fn set_dscp_qos(&self, dscp_qos: i32) {
1214        unsafe {
1215            ffi::gst_rtsp_stream_set_dscp_qos(self.as_ref().to_glib_none().0, dscp_qos);
1216        }
1217    }
1218
1219    /// Set the maximum time-to-live value of outgoing multicast packets.
1220    /// ## `ttl`
1221    /// the new multicast ttl value
1222    ///
1223    /// # Returns
1224    ///
1225    /// [`true`] if the requested ttl has been set successfully.
1226    #[cfg(feature = "v1_16")]
1227    #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
1228    #[doc(alias = "gst_rtsp_stream_set_max_mcast_ttl")]
1229    fn set_max_mcast_ttl(&self, ttl: u32) -> bool {
1230        unsafe {
1231            from_glib(ffi::gst_rtsp_stream_set_max_mcast_ttl(
1232                self.as_ref().to_glib_none().0,
1233                ttl,
1234            ))
1235        }
1236    }
1237
1238    /// Configure the mtu in the payloader of `self` to `mtu`.
1239    /// ## `mtu`
1240    /// a new MTU
1241    #[doc(alias = "gst_rtsp_stream_set_mtu")]
1242    fn set_mtu(&self, mtu: u32) {
1243        unsafe {
1244            ffi::gst_rtsp_stream_set_mtu(self.as_ref().to_glib_none().0, mtu);
1245        }
1246    }
1247
1248    /// configure `multicast_iface` to be used for `self`.
1249    /// ## `multicast_iface`
1250    /// a multicast interface name
1251    #[doc(alias = "gst_rtsp_stream_set_multicast_iface")]
1252    fn set_multicast_iface(&self, multicast_iface: Option<&str>) {
1253        unsafe {
1254            ffi::gst_rtsp_stream_set_multicast_iface(
1255                self.as_ref().to_glib_none().0,
1256                multicast_iface.to_glib_none().0,
1257            );
1258        }
1259    }
1260
1261    /// Configure the allowed profiles for `self`.
1262    /// ## `profiles`
1263    /// the new profiles
1264    #[doc(alias = "gst_rtsp_stream_set_profiles")]
1265    #[doc(alias = "profiles")]
1266    fn set_profiles(&self, profiles: gst_rtsp::RTSPProfile) {
1267        unsafe {
1268            ffi::gst_rtsp_stream_set_profiles(self.as_ref().to_glib_none().0, profiles.into_glib());
1269        }
1270    }
1271
1272    /// Configure the allowed lower transport for `self`.
1273    /// ## `protocols`
1274    /// the new flags
1275    #[doc(alias = "gst_rtsp_stream_set_protocols")]
1276    #[doc(alias = "protocols")]
1277    fn set_protocols(&self, protocols: gst_rtsp::RTSPLowerTrans) {
1278        unsafe {
1279            ffi::gst_rtsp_stream_set_protocols(
1280                self.as_ref().to_glib_none().0,
1281                protocols.into_glib(),
1282            );
1283        }
1284    }
1285
1286    /// Configure a pt map between `pt` and `caps`.
1287    /// ## `pt`
1288    /// the pt
1289    /// ## `caps`
1290    /// a [`gst::Caps`][crate::gst::Caps]
1291    #[doc(alias = "gst_rtsp_stream_set_pt_map")]
1292    fn set_pt_map(&self, pt: u32, caps: &gst::Caps) {
1293        unsafe {
1294            ffi::gst_rtsp_stream_set_pt_map(
1295                self.as_ref().to_glib_none().0,
1296                pt,
1297                caps.to_glib_none().0,
1298            );
1299        }
1300    }
1301
1302    /// Sets if and how the stream clock should be published according to RFC7273.
1303    /// ## `mode`
1304    /// the clock publish mode
1305    #[doc(alias = "gst_rtsp_stream_set_publish_clock_mode")]
1306    fn set_publish_clock_mode(&self, mode: RTSPPublishClockMode) {
1307        unsafe {
1308            ffi::gst_rtsp_stream_set_publish_clock_mode(
1309                self.as_ref().to_glib_none().0,
1310                mode.into_glib(),
1311            );
1312        }
1313    }
1314
1315    /// Define whether `self` will follow the Rate-Control=no behaviour as specified
1316    /// in the ONVIF replay spec.
1317    #[cfg(feature = "v1_18")]
1318    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
1319    #[doc(alias = "gst_rtsp_stream_set_rate_control")]
1320    fn set_rate_control(&self, enabled: bool) {
1321        unsafe {
1322            ffi::gst_rtsp_stream_set_rate_control(
1323                self.as_ref().to_glib_none().0,
1324                enabled.into_glib(),
1325            );
1326        }
1327    }
1328
1329    /// Set the payload type (pt) for retransmission of this stream.
1330    /// ## `rtx_pt`
1331    /// a `guint`
1332    #[doc(alias = "gst_rtsp_stream_set_retransmission_pt")]
1333    fn set_retransmission_pt(&self, rtx_pt: u32) {
1334        unsafe {
1335            ffi::gst_rtsp_stream_set_retransmission_pt(self.as_ref().to_glib_none().0, rtx_pt);
1336        }
1337    }
1338
1339    /// Set the amount of time to store retransmission packets.
1340    /// ## `time`
1341    /// a `GstClockTime`
1342    #[doc(alias = "gst_rtsp_stream_set_retransmission_time")]
1343    fn set_retransmission_time(&self, time: impl Into<Option<gst::ClockTime>>) {
1344        unsafe {
1345            ffi::gst_rtsp_stream_set_retransmission_time(
1346                self.as_ref().to_glib_none().0,
1347                time.into().into_glib(),
1348            );
1349        }
1350    }
1351
1352    #[doc(alias = "gst_rtsp_stream_set_seqnum_offset")]
1353    fn set_seqnum_offset(&self, seqnum: u16) {
1354        unsafe {
1355            ffi::gst_rtsp_stream_set_seqnum_offset(self.as_ref().to_glib_none().0, seqnum);
1356        }
1357    }
1358
1359    /// Sets the amount of redundancy to apply when creating ULPFEC
1360    /// protection packets.
1361    #[cfg(feature = "v1_16")]
1362    #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
1363    #[doc(alias = "gst_rtsp_stream_set_ulpfec_percentage")]
1364    fn set_ulpfec_percentage(&self, percentage: u32) {
1365        unsafe {
1366            ffi::gst_rtsp_stream_set_ulpfec_percentage(self.as_ref().to_glib_none().0, percentage);
1367        }
1368    }
1369
1370    /// Set the payload type to be used for ULPFEC protection packets
1371    #[cfg(feature = "v1_16")]
1372    #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
1373    #[doc(alias = "gst_rtsp_stream_set_ulpfec_pt")]
1374    fn set_ulpfec_pt(&self, pt: u32) {
1375        unsafe {
1376            ffi::gst_rtsp_stream_set_ulpfec_pt(self.as_ref().to_glib_none().0, pt);
1377        }
1378    }
1379
1380    /// Call `func` for each transport managed by `self`. The result value of `func`
1381    /// determines what happens to the transport. `func` will be called with `self`
1382    /// locked so no further actions on `self` can be performed from `func`.
1383    ///
1384    /// If `func` returns [`RTSPFilterResult::Remove`][crate::RTSPFilterResult::Remove], the transport will be removed from
1385    /// `self`.
1386    ///
1387    /// If `func` returns [`RTSPFilterResult::Keep`][crate::RTSPFilterResult::Keep], the transport will remain in `self`.
1388    ///
1389    /// If `func` returns [`RTSPFilterResult::Ref`][crate::RTSPFilterResult::Ref], the transport will remain in `self` but
1390    /// will also be added with an additional ref to the result `GList` of this
1391    /// function..
1392    ///
1393    /// When `func` is [`None`], [`RTSPFilterResult::Ref`][crate::RTSPFilterResult::Ref] will be assumed for each transport.
1394    /// ## `func`
1395    /// a callback
1396    ///
1397    /// # Returns
1398    ///
1399    /// a `GList` with all
1400    /// transports for which `func` returned [`RTSPFilterResult::Ref`][crate::RTSPFilterResult::Ref]. After usage, each
1401    /// element in the `GList` should be unreffed before the list is freed.
1402    #[doc(alias = "gst_rtsp_stream_transport_filter")]
1403    fn transport_filter(
1404        &self,
1405        func: Option<&mut dyn (FnMut(&RTSPStream, &RTSPStreamTransport) -> RTSPFilterResult)>,
1406    ) -> Vec<RTSPStreamTransport> {
1407        let mut func_data: Option<
1408            &mut dyn (FnMut(&RTSPStream, &RTSPStreamTransport) -> RTSPFilterResult),
1409        > = func;
1410        unsafe extern "C" fn func_func(
1411            stream: *mut ffi::GstRTSPStream,
1412            trans: *mut ffi::GstRTSPStreamTransport,
1413            user_data: glib::ffi::gpointer,
1414        ) -> ffi::GstRTSPFilterResult {
1415            let stream = from_glib_borrow(stream);
1416            let trans = from_glib_borrow(trans);
1417            let callback = user_data
1418                as *mut Option<
1419                    &mut dyn (FnMut(&RTSPStream, &RTSPStreamTransport) -> RTSPFilterResult),
1420                >;
1421            if let Some(ref mut callback) = *callback {
1422                callback(&stream, &trans)
1423            } else {
1424                panic!("cannot get closure...")
1425            }
1426            .into_glib()
1427        }
1428        let func = if func_data.is_some() {
1429            Some(func_func as _)
1430        } else {
1431            None
1432        };
1433        let super_callback0: &mut Option<
1434            &mut dyn (FnMut(&RTSPStream, &RTSPStreamTransport) -> RTSPFilterResult),
1435        > = &mut func_data;
1436        unsafe {
1437            FromGlibPtrContainer::from_glib_full(ffi::gst_rtsp_stream_transport_filter(
1438                self.as_ref().to_glib_none().0,
1439                func,
1440                super_callback0 as *mut _ as *mut _,
1441            ))
1442        }
1443    }
1444
1445    #[doc(alias = "gst_rtsp_stream_unblock_linked")]
1446    fn unblock_linked(&self) -> Result<(), glib::error::BoolError> {
1447        unsafe {
1448            glib::result_from_gboolean!(
1449                ffi::gst_rtsp_stream_unblock_linked(self.as_ref().to_glib_none().0),
1450                "Failed to unblock the dataflow"
1451            )
1452        }
1453    }
1454
1455    /// Remove blocking probe from the RTCP source. When creating an UDP source for
1456    /// RTCP it is initially blocked until this function is called.
1457    /// This functions should be called once the pipeline is ready for handling RTCP
1458    /// packets.
1459    #[cfg(feature = "v1_20")]
1460    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
1461    #[doc(alias = "gst_rtsp_stream_unblock_rtcp")]
1462    fn unblock_rtcp(&self) {
1463        unsafe {
1464            ffi::gst_rtsp_stream_unblock_rtcp(self.as_ref().to_glib_none().0);
1465        }
1466    }
1467
1468    /// Update the new crypto information for `ssrc` in `self`. If information
1469    /// for `ssrc` did not exist, it will be added. If information
1470    /// for `ssrc` existed, it will be replaced. If `crypto` is [`None`], it will
1471    /// be removed from `self`.
1472    /// ## `ssrc`
1473    /// the SSRC
1474    /// ## `crypto`
1475    /// a [`gst::Caps`][crate::gst::Caps] with crypto info
1476    ///
1477    /// # Returns
1478    ///
1479    /// [`true`] if `crypto` could be updated
1480    #[doc(alias = "gst_rtsp_stream_update_crypto")]
1481    fn update_crypto(
1482        &self,
1483        ssrc: u32,
1484        crypto: Option<&gst::Caps>,
1485    ) -> Result<(), glib::error::BoolError> {
1486        unsafe {
1487            glib::result_from_gboolean!(
1488                ffi::gst_rtsp_stream_update_crypto(
1489                    self.as_ref().to_glib_none().0,
1490                    ssrc,
1491                    crypto.to_glib_none().0
1492                ),
1493                "Failed to update crypto"
1494            )
1495        }
1496    }
1497
1498    /// Check if the requested multicast ttl value is allowed.
1499    /// ## `ttl`
1500    /// a requested multicast ttl
1501    ///
1502    /// # Returns
1503    ///
1504    /// TRUE if the requested ttl value is allowed.
1505    #[cfg(feature = "v1_16")]
1506    #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
1507    #[doc(alias = "gst_rtsp_stream_verify_mcast_ttl")]
1508    fn verify_mcast_ttl(&self, ttl: u32) -> bool {
1509        unsafe {
1510            from_glib(ffi::gst_rtsp_stream_verify_mcast_ttl(
1511                self.as_ref().to_glib_none().0,
1512                ttl,
1513            ))
1514        }
1515    }
1516
1517    #[doc(alias = "new-rtcp-encoder")]
1518    fn connect_new_rtcp_encoder<F: Fn(&Self, &gst::Element) + Send + Sync + 'static>(
1519        &self,
1520        f: F,
1521    ) -> SignalHandlerId {
1522        unsafe extern "C" fn new_rtcp_encoder_trampoline<
1523            P: IsA<RTSPStream>,
1524            F: Fn(&P, &gst::Element) + Send + Sync + 'static,
1525        >(
1526            this: *mut ffi::GstRTSPStream,
1527            object: *mut gst::ffi::GstElement,
1528            f: glib::ffi::gpointer,
1529        ) {
1530            let f: &F = &*(f as *const F);
1531            f(
1532                RTSPStream::from_glib_borrow(this).unsafe_cast_ref(),
1533                &from_glib_borrow(object),
1534            )
1535        }
1536        unsafe {
1537            let f: Box_<F> = Box_::new(f);
1538            connect_raw(
1539                self.as_ptr() as *mut _,
1540                b"new-rtcp-encoder\0".as_ptr() as *const _,
1541                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1542                    new_rtcp_encoder_trampoline::<Self, F> as *const (),
1543                )),
1544                Box_::into_raw(f),
1545            )
1546        }
1547    }
1548
1549    #[doc(alias = "new-rtp-encoder")]
1550    fn connect_new_rtp_encoder<F: Fn(&Self, &gst::Element) + Send + Sync + 'static>(
1551        &self,
1552        f: F,
1553    ) -> SignalHandlerId {
1554        unsafe extern "C" fn new_rtp_encoder_trampoline<
1555            P: IsA<RTSPStream>,
1556            F: Fn(&P, &gst::Element) + Send + Sync + 'static,
1557        >(
1558            this: *mut ffi::GstRTSPStream,
1559            object: *mut gst::ffi::GstElement,
1560            f: glib::ffi::gpointer,
1561        ) {
1562            let f: &F = &*(f as *const F);
1563            f(
1564                RTSPStream::from_glib_borrow(this).unsafe_cast_ref(),
1565                &from_glib_borrow(object),
1566            )
1567        }
1568        unsafe {
1569            let f: Box_<F> = Box_::new(f);
1570            connect_raw(
1571                self.as_ptr() as *mut _,
1572                b"new-rtp-encoder\0".as_ptr() as *const _,
1573                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1574                    new_rtp_encoder_trampoline::<Self, F> as *const (),
1575                )),
1576                Box_::into_raw(f),
1577            )
1578        }
1579    }
1580
1581    #[doc(alias = "new-rtp-rtcp-decoder")]
1582    fn connect_new_rtp_rtcp_decoder<F: Fn(&Self, &gst::Element) + Send + Sync + 'static>(
1583        &self,
1584        f: F,
1585    ) -> SignalHandlerId {
1586        unsafe extern "C" fn new_rtp_rtcp_decoder_trampoline<
1587            P: IsA<RTSPStream>,
1588            F: Fn(&P, &gst::Element) + Send + Sync + 'static,
1589        >(
1590            this: *mut ffi::GstRTSPStream,
1591            object: *mut gst::ffi::GstElement,
1592            f: glib::ffi::gpointer,
1593        ) {
1594            let f: &F = &*(f as *const F);
1595            f(
1596                RTSPStream::from_glib_borrow(this).unsafe_cast_ref(),
1597                &from_glib_borrow(object),
1598            )
1599        }
1600        unsafe {
1601            let f: Box_<F> = Box_::new(f);
1602            connect_raw(
1603                self.as_ptr() as *mut _,
1604                b"new-rtp-rtcp-decoder\0".as_ptr() as *const _,
1605                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1606                    new_rtp_rtcp_decoder_trampoline::<Self, F> as *const (),
1607                )),
1608                Box_::into_raw(f),
1609            )
1610        }
1611    }
1612
1613    #[doc(alias = "control")]
1614    fn connect_control_notify<F: Fn(&Self) + Send + Sync + 'static>(
1615        &self,
1616        f: F,
1617    ) -> SignalHandlerId {
1618        unsafe extern "C" fn notify_control_trampoline<
1619            P: IsA<RTSPStream>,
1620            F: Fn(&P) + Send + Sync + 'static,
1621        >(
1622            this: *mut ffi::GstRTSPStream,
1623            _param_spec: glib::ffi::gpointer,
1624            f: glib::ffi::gpointer,
1625        ) {
1626            let f: &F = &*(f as *const F);
1627            f(RTSPStream::from_glib_borrow(this).unsafe_cast_ref())
1628        }
1629        unsafe {
1630            let f: Box_<F> = Box_::new(f);
1631            connect_raw(
1632                self.as_ptr() as *mut _,
1633                b"notify::control\0".as_ptr() as *const _,
1634                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1635                    notify_control_trampoline::<Self, F> as *const (),
1636                )),
1637                Box_::into_raw(f),
1638            )
1639        }
1640    }
1641
1642    #[doc(alias = "profiles")]
1643    fn connect_profiles_notify<F: Fn(&Self) + Send + Sync + 'static>(
1644        &self,
1645        f: F,
1646    ) -> SignalHandlerId {
1647        unsafe extern "C" fn notify_profiles_trampoline<
1648            P: IsA<RTSPStream>,
1649            F: Fn(&P) + Send + Sync + 'static,
1650        >(
1651            this: *mut ffi::GstRTSPStream,
1652            _param_spec: glib::ffi::gpointer,
1653            f: glib::ffi::gpointer,
1654        ) {
1655            let f: &F = &*(f as *const F);
1656            f(RTSPStream::from_glib_borrow(this).unsafe_cast_ref())
1657        }
1658        unsafe {
1659            let f: Box_<F> = Box_::new(f);
1660            connect_raw(
1661                self.as_ptr() as *mut _,
1662                b"notify::profiles\0".as_ptr() as *const _,
1663                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1664                    notify_profiles_trampoline::<Self, F> as *const (),
1665                )),
1666                Box_::into_raw(f),
1667            )
1668        }
1669    }
1670
1671    #[doc(alias = "protocols")]
1672    fn connect_protocols_notify<F: Fn(&Self) + Send + Sync + 'static>(
1673        &self,
1674        f: F,
1675    ) -> SignalHandlerId {
1676        unsafe extern "C" fn notify_protocols_trampoline<
1677            P: IsA<RTSPStream>,
1678            F: Fn(&P) + Send + Sync + 'static,
1679        >(
1680            this: *mut ffi::GstRTSPStream,
1681            _param_spec: glib::ffi::gpointer,
1682            f: glib::ffi::gpointer,
1683        ) {
1684            let f: &F = &*(f as *const F);
1685            f(RTSPStream::from_glib_borrow(this).unsafe_cast_ref())
1686        }
1687        unsafe {
1688            let f: Box_<F> = Box_::new(f);
1689            connect_raw(
1690                self.as_ptr() as *mut _,
1691                b"notify::protocols\0".as_ptr() as *const _,
1692                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1693                    notify_protocols_trampoline::<Self, F> as *const (),
1694                )),
1695                Box_::into_raw(f),
1696            )
1697        }
1698    }
1699}
1700
1701impl<O: IsA<RTSPStream>> RTSPStreamExt for O {}