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")]
23 pub struct WebRTCRTPReceiver(Object<ffi::GstWebRTCRTPReceiver, ffi::GstWebRTCRTPReceiverClass>) @extends gst::Object;
24
25 match fn {
26 type_ => || ffi::gst_webrtc_rtp_receiver_get_type(),
27 }
28}
29
30impl WebRTCRTPReceiver {
31 #[cfg(feature = "v1_20")]
32 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
33 pub fn transport(&self) -> Option<WebRTCDTLSTransport> {
34 ObjectExt::property(self, "transport")
35 }
36
37 #[cfg(feature = "v1_20")]
38 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
39 #[doc(alias = "transport")]
40 pub fn connect_transport_notify<F: Fn(&Self) + Send + Sync + 'static>(
41 &self,
42 f: F,
43 ) -> SignalHandlerId {
44 unsafe extern "C" fn notify_transport_trampoline<
45 F: Fn(&WebRTCRTPReceiver) + Send + Sync + 'static,
46 >(
47 this: *mut ffi::GstWebRTCRTPReceiver,
48 _param_spec: glib::ffi::gpointer,
49 f: glib::ffi::gpointer,
50 ) {
51 unsafe {
52 let f: &F = &*(f as *const F);
53 f(&from_glib_borrow(this))
54 }
55 }
56 unsafe {
57 let f: Box_<F> = Box_::new(f);
58 connect_raw(
59 self.as_ptr() as *mut _,
60 c"notify::transport".as_ptr(),
61 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
62 notify_transport_trampoline::<F> as *const (),
63 )),
64 Box_::into_raw(f),
65 )
66 }
67 }
68}
69
70unsafe impl Send for WebRTCRTPReceiver {}
71unsafe impl Sync for WebRTCRTPReceiver {}