gstreamer_webrtc/auto/
web_rtcrtp_receiver.rs1#[cfg(feature = "v1_20")]
7#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
8use crate::WebRTCDTLSTransport;
9use crate::ffi;
10#[cfg(feature = "v1_20")]
11#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
12use glib::{
13 prelude::*,
14 signal::{SignalHandlerId, connect_raw},
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>) @extends gst::Object;
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 unsafe {
84 let f: &F = &*(f as *const F);
85 f(&from_glib_borrow(this))
86 }
87 }
88 unsafe {
89 let f: Box_<F> = Box_::new(f);
90 connect_raw(
91 self.as_ptr() as *mut _,
92 c"notify::transport".as_ptr(),
93 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
94 notify_transport_trampoline::<F> as *const (),
95 )),
96 Box_::into_raw(f),
97 )
98 }
99 }
100}
101
102unsafe impl Send for WebRTCRTPReceiver {}
103unsafe impl Sync for WebRTCRTPReceiver {}