gstreamer_webrtc/auto/
web_rtcrtp_receiver.rs
1use crate::ffi;
7#[cfg(feature = "v1_20")]
8#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
9use crate::WebRTCDTLSTransport;
10#[cfg(feature = "v1_20")]
11#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
12use glib::{
13 prelude::*,
14 signal::{connect_raw, SignalHandlerId},
15 translate::*,
16};
17#[cfg(feature = "v1_20")]
18#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
19use std::boxed::Box as Box_;
20
21glib::wrapper! {
22 #[doc(alias = "GstWebRTCRTPReceiver")]
54 pub struct WebRTCRTPReceiver(Object<ffi::GstWebRTCRTPReceiver, ffi::GstWebRTCRTPReceiverClass>);
55
56 match fn {
57 type_ => || ffi::gst_webrtc_rtp_receiver_get_type(),
58 }
59}
60
61impl WebRTCRTPReceiver {
62 #[cfg(feature = "v1_20")]
64 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
65 pub fn transport(&self) -> Option<WebRTCDTLSTransport> {
66 ObjectExt::property(self, "transport")
67 }
68
69 #[cfg(feature = "v1_20")]
70 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
71 #[doc(alias = "transport")]
72 pub fn connect_transport_notify<F: Fn(&Self) + Send + Sync + 'static>(
73 &self,
74 f: F,
75 ) -> SignalHandlerId {
76 unsafe extern "C" fn notify_transport_trampoline<
77 F: Fn(&WebRTCRTPReceiver) + Send + Sync + 'static,
78 >(
79 this: *mut ffi::GstWebRTCRTPReceiver,
80 _param_spec: glib::ffi::gpointer,
81 f: glib::ffi::gpointer,
82 ) {
83 let f: &F = &*(f as *const F);
84 f(&from_glib_borrow(this))
85 }
86 unsafe {
87 let f: Box_<F> = Box_::new(f);
88 connect_raw(
89 self.as_ptr() as *mut _,
90 c"notify::transport".as_ptr() as *const _,
91 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
92 notify_transport_trampoline::<F> as *const (),
93 )),
94 Box_::into_raw(f),
95 )
96 }
97 }
98}
99
100unsafe impl Send for WebRTCRTPReceiver {}
101unsafe impl Sync for WebRTCRTPReceiver {}