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
95pub trait RTSPStreamExt: IsA<RTSPStream> + 'static {
101 #[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 #[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_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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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_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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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_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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 {}