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