gstreamer_webrtc/auto/
web_rtcrtp_receiver.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
4// DO NOT EDIT
5
6use 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    /// An object to track the receiving aspect of the stream
23    ///
24    /// Mostly matches the WebRTC RTCRtpReceiver interface.
25    ///
26    /// ## Properties
27    ///
28    ///
29    /// #### `transport`
30    ///  The DTLS transport for this receiver
31    ///
32    /// Readable
33    /// <details><summary><h4>Object</h4></summary>
34    ///
35    ///
36    /// #### `name`
37    ///  Readable | Writeable | Construct
38    ///
39    ///
40    /// #### `parent`
41    ///  The parent of the object. Please note, that when changing the 'parent'
42    /// property, we don't emit [`notify`][struct@crate::glib::Object#notify] and `GstObject::deep-notify`
43    /// signals due to locking issues. In some cases one can use
44    /// `GstBin::element-added` or `GstBin::element-removed` signals on the parent to
45    /// achieve a similar effect.
46    ///
47    /// Readable | Writeable
48    /// </details>
49    ///
50    /// # Implements
51    ///
52    /// [`trait@glib::ObjectExt`]
53    #[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    /// The DTLS transport for this receiver
63    #[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 {}