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    #[doc(alias = "GstWebRTCRTPReceiver")]
23    pub struct WebRTCRTPReceiver(Object<ffi::GstWebRTCRTPReceiver, ffi::GstWebRTCRTPReceiverClass>);
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            let f: &F = &*(f as *const F);
52            f(&from_glib_borrow(this))
53        }
54        unsafe {
55            let f: Box_<F> = Box_::new(f);
56            connect_raw(
57                self.as_ptr() as *mut _,
58                b"notify::transport\0".as_ptr() as *const _,
59                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
60                    notify_transport_trampoline::<F> as *const (),
61                )),
62                Box_::into_raw(f),
63            )
64        }
65    }
66}
67
68unsafe impl Send for WebRTCRTPReceiver {}
69unsafe impl Sync for WebRTCRTPReceiver {}