1use 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 #[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 #[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
100pub trait RTSPStreamExt: IsA<RTSPStream> + sealed::Sealed + 'static {
106 #[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 #[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_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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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_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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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_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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 {}