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")]
19 pub struct RTSPStream(Object<ffi::GstRTSPStream, ffi::GstRTSPStreamClass>);
20
21 match fn {
22 type_ => || ffi::gst_rtsp_stream_get_type(),
23 }
24}
25
26impl RTSPStream {
27 pub const NONE: Option<&'static RTSPStream> = None;
28
29 #[doc(alias = "gst_rtsp_stream_new")]
30 pub fn new(
31 idx: u32,
32 payloader: &impl IsA<gst::Element>,
33 pad: &impl IsA<gst::Pad>,
34 ) -> RTSPStream {
35 assert_initialized_main_thread!();
36 unsafe {
37 from_glib_full(ffi::gst_rtsp_stream_new(
38 idx,
39 payloader.as_ref().to_glib_none().0,
40 pad.as_ref().to_glib_none().0,
41 ))
42 }
43 }
44}
45
46unsafe impl Send for RTSPStream {}
47unsafe impl Sync for RTSPStream {}
48
49pub trait RTSPStreamExt: IsA<RTSPStream> + 'static {
50 #[cfg(feature = "v1_16")]
51 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
52 #[doc(alias = "gst_rtsp_stream_add_multicast_client_address")]
53 fn add_multicast_client_address(
54 &self,
55 destination: &str,
56 rtp_port: u32,
57 rtcp_port: u32,
58 family: gio::SocketFamily,
59 ) -> bool {
60 unsafe {
61 from_glib(ffi::gst_rtsp_stream_add_multicast_client_address(
62 self.as_ref().to_glib_none().0,
63 destination.to_glib_none().0,
64 rtp_port,
65 rtcp_port,
66 family.into_glib(),
67 ))
68 }
69 }
70
71 #[doc(alias = "gst_rtsp_stream_add_transport")]
72 fn add_transport(
73 &self,
74 trans: &impl IsA<RTSPStreamTransport>,
75 ) -> Result<(), glib::error::BoolError> {
76 unsafe {
77 glib::result_from_gboolean!(
78 ffi::gst_rtsp_stream_add_transport(
79 self.as_ref().to_glib_none().0,
80 trans.as_ref().to_glib_none().0
81 ),
82 "Failed to add transport"
83 )
84 }
85 }
86
87 #[doc(alias = "gst_rtsp_stream_get_address_pool")]
98 #[doc(alias = "get_address_pool")]
99 fn address_pool(&self) -> Option<RTSPAddressPool> {
100 unsafe {
101 from_glib_full(ffi::gst_rtsp_stream_get_address_pool(
102 self.as_ref().to_glib_none().0,
103 ))
104 }
105 }
106
107 #[doc(alias = "gst_rtsp_stream_get_buffer_size")]
108 #[doc(alias = "get_buffer_size")]
109 fn buffer_size(&self) -> u32 {
110 unsafe { ffi::gst_rtsp_stream_get_buffer_size(self.as_ref().to_glib_none().0) }
111 }
112
113 #[doc(alias = "gst_rtsp_stream_get_caps")]
114 #[doc(alias = "get_caps")]
115 fn caps(&self) -> Option<gst::Caps> {
116 unsafe {
117 from_glib_full(ffi::gst_rtsp_stream_get_caps(
118 self.as_ref().to_glib_none().0,
119 ))
120 }
121 }
122
123 #[doc(alias = "gst_rtsp_stream_get_control")]
124 #[doc(alias = "get_control")]
125 fn control(&self) -> Option<glib::GString> {
126 unsafe {
127 from_glib_full(ffi::gst_rtsp_stream_get_control(
128 self.as_ref().to_glib_none().0,
129 ))
130 }
131 }
132
133 #[doc(alias = "gst_rtsp_stream_get_current_seqnum")]
134 #[doc(alias = "get_current_seqnum")]
135 fn current_seqnum(&self) -> u16 {
136 unsafe { ffi::gst_rtsp_stream_get_current_seqnum(self.as_ref().to_glib_none().0) }
137 }
138
139 #[doc(alias = "gst_rtsp_stream_get_dscp_qos")]
140 #[doc(alias = "get_dscp_qos")]
141 fn dscp_qos(&self) -> i32 {
142 unsafe { ffi::gst_rtsp_stream_get_dscp_qos(self.as_ref().to_glib_none().0) }
143 }
144
145 #[doc(alias = "gst_rtsp_stream_get_index")]
146 #[doc(alias = "get_index")]
147 fn index(&self) -> u32 {
148 unsafe { ffi::gst_rtsp_stream_get_index(self.as_ref().to_glib_none().0) }
149 }
150
151 #[doc(alias = "gst_rtsp_stream_get_joined_bin")]
152 #[doc(alias = "get_joined_bin")]
153 fn joined_bin(&self) -> Option<gst::Bin> {
154 unsafe {
155 from_glib_full(ffi::gst_rtsp_stream_get_joined_bin(
156 self.as_ref().to_glib_none().0,
157 ))
158 }
159 }
160
161 #[cfg(feature = "v1_16")]
162 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
163 #[doc(alias = "gst_rtsp_stream_get_max_mcast_ttl")]
164 #[doc(alias = "get_max_mcast_ttl")]
165 fn max_mcast_ttl(&self) -> u32 {
166 unsafe { ffi::gst_rtsp_stream_get_max_mcast_ttl(self.as_ref().to_glib_none().0) }
167 }
168
169 #[doc(alias = "gst_rtsp_stream_get_mtu")]
170 #[doc(alias = "get_mtu")]
171 fn mtu(&self) -> u32 {
172 unsafe { ffi::gst_rtsp_stream_get_mtu(self.as_ref().to_glib_none().0) }
173 }
174
175 #[doc(alias = "gst_rtsp_stream_get_multicast_address")]
176 #[doc(alias = "get_multicast_address")]
177 fn multicast_address(&self, family: gio::SocketFamily) -> Option<RTSPAddress> {
178 unsafe {
179 from_glib_full(ffi::gst_rtsp_stream_get_multicast_address(
180 self.as_ref().to_glib_none().0,
181 family.into_glib(),
182 ))
183 }
184 }
185
186 #[cfg(feature = "v1_16")]
187 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
188 #[doc(alias = "gst_rtsp_stream_get_multicast_client_addresses")]
189 #[doc(alias = "get_multicast_client_addresses")]
190 fn multicast_client_addresses(&self) -> glib::GString {
191 unsafe {
192 from_glib_full(ffi::gst_rtsp_stream_get_multicast_client_addresses(
193 self.as_ref().to_glib_none().0,
194 ))
195 }
196 }
197
198 #[doc(alias = "gst_rtsp_stream_get_multicast_iface")]
199 #[doc(alias = "get_multicast_iface")]
200 fn multicast_iface(&self) -> Option<glib::GString> {
201 unsafe {
202 from_glib_full(ffi::gst_rtsp_stream_get_multicast_iface(
203 self.as_ref().to_glib_none().0,
204 ))
205 }
206 }
207
208 #[doc(alias = "gst_rtsp_stream_get_profiles")]
209 #[doc(alias = "get_profiles")]
210 fn profiles(&self) -> gst_rtsp::RTSPProfile {
211 unsafe {
212 from_glib(ffi::gst_rtsp_stream_get_profiles(
213 self.as_ref().to_glib_none().0,
214 ))
215 }
216 }
217
218 #[doc(alias = "gst_rtsp_stream_get_protocols")]
219 #[doc(alias = "get_protocols")]
220 fn protocols(&self) -> gst_rtsp::RTSPLowerTrans {
221 unsafe {
222 from_glib(ffi::gst_rtsp_stream_get_protocols(
223 self.as_ref().to_glib_none().0,
224 ))
225 }
226 }
227
228 #[doc(alias = "gst_rtsp_stream_get_pt")]
229 #[doc(alias = "get_pt")]
230 fn pt(&self) -> u32 {
231 unsafe { ffi::gst_rtsp_stream_get_pt(self.as_ref().to_glib_none().0) }
232 }
233
234 #[doc(alias = "gst_rtsp_stream_get_publish_clock_mode")]
235 #[doc(alias = "get_publish_clock_mode")]
236 fn publish_clock_mode(&self) -> RTSPPublishClockMode {
237 unsafe {
238 from_glib(ffi::gst_rtsp_stream_get_publish_clock_mode(
239 self.as_ref().to_glib_none().0,
240 ))
241 }
242 }
243
244 #[cfg(feature = "v1_18")]
245 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
246 #[doc(alias = "gst_rtsp_stream_get_rate_control")]
247 #[doc(alias = "get_rate_control")]
248 fn is_rate_control(&self) -> bool {
249 unsafe {
250 from_glib(ffi::gst_rtsp_stream_get_rate_control(
251 self.as_ref().to_glib_none().0,
252 ))
253 }
254 }
255
256 #[cfg(feature = "v1_18")]
257 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
258 #[doc(alias = "gst_rtsp_stream_get_rates")]
259 #[doc(alias = "get_rates")]
260 fn rates(&self) -> Option<(f64, f64)> {
261 unsafe {
262 let mut rate = std::mem::MaybeUninit::uninit();
263 let mut applied_rate = std::mem::MaybeUninit::uninit();
264 let ret = from_glib(ffi::gst_rtsp_stream_get_rates(
265 self.as_ref().to_glib_none().0,
266 rate.as_mut_ptr(),
267 applied_rate.as_mut_ptr(),
268 ));
269 if ret {
270 Some((rate.assume_init(), applied_rate.assume_init()))
271 } else {
272 None
273 }
274 }
275 }
276
277 #[doc(alias = "gst_rtsp_stream_get_retransmission_pt")]
278 #[doc(alias = "get_retransmission_pt")]
279 fn retransmission_pt(&self) -> u32 {
280 unsafe { ffi::gst_rtsp_stream_get_retransmission_pt(self.as_ref().to_glib_none().0) }
281 }
282
283 #[doc(alias = "gst_rtsp_stream_get_retransmission_time")]
284 #[doc(alias = "get_retransmission_time")]
285 fn retransmission_time(&self) -> Option<gst::ClockTime> {
286 unsafe {
287 from_glib(ffi::gst_rtsp_stream_get_retransmission_time(
288 self.as_ref().to_glib_none().0,
289 ))
290 }
291 }
292
293 #[doc(alias = "gst_rtsp_stream_get_rtcp_multicast_socket")]
294 #[doc(alias = "get_rtcp_multicast_socket")]
295 fn rtcp_multicast_socket(&self, family: gio::SocketFamily) -> Option<gio::Socket> {
296 unsafe {
297 from_glib_full(ffi::gst_rtsp_stream_get_rtcp_multicast_socket(
298 self.as_ref().to_glib_none().0,
299 family.into_glib(),
300 ))
301 }
302 }
303
304 #[doc(alias = "gst_rtsp_stream_get_rtcp_socket")]
305 #[doc(alias = "get_rtcp_socket")]
306 fn rtcp_socket(&self, family: gio::SocketFamily) -> Option<gio::Socket> {
307 unsafe {
308 from_glib_full(ffi::gst_rtsp_stream_get_rtcp_socket(
309 self.as_ref().to_glib_none().0,
310 family.into_glib(),
311 ))
312 }
313 }
314
315 #[doc(alias = "gst_rtsp_stream_get_rtp_multicast_socket")]
316 #[doc(alias = "get_rtp_multicast_socket")]
317 fn rtp_multicast_socket(&self, family: gio::SocketFamily) -> Option<gio::Socket> {
318 unsafe {
319 from_glib_full(ffi::gst_rtsp_stream_get_rtp_multicast_socket(
320 self.as_ref().to_glib_none().0,
321 family.into_glib(),
322 ))
323 }
324 }
325
326 #[doc(alias = "gst_rtsp_stream_get_rtp_socket")]
327 #[doc(alias = "get_rtp_socket")]
328 fn rtp_socket(&self, family: gio::SocketFamily) -> Option<gio::Socket> {
329 unsafe {
330 from_glib_full(ffi::gst_rtsp_stream_get_rtp_socket(
331 self.as_ref().to_glib_none().0,
332 family.into_glib(),
333 ))
334 }
335 }
336
337 #[doc(alias = "gst_rtsp_stream_get_rtpinfo")]
338 #[doc(alias = "get_rtpinfo")]
339 fn rtpinfo(&self) -> Option<(u32, u32, u32, Option<gst::ClockTime>)> {
340 unsafe {
341 let mut rtptime = std::mem::MaybeUninit::uninit();
342 let mut seq = std::mem::MaybeUninit::uninit();
343 let mut clock_rate = std::mem::MaybeUninit::uninit();
344 let mut running_time = std::mem::MaybeUninit::uninit();
345 let ret = from_glib(ffi::gst_rtsp_stream_get_rtpinfo(
346 self.as_ref().to_glib_none().0,
347 rtptime.as_mut_ptr(),
348 seq.as_mut_ptr(),
349 clock_rate.as_mut_ptr(),
350 running_time.as_mut_ptr(),
351 ));
352 if ret {
353 Some((
354 rtptime.assume_init(),
355 seq.assume_init(),
356 clock_rate.assume_init(),
357 from_glib(running_time.assume_init()),
358 ))
359 } else {
360 None
361 }
362 }
363 }
364
365 #[doc(alias = "gst_rtsp_stream_get_rtpsession")]
366 #[doc(alias = "get_rtpsession")]
367 fn rtpsession(&self) -> Option<glib::Object> {
368 unsafe {
369 from_glib_full(ffi::gst_rtsp_stream_get_rtpsession(
370 self.as_ref().to_glib_none().0,
371 ))
372 }
373 }
374
375 #[doc(alias = "gst_rtsp_stream_get_sinkpad")]
382 #[doc(alias = "get_sinkpad")]
383 fn sinkpad(&self) -> Option<gst::Pad> {
384 unsafe {
385 from_glib_full(ffi::gst_rtsp_stream_get_sinkpad(
386 self.as_ref().to_glib_none().0,
387 ))
388 }
389 }
390
391 #[doc(alias = "gst_rtsp_stream_get_srcpad")]
392 #[doc(alias = "get_srcpad")]
393 fn srcpad(&self) -> Option<gst::Pad> {
394 unsafe {
395 from_glib_full(ffi::gst_rtsp_stream_get_srcpad(
396 self.as_ref().to_glib_none().0,
397 ))
398 }
399 }
400
401 #[doc(alias = "gst_rtsp_stream_get_srtp_encoder")]
402 #[doc(alias = "get_srtp_encoder")]
403 fn srtp_encoder(&self) -> Option<gst::Element> {
404 unsafe {
405 from_glib_full(ffi::gst_rtsp_stream_get_srtp_encoder(
406 self.as_ref().to_glib_none().0,
407 ))
408 }
409 }
410
411 #[doc(alias = "gst_rtsp_stream_get_ssrc")]
412 #[doc(alias = "get_ssrc")]
413 fn ssrc(&self) -> u32 {
414 unsafe {
415 let mut ssrc = std::mem::MaybeUninit::uninit();
416 ffi::gst_rtsp_stream_get_ssrc(self.as_ref().to_glib_none().0, ssrc.as_mut_ptr());
417 ssrc.assume_init()
418 }
419 }
420
421 #[doc(alias = "gst_rtsp_stream_get_ulpfec_enabled")]
422 #[doc(alias = "get_ulpfec_enabled")]
423 fn is_ulpfec_enabled(&self) -> bool {
424 unsafe {
425 from_glib(ffi::gst_rtsp_stream_get_ulpfec_enabled(
426 self.as_ref().to_glib_none().0,
427 ))
428 }
429 }
430
431 #[cfg(feature = "v1_16")]
432 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
433 #[doc(alias = "gst_rtsp_stream_get_ulpfec_percentage")]
434 #[doc(alias = "get_ulpfec_percentage")]
435 fn ulpfec_percentage(&self) -> u32 {
436 unsafe { ffi::gst_rtsp_stream_get_ulpfec_percentage(self.as_ref().to_glib_none().0) }
437 }
438
439 #[cfg(feature = "v1_16")]
440 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
441 #[doc(alias = "gst_rtsp_stream_get_ulpfec_pt")]
442 #[doc(alias = "get_ulpfec_pt")]
443 fn ulpfec_pt(&self) -> u32 {
444 unsafe { ffi::gst_rtsp_stream_get_ulpfec_pt(self.as_ref().to_glib_none().0) }
445 }
446
447 #[cfg(feature = "v1_16")]
448 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
449 #[doc(alias = "gst_rtsp_stream_handle_keymgmt")]
450 fn handle_keymgmt(&self, keymgmt: &str) -> bool {
451 unsafe {
452 from_glib(ffi::gst_rtsp_stream_handle_keymgmt(
453 self.as_ref().to_glib_none().0,
454 keymgmt.to_glib_none().0,
455 ))
456 }
457 }
458
459 #[doc(alias = "gst_rtsp_stream_has_control")]
460 fn has_control(&self, control: Option<&str>) -> bool {
461 unsafe {
462 from_glib(ffi::gst_rtsp_stream_has_control(
463 self.as_ref().to_glib_none().0,
464 control.to_glib_none().0,
465 ))
466 }
467 }
468
469 #[cfg(feature = "v1_16")]
470 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
471 #[doc(alias = "gst_rtsp_stream_is_bind_mcast_address")]
472 fn is_bind_mcast_address(&self) -> bool {
473 unsafe {
474 from_glib(ffi::gst_rtsp_stream_is_bind_mcast_address(
475 self.as_ref().to_glib_none().0,
476 ))
477 }
478 }
479
480 #[doc(alias = "gst_rtsp_stream_is_blocking")]
481 fn is_blocking(&self) -> bool {
482 unsafe {
483 from_glib(ffi::gst_rtsp_stream_is_blocking(
484 self.as_ref().to_glib_none().0,
485 ))
486 }
487 }
488
489 #[doc(alias = "gst_rtsp_stream_is_client_side")]
490 fn is_client_side(&self) -> bool {
491 unsafe {
492 from_glib(ffi::gst_rtsp_stream_is_client_side(
493 self.as_ref().to_glib_none().0,
494 ))
495 }
496 }
497
498 #[doc(alias = "gst_rtsp_stream_is_complete")]
499 fn is_complete(&self) -> bool {
500 unsafe {
501 from_glib(ffi::gst_rtsp_stream_is_complete(
502 self.as_ref().to_glib_none().0,
503 ))
504 }
505 }
506
507 #[doc(alias = "gst_rtsp_stream_is_receiver")]
508 fn is_receiver(&self) -> bool {
509 unsafe {
510 from_glib(ffi::gst_rtsp_stream_is_receiver(
511 self.as_ref().to_glib_none().0,
512 ))
513 }
514 }
515
516 #[doc(alias = "gst_rtsp_stream_is_sender")]
517 fn is_sender(&self) -> bool {
518 unsafe {
519 from_glib(ffi::gst_rtsp_stream_is_sender(
520 self.as_ref().to_glib_none().0,
521 ))
522 }
523 }
524
525 #[doc(alias = "gst_rtsp_stream_join_bin")]
531 fn join_bin(
532 &self,
533 bin: &impl IsA<gst::Bin>,
534 rtpbin: &impl IsA<gst::Element>,
535 state: gst::State,
536 ) -> Result<(), glib::error::BoolError> {
537 unsafe {
538 glib::result_from_gboolean!(
539 ffi::gst_rtsp_stream_join_bin(
540 self.as_ref().to_glib_none().0,
541 bin.as_ref().to_glib_none().0,
542 rtpbin.as_ref().to_glib_none().0,
543 state.into_glib()
544 ),
545 "Failed to join bin"
546 )
547 }
548 }
549
550 #[doc(alias = "gst_rtsp_stream_leave_bin")]
551 fn leave_bin(
552 &self,
553 bin: &impl IsA<gst::Bin>,
554 rtpbin: &impl IsA<gst::Element>,
555 ) -> Result<(), glib::error::BoolError> {
556 unsafe {
557 glib::result_from_gboolean!(
558 ffi::gst_rtsp_stream_leave_bin(
559 self.as_ref().to_glib_none().0,
560 bin.as_ref().to_glib_none().0,
561 rtpbin.as_ref().to_glib_none().0
562 ),
563 "Failed to leave bin"
564 )
565 }
566 }
567
568 #[doc(alias = "gst_rtsp_stream_recv_rtcp")]
569 fn recv_rtcp(&self, buffer: gst::Buffer) -> Result<gst::FlowSuccess, gst::FlowError> {
570 unsafe {
571 try_from_glib(ffi::gst_rtsp_stream_recv_rtcp(
572 self.as_ref().to_glib_none().0,
573 buffer.into_glib_ptr(),
574 ))
575 }
576 }
577
578 #[doc(alias = "gst_rtsp_stream_recv_rtp")]
579 fn recv_rtp(&self, buffer: gst::Buffer) -> Result<gst::FlowSuccess, gst::FlowError> {
580 unsafe {
581 try_from_glib(ffi::gst_rtsp_stream_recv_rtp(
582 self.as_ref().to_glib_none().0,
583 buffer.into_glib_ptr(),
584 ))
585 }
586 }
587
588 #[doc(alias = "gst_rtsp_stream_remove_transport")]
589 fn remove_transport(
590 &self,
591 trans: &impl IsA<RTSPStreamTransport>,
592 ) -> Result<(), glib::error::BoolError> {
593 unsafe {
594 glib::result_from_gboolean!(
595 ffi::gst_rtsp_stream_remove_transport(
596 self.as_ref().to_glib_none().0,
597 trans.as_ref().to_glib_none().0
598 ),
599 "Failed to remove transport"
600 )
601 }
602 }
603
604 #[cfg(feature = "v1_16")]
605 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
606 #[doc(alias = "gst_rtsp_stream_request_aux_receiver")]
607 fn request_aux_receiver(&self, sessid: u32) -> Option<gst::Element> {
608 unsafe {
609 from_glib_full(ffi::gst_rtsp_stream_request_aux_receiver(
610 self.as_ref().to_glib_none().0,
611 sessid,
612 ))
613 }
614 }
615
616 #[doc(alias = "gst_rtsp_stream_request_aux_sender")]
617 fn request_aux_sender(&self, sessid: u32) -> Option<gst::Element> {
618 unsafe {
619 from_glib_full(ffi::gst_rtsp_stream_request_aux_sender(
620 self.as_ref().to_glib_none().0,
621 sessid,
622 ))
623 }
624 }
625
626 #[cfg(feature = "v1_16")]
627 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
628 #[doc(alias = "gst_rtsp_stream_request_ulpfec_decoder")]
629 fn request_ulpfec_decoder(
630 &self,
631 rtpbin: &impl IsA<gst::Element>,
632 sessid: u32,
633 ) -> Option<gst::Element> {
634 unsafe {
635 from_glib_full(ffi::gst_rtsp_stream_request_ulpfec_decoder(
636 self.as_ref().to_glib_none().0,
637 rtpbin.as_ref().to_glib_none().0,
638 sessid,
639 ))
640 }
641 }
642
643 #[cfg(feature = "v1_16")]
644 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
645 #[doc(alias = "gst_rtsp_stream_request_ulpfec_encoder")]
646 fn request_ulpfec_encoder(&self, sessid: u32) -> Option<gst::Element> {
647 unsafe {
648 from_glib_full(ffi::gst_rtsp_stream_request_ulpfec_encoder(
649 self.as_ref().to_glib_none().0,
650 sessid,
651 ))
652 }
653 }
654
655 #[doc(alias = "gst_rtsp_stream_reserve_address")]
656 fn reserve_address(
657 &self,
658 address: &str,
659 port: u32,
660 n_ports: u32,
661 ttl: u32,
662 ) -> Option<RTSPAddress> {
663 unsafe {
664 from_glib_full(ffi::gst_rtsp_stream_reserve_address(
665 self.as_ref().to_glib_none().0,
666 address.to_glib_none().0,
667 port,
668 n_ports,
669 ttl,
670 ))
671 }
672 }
673
674 #[doc(alias = "gst_rtsp_stream_seekable")]
675 fn seekable(&self) -> bool {
676 unsafe {
677 from_glib(ffi::gst_rtsp_stream_seekable(
678 self.as_ref().to_glib_none().0,
679 ))
680 }
681 }
682
683 #[doc(alias = "gst_rtsp_stream_set_address_pool")]
684 fn set_address_pool(&self, pool: Option<&impl IsA<RTSPAddressPool>>) {
685 unsafe {
686 ffi::gst_rtsp_stream_set_address_pool(
687 self.as_ref().to_glib_none().0,
688 pool.map(|p| p.as_ref()).to_glib_none().0,
689 );
690 }
691 }
692
693 #[cfg(feature = "v1_16")]
694 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
695 #[doc(alias = "gst_rtsp_stream_set_bind_mcast_address")]
696 fn set_bind_mcast_address(&self, bind_mcast_addr: bool) {
697 unsafe {
698 ffi::gst_rtsp_stream_set_bind_mcast_address(
699 self.as_ref().to_glib_none().0,
700 bind_mcast_addr.into_glib(),
701 );
702 }
703 }
704
705 #[doc(alias = "gst_rtsp_stream_set_blocked")]
706 fn set_blocked(&self, blocked: bool) -> Result<(), glib::error::BoolError> {
707 unsafe {
708 glib::result_from_gboolean!(
709 ffi::gst_rtsp_stream_set_blocked(
710 self.as_ref().to_glib_none().0,
711 blocked.into_glib()
712 ),
713 "Failed to block/unblock the dataflow"
714 )
715 }
716 }
717
718 #[doc(alias = "gst_rtsp_stream_set_buffer_size")]
719 fn set_buffer_size(&self, size: u32) {
720 unsafe {
721 ffi::gst_rtsp_stream_set_buffer_size(self.as_ref().to_glib_none().0, size);
722 }
723 }
724
725 #[doc(alias = "gst_rtsp_stream_set_client_side")]
726 fn set_client_side(&self, client_side: bool) {
727 unsafe {
728 ffi::gst_rtsp_stream_set_client_side(
729 self.as_ref().to_glib_none().0,
730 client_side.into_glib(),
731 );
732 }
733 }
734
735 #[doc(alias = "gst_rtsp_stream_set_control")]
736 #[doc(alias = "control")]
737 fn set_control(&self, control: Option<&str>) {
738 unsafe {
739 ffi::gst_rtsp_stream_set_control(
740 self.as_ref().to_glib_none().0,
741 control.to_glib_none().0,
742 );
743 }
744 }
745
746 #[doc(alias = "gst_rtsp_stream_set_dscp_qos")]
747 fn set_dscp_qos(&self, dscp_qos: i32) {
748 unsafe {
749 ffi::gst_rtsp_stream_set_dscp_qos(self.as_ref().to_glib_none().0, dscp_qos);
750 }
751 }
752
753 #[cfg(feature = "v1_16")]
754 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
755 #[doc(alias = "gst_rtsp_stream_set_max_mcast_ttl")]
756 fn set_max_mcast_ttl(&self, ttl: u32) -> bool {
757 unsafe {
758 from_glib(ffi::gst_rtsp_stream_set_max_mcast_ttl(
759 self.as_ref().to_glib_none().0,
760 ttl,
761 ))
762 }
763 }
764
765 #[doc(alias = "gst_rtsp_stream_set_mtu")]
766 fn set_mtu(&self, mtu: u32) {
767 unsafe {
768 ffi::gst_rtsp_stream_set_mtu(self.as_ref().to_glib_none().0, mtu);
769 }
770 }
771
772 #[doc(alias = "gst_rtsp_stream_set_multicast_iface")]
773 fn set_multicast_iface(&self, multicast_iface: Option<&str>) {
774 unsafe {
775 ffi::gst_rtsp_stream_set_multicast_iface(
776 self.as_ref().to_glib_none().0,
777 multicast_iface.to_glib_none().0,
778 );
779 }
780 }
781
782 #[doc(alias = "gst_rtsp_stream_set_profiles")]
783 #[doc(alias = "profiles")]
784 fn set_profiles(&self, profiles: gst_rtsp::RTSPProfile) {
785 unsafe {
786 ffi::gst_rtsp_stream_set_profiles(self.as_ref().to_glib_none().0, profiles.into_glib());
787 }
788 }
789
790 #[doc(alias = "gst_rtsp_stream_set_protocols")]
791 #[doc(alias = "protocols")]
792 fn set_protocols(&self, protocols: gst_rtsp::RTSPLowerTrans) {
793 unsafe {
794 ffi::gst_rtsp_stream_set_protocols(
795 self.as_ref().to_glib_none().0,
796 protocols.into_glib(),
797 );
798 }
799 }
800
801 #[doc(alias = "gst_rtsp_stream_set_pt_map")]
802 fn set_pt_map(&self, pt: u32, caps: &gst::Caps) {
803 unsafe {
804 ffi::gst_rtsp_stream_set_pt_map(
805 self.as_ref().to_glib_none().0,
806 pt,
807 caps.to_glib_none().0,
808 );
809 }
810 }
811
812 #[doc(alias = "gst_rtsp_stream_set_publish_clock_mode")]
813 fn set_publish_clock_mode(&self, mode: RTSPPublishClockMode) {
814 unsafe {
815 ffi::gst_rtsp_stream_set_publish_clock_mode(
816 self.as_ref().to_glib_none().0,
817 mode.into_glib(),
818 );
819 }
820 }
821
822 #[cfg(feature = "v1_18")]
823 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
824 #[doc(alias = "gst_rtsp_stream_set_rate_control")]
825 fn set_rate_control(&self, enabled: bool) {
826 unsafe {
827 ffi::gst_rtsp_stream_set_rate_control(
828 self.as_ref().to_glib_none().0,
829 enabled.into_glib(),
830 );
831 }
832 }
833
834 #[doc(alias = "gst_rtsp_stream_set_retransmission_pt")]
835 fn set_retransmission_pt(&self, rtx_pt: u32) {
836 unsafe {
837 ffi::gst_rtsp_stream_set_retransmission_pt(self.as_ref().to_glib_none().0, rtx_pt);
838 }
839 }
840
841 #[doc(alias = "gst_rtsp_stream_set_retransmission_time")]
842 fn set_retransmission_time(&self, time: impl Into<Option<gst::ClockTime>>) {
843 unsafe {
844 ffi::gst_rtsp_stream_set_retransmission_time(
845 self.as_ref().to_glib_none().0,
846 time.into().into_glib(),
847 );
848 }
849 }
850
851 #[doc(alias = "gst_rtsp_stream_set_seqnum_offset")]
852 fn set_seqnum_offset(&self, seqnum: u16) {
853 unsafe {
854 ffi::gst_rtsp_stream_set_seqnum_offset(self.as_ref().to_glib_none().0, seqnum);
855 }
856 }
857
858 #[cfg(feature = "v1_16")]
859 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
860 #[doc(alias = "gst_rtsp_stream_set_ulpfec_percentage")]
861 fn set_ulpfec_percentage(&self, percentage: u32) {
862 unsafe {
863 ffi::gst_rtsp_stream_set_ulpfec_percentage(self.as_ref().to_glib_none().0, percentage);
864 }
865 }
866
867 #[cfg(feature = "v1_16")]
868 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
869 #[doc(alias = "gst_rtsp_stream_set_ulpfec_pt")]
870 fn set_ulpfec_pt(&self, pt: u32) {
871 unsafe {
872 ffi::gst_rtsp_stream_set_ulpfec_pt(self.as_ref().to_glib_none().0, pt);
873 }
874 }
875
876 #[doc(alias = "gst_rtsp_stream_transport_filter")]
877 fn transport_filter(
878 &self,
879 func: Option<&mut dyn FnMut(&RTSPStream, &RTSPStreamTransport) -> RTSPFilterResult>,
880 ) -> Vec<RTSPStreamTransport> {
881 let mut func_data: Option<
882 &mut dyn FnMut(&RTSPStream, &RTSPStreamTransport) -> RTSPFilterResult,
883 > = func;
884 unsafe extern "C" fn func_func(
885 stream: *mut ffi::GstRTSPStream,
886 trans: *mut ffi::GstRTSPStreamTransport,
887 user_data: glib::ffi::gpointer,
888 ) -> ffi::GstRTSPFilterResult {
889 let stream = from_glib_borrow(stream);
890 let trans = from_glib_borrow(trans);
891 let callback = user_data
892 as *mut Option<
893 &mut dyn FnMut(&RTSPStream, &RTSPStreamTransport) -> RTSPFilterResult,
894 >;
895 if let Some(ref mut callback) = *callback {
896 callback(&stream, &trans)
897 } else {
898 panic!("cannot get closure...")
899 }
900 .into_glib()
901 }
902 let func = if func_data.is_some() {
903 Some(func_func as _)
904 } else {
905 None
906 };
907 let super_callback0: &mut Option<
908 &mut dyn FnMut(&RTSPStream, &RTSPStreamTransport) -> RTSPFilterResult,
909 > = &mut func_data;
910 unsafe {
911 FromGlibPtrContainer::from_glib_full(ffi::gst_rtsp_stream_transport_filter(
912 self.as_ref().to_glib_none().0,
913 func,
914 super_callback0 as *mut _ as *mut _,
915 ))
916 }
917 }
918
919 #[doc(alias = "gst_rtsp_stream_unblock_linked")]
920 fn unblock_linked(&self) -> Result<(), glib::error::BoolError> {
921 unsafe {
922 glib::result_from_gboolean!(
923 ffi::gst_rtsp_stream_unblock_linked(self.as_ref().to_glib_none().0),
924 "Failed to unblock the dataflow"
925 )
926 }
927 }
928
929 #[cfg(feature = "v1_20")]
930 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
931 #[doc(alias = "gst_rtsp_stream_unblock_rtcp")]
932 fn unblock_rtcp(&self) {
933 unsafe {
934 ffi::gst_rtsp_stream_unblock_rtcp(self.as_ref().to_glib_none().0);
935 }
936 }
937
938 #[doc(alias = "gst_rtsp_stream_update_crypto")]
939 fn update_crypto(
940 &self,
941 ssrc: u32,
942 crypto: Option<&gst::Caps>,
943 ) -> Result<(), glib::error::BoolError> {
944 unsafe {
945 glib::result_from_gboolean!(
946 ffi::gst_rtsp_stream_update_crypto(
947 self.as_ref().to_glib_none().0,
948 ssrc,
949 crypto.to_glib_none().0
950 ),
951 "Failed to update crypto"
952 )
953 }
954 }
955
956 #[cfg(feature = "v1_16")]
957 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
958 #[doc(alias = "gst_rtsp_stream_verify_mcast_ttl")]
959 fn verify_mcast_ttl(&self, ttl: u32) -> bool {
960 unsafe {
961 from_glib(ffi::gst_rtsp_stream_verify_mcast_ttl(
962 self.as_ref().to_glib_none().0,
963 ttl,
964 ))
965 }
966 }
967
968 #[doc(alias = "new-rtcp-encoder")]
969 fn connect_new_rtcp_encoder<F: Fn(&Self, &gst::Element) + Send + Sync + 'static>(
970 &self,
971 f: F,
972 ) -> SignalHandlerId {
973 unsafe extern "C" fn new_rtcp_encoder_trampoline<
974 P: IsA<RTSPStream>,
975 F: Fn(&P, &gst::Element) + Send + Sync + 'static,
976 >(
977 this: *mut ffi::GstRTSPStream,
978 object: *mut gst::ffi::GstElement,
979 f: glib::ffi::gpointer,
980 ) {
981 let f: &F = &*(f as *const F);
982 f(
983 RTSPStream::from_glib_borrow(this).unsafe_cast_ref(),
984 &from_glib_borrow(object),
985 )
986 }
987 unsafe {
988 let f: Box_<F> = Box_::new(f);
989 connect_raw(
990 self.as_ptr() as *mut _,
991 c"new-rtcp-encoder".as_ptr() as *const _,
992 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
993 new_rtcp_encoder_trampoline::<Self, F> as *const (),
994 )),
995 Box_::into_raw(f),
996 )
997 }
998 }
999
1000 #[doc(alias = "new-rtp-encoder")]
1001 fn connect_new_rtp_encoder<F: Fn(&Self, &gst::Element) + Send + Sync + 'static>(
1002 &self,
1003 f: F,
1004 ) -> SignalHandlerId {
1005 unsafe extern "C" fn new_rtp_encoder_trampoline<
1006 P: IsA<RTSPStream>,
1007 F: Fn(&P, &gst::Element) + Send + Sync + 'static,
1008 >(
1009 this: *mut ffi::GstRTSPStream,
1010 object: *mut gst::ffi::GstElement,
1011 f: glib::ffi::gpointer,
1012 ) {
1013 let f: &F = &*(f as *const F);
1014 f(
1015 RTSPStream::from_glib_borrow(this).unsafe_cast_ref(),
1016 &from_glib_borrow(object),
1017 )
1018 }
1019 unsafe {
1020 let f: Box_<F> = Box_::new(f);
1021 connect_raw(
1022 self.as_ptr() as *mut _,
1023 c"new-rtp-encoder".as_ptr() as *const _,
1024 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1025 new_rtp_encoder_trampoline::<Self, F> as *const (),
1026 )),
1027 Box_::into_raw(f),
1028 )
1029 }
1030 }
1031
1032 #[doc(alias = "new-rtp-rtcp-decoder")]
1033 fn connect_new_rtp_rtcp_decoder<F: Fn(&Self, &gst::Element) + Send + Sync + 'static>(
1034 &self,
1035 f: F,
1036 ) -> SignalHandlerId {
1037 unsafe extern "C" fn new_rtp_rtcp_decoder_trampoline<
1038 P: IsA<RTSPStream>,
1039 F: Fn(&P, &gst::Element) + Send + Sync + 'static,
1040 >(
1041 this: *mut ffi::GstRTSPStream,
1042 object: *mut gst::ffi::GstElement,
1043 f: glib::ffi::gpointer,
1044 ) {
1045 let f: &F = &*(f as *const F);
1046 f(
1047 RTSPStream::from_glib_borrow(this).unsafe_cast_ref(),
1048 &from_glib_borrow(object),
1049 )
1050 }
1051 unsafe {
1052 let f: Box_<F> = Box_::new(f);
1053 connect_raw(
1054 self.as_ptr() as *mut _,
1055 c"new-rtp-rtcp-decoder".as_ptr() as *const _,
1056 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1057 new_rtp_rtcp_decoder_trampoline::<Self, F> as *const (),
1058 )),
1059 Box_::into_raw(f),
1060 )
1061 }
1062 }
1063
1064 #[doc(alias = "control")]
1065 fn connect_control_notify<F: Fn(&Self) + Send + Sync + 'static>(
1066 &self,
1067 f: F,
1068 ) -> SignalHandlerId {
1069 unsafe extern "C" fn notify_control_trampoline<
1070 P: IsA<RTSPStream>,
1071 F: Fn(&P) + Send + Sync + 'static,
1072 >(
1073 this: *mut ffi::GstRTSPStream,
1074 _param_spec: glib::ffi::gpointer,
1075 f: glib::ffi::gpointer,
1076 ) {
1077 let f: &F = &*(f as *const F);
1078 f(RTSPStream::from_glib_borrow(this).unsafe_cast_ref())
1079 }
1080 unsafe {
1081 let f: Box_<F> = Box_::new(f);
1082 connect_raw(
1083 self.as_ptr() as *mut _,
1084 c"notify::control".as_ptr() as *const _,
1085 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1086 notify_control_trampoline::<Self, F> as *const (),
1087 )),
1088 Box_::into_raw(f),
1089 )
1090 }
1091 }
1092
1093 #[doc(alias = "profiles")]
1094 fn connect_profiles_notify<F: Fn(&Self) + Send + Sync + 'static>(
1095 &self,
1096 f: F,
1097 ) -> SignalHandlerId {
1098 unsafe extern "C" fn notify_profiles_trampoline<
1099 P: IsA<RTSPStream>,
1100 F: Fn(&P) + Send + Sync + 'static,
1101 >(
1102 this: *mut ffi::GstRTSPStream,
1103 _param_spec: glib::ffi::gpointer,
1104 f: glib::ffi::gpointer,
1105 ) {
1106 let f: &F = &*(f as *const F);
1107 f(RTSPStream::from_glib_borrow(this).unsafe_cast_ref())
1108 }
1109 unsafe {
1110 let f: Box_<F> = Box_::new(f);
1111 connect_raw(
1112 self.as_ptr() as *mut _,
1113 c"notify::profiles".as_ptr() as *const _,
1114 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1115 notify_profiles_trampoline::<Self, F> as *const (),
1116 )),
1117 Box_::into_raw(f),
1118 )
1119 }
1120 }
1121
1122 #[doc(alias = "protocols")]
1123 fn connect_protocols_notify<F: Fn(&Self) + Send + Sync + 'static>(
1124 &self,
1125 f: F,
1126 ) -> SignalHandlerId {
1127 unsafe extern "C" fn notify_protocols_trampoline<
1128 P: IsA<RTSPStream>,
1129 F: Fn(&P) + Send + Sync + 'static,
1130 >(
1131 this: *mut ffi::GstRTSPStream,
1132 _param_spec: glib::ffi::gpointer,
1133 f: glib::ffi::gpointer,
1134 ) {
1135 let f: &F = &*(f as *const F);
1136 f(RTSPStream::from_glib_borrow(this).unsafe_cast_ref())
1137 }
1138 unsafe {
1139 let f: Box_<F> = Box_::new(f);
1140 connect_raw(
1141 self.as_ptr() as *mut _,
1142 c"notify::protocols".as_ptr() as *const _,
1143 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1144 notify_protocols_trampoline::<Self, F> as *const (),
1145 )),
1146 Box_::into_raw(f),
1147 )
1148 }
1149 }
1150}
1151
1152impl<O: IsA<RTSPStream>> RTSPStreamExt for O {}