1use crate::{
7 RTSPAddress, RTSPAddressPool, RTSPFilterResult, RTSPPublishClockMode, RTSPStreamTransport, ffi,
8};
9use glib::{
10 object::ObjectType as _,
11 prelude::*,
12 signal::{SignalHandlerId, connect_raw},
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 unsafe {
890 let stream = from_glib_borrow(stream);
891 let trans = from_glib_borrow(trans);
892 let callback = user_data
893 as *mut Option<
894 &mut dyn FnMut(&RTSPStream, &RTSPStreamTransport) -> RTSPFilterResult,
895 >;
896 if let Some(ref mut callback) = *callback {
897 callback(&stream, &trans)
898 } else {
899 panic!("cannot get closure...")
900 }
901 .into_glib()
902 }
903 }
904 let func = if func_data.is_some() {
905 Some(func_func as _)
906 } else {
907 None
908 };
909 let super_callback0: &mut Option<
910 &mut dyn FnMut(&RTSPStream, &RTSPStreamTransport) -> RTSPFilterResult,
911 > = &mut func_data;
912 unsafe {
913 FromGlibPtrContainer::from_glib_full(ffi::gst_rtsp_stream_transport_filter(
914 self.as_ref().to_glib_none().0,
915 func,
916 super_callback0 as *mut _ as *mut _,
917 ))
918 }
919 }
920
921 #[doc(alias = "gst_rtsp_stream_unblock_linked")]
922 fn unblock_linked(&self) -> Result<(), glib::error::BoolError> {
923 unsafe {
924 glib::result_from_gboolean!(
925 ffi::gst_rtsp_stream_unblock_linked(self.as_ref().to_glib_none().0),
926 "Failed to unblock the dataflow"
927 )
928 }
929 }
930
931 #[cfg(feature = "v1_20")]
932 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
933 #[doc(alias = "gst_rtsp_stream_unblock_rtcp")]
934 fn unblock_rtcp(&self) {
935 unsafe {
936 ffi::gst_rtsp_stream_unblock_rtcp(self.as_ref().to_glib_none().0);
937 }
938 }
939
940 #[doc(alias = "gst_rtsp_stream_update_crypto")]
941 fn update_crypto(
942 &self,
943 ssrc: u32,
944 crypto: Option<&gst::Caps>,
945 ) -> Result<(), glib::error::BoolError> {
946 unsafe {
947 glib::result_from_gboolean!(
948 ffi::gst_rtsp_stream_update_crypto(
949 self.as_ref().to_glib_none().0,
950 ssrc,
951 crypto.to_glib_none().0
952 ),
953 "Failed to update crypto"
954 )
955 }
956 }
957
958 #[cfg(feature = "v1_16")]
959 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
960 #[doc(alias = "gst_rtsp_stream_verify_mcast_ttl")]
961 fn verify_mcast_ttl(&self, ttl: u32) -> bool {
962 unsafe {
963 from_glib(ffi::gst_rtsp_stream_verify_mcast_ttl(
964 self.as_ref().to_glib_none().0,
965 ttl,
966 ))
967 }
968 }
969
970 #[doc(alias = "new-rtcp-encoder")]
971 fn connect_new_rtcp_encoder<F: Fn(&Self, &gst::Element) + Send + Sync + 'static>(
972 &self,
973 f: F,
974 ) -> SignalHandlerId {
975 unsafe extern "C" fn new_rtcp_encoder_trampoline<
976 P: IsA<RTSPStream>,
977 F: Fn(&P, &gst::Element) + Send + Sync + 'static,
978 >(
979 this: *mut ffi::GstRTSPStream,
980 object: *mut gst::ffi::GstElement,
981 f: glib::ffi::gpointer,
982 ) {
983 unsafe {
984 let f: &F = &*(f as *const F);
985 f(
986 RTSPStream::from_glib_borrow(this).unsafe_cast_ref(),
987 &from_glib_borrow(object),
988 )
989 }
990 }
991 unsafe {
992 let f: Box_<F> = Box_::new(f);
993 connect_raw(
994 self.as_ptr() as *mut _,
995 c"new-rtcp-encoder".as_ptr(),
996 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
997 new_rtcp_encoder_trampoline::<Self, F> as *const (),
998 )),
999 Box_::into_raw(f),
1000 )
1001 }
1002 }
1003
1004 #[doc(alias = "new-rtp-encoder")]
1005 fn connect_new_rtp_encoder<F: Fn(&Self, &gst::Element) + Send + Sync + 'static>(
1006 &self,
1007 f: F,
1008 ) -> SignalHandlerId {
1009 unsafe extern "C" fn new_rtp_encoder_trampoline<
1010 P: IsA<RTSPStream>,
1011 F: Fn(&P, &gst::Element) + Send + Sync + 'static,
1012 >(
1013 this: *mut ffi::GstRTSPStream,
1014 object: *mut gst::ffi::GstElement,
1015 f: glib::ffi::gpointer,
1016 ) {
1017 unsafe {
1018 let f: &F = &*(f as *const F);
1019 f(
1020 RTSPStream::from_glib_borrow(this).unsafe_cast_ref(),
1021 &from_glib_borrow(object),
1022 )
1023 }
1024 }
1025 unsafe {
1026 let f: Box_<F> = Box_::new(f);
1027 connect_raw(
1028 self.as_ptr() as *mut _,
1029 c"new-rtp-encoder".as_ptr(),
1030 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1031 new_rtp_encoder_trampoline::<Self, F> as *const (),
1032 )),
1033 Box_::into_raw(f),
1034 )
1035 }
1036 }
1037
1038 #[doc(alias = "new-rtp-rtcp-decoder")]
1039 fn connect_new_rtp_rtcp_decoder<F: Fn(&Self, &gst::Element) + Send + Sync + 'static>(
1040 &self,
1041 f: F,
1042 ) -> SignalHandlerId {
1043 unsafe extern "C" fn new_rtp_rtcp_decoder_trampoline<
1044 P: IsA<RTSPStream>,
1045 F: Fn(&P, &gst::Element) + Send + Sync + 'static,
1046 >(
1047 this: *mut ffi::GstRTSPStream,
1048 object: *mut gst::ffi::GstElement,
1049 f: glib::ffi::gpointer,
1050 ) {
1051 unsafe {
1052 let f: &F = &*(f as *const F);
1053 f(
1054 RTSPStream::from_glib_borrow(this).unsafe_cast_ref(),
1055 &from_glib_borrow(object),
1056 )
1057 }
1058 }
1059 unsafe {
1060 let f: Box_<F> = Box_::new(f);
1061 connect_raw(
1062 self.as_ptr() as *mut _,
1063 c"new-rtp-rtcp-decoder".as_ptr(),
1064 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1065 new_rtp_rtcp_decoder_trampoline::<Self, F> as *const (),
1066 )),
1067 Box_::into_raw(f),
1068 )
1069 }
1070 }
1071
1072 #[doc(alias = "control")]
1073 fn connect_control_notify<F: Fn(&Self) + Send + Sync + 'static>(
1074 &self,
1075 f: F,
1076 ) -> SignalHandlerId {
1077 unsafe extern "C" fn notify_control_trampoline<
1078 P: IsA<RTSPStream>,
1079 F: Fn(&P) + Send + Sync + 'static,
1080 >(
1081 this: *mut ffi::GstRTSPStream,
1082 _param_spec: glib::ffi::gpointer,
1083 f: glib::ffi::gpointer,
1084 ) {
1085 unsafe {
1086 let f: &F = &*(f as *const F);
1087 f(RTSPStream::from_glib_borrow(this).unsafe_cast_ref())
1088 }
1089 }
1090 unsafe {
1091 let f: Box_<F> = Box_::new(f);
1092 connect_raw(
1093 self.as_ptr() as *mut _,
1094 c"notify::control".as_ptr(),
1095 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1096 notify_control_trampoline::<Self, F> as *const (),
1097 )),
1098 Box_::into_raw(f),
1099 )
1100 }
1101 }
1102
1103 #[doc(alias = "profiles")]
1104 fn connect_profiles_notify<F: Fn(&Self) + Send + Sync + 'static>(
1105 &self,
1106 f: F,
1107 ) -> SignalHandlerId {
1108 unsafe extern "C" fn notify_profiles_trampoline<
1109 P: IsA<RTSPStream>,
1110 F: Fn(&P) + Send + Sync + 'static,
1111 >(
1112 this: *mut ffi::GstRTSPStream,
1113 _param_spec: glib::ffi::gpointer,
1114 f: glib::ffi::gpointer,
1115 ) {
1116 unsafe {
1117 let f: &F = &*(f as *const F);
1118 f(RTSPStream::from_glib_borrow(this).unsafe_cast_ref())
1119 }
1120 }
1121 unsafe {
1122 let f: Box_<F> = Box_::new(f);
1123 connect_raw(
1124 self.as_ptr() as *mut _,
1125 c"notify::profiles".as_ptr(),
1126 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1127 notify_profiles_trampoline::<Self, F> as *const (),
1128 )),
1129 Box_::into_raw(f),
1130 )
1131 }
1132 }
1133
1134 #[doc(alias = "protocols")]
1135 fn connect_protocols_notify<F: Fn(&Self) + Send + Sync + 'static>(
1136 &self,
1137 f: F,
1138 ) -> SignalHandlerId {
1139 unsafe extern "C" fn notify_protocols_trampoline<
1140 P: IsA<RTSPStream>,
1141 F: Fn(&P) + Send + Sync + 'static,
1142 >(
1143 this: *mut ffi::GstRTSPStream,
1144 _param_spec: glib::ffi::gpointer,
1145 f: glib::ffi::gpointer,
1146 ) {
1147 unsafe {
1148 let f: &F = &*(f as *const F);
1149 f(RTSPStream::from_glib_borrow(this).unsafe_cast_ref())
1150 }
1151 }
1152 unsafe {
1153 let f: Box_<F> = Box_::new(f);
1154 connect_raw(
1155 self.as_ptr() as *mut _,
1156 c"notify::protocols".as_ptr(),
1157 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1158 notify_protocols_trampoline::<Self, F> as *const (),
1159 )),
1160 Box_::into_raw(f),
1161 )
1162 }
1163 }
1164}
1165
1166impl<O: IsA<RTSPStream>> RTSPStreamExt for O {}