gstreamer_webrtc/auto/
web_rtcrtp_sender.rs1use crate::ffi;
7#[cfg(feature = "v1_20")]
8#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
9use crate::{WebRTCDTLSTransport, WebRTCPriorityType};
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 = "GstWebRTCRTPSender")]
23 pub struct WebRTCRTPSender(Object<ffi::GstWebRTCRTPSender, ffi::GstWebRTCRTPSenderClass>);
24
25 match fn {
26 type_ => || ffi::gst_webrtc_rtp_sender_get_type(),
27 }
28}
29
30impl WebRTCRTPSender {
31 #[cfg(feature = "v1_20")]
32 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
33 #[doc(alias = "gst_webrtc_rtp_sender_set_priority")]
34 #[doc(alias = "priority")]
35 pub fn set_priority(&self, priority: WebRTCPriorityType) {
36 unsafe {
37 ffi::gst_webrtc_rtp_sender_set_priority(self.to_glib_none().0, priority.into_glib());
38 }
39 }
40
41 #[cfg(feature = "v1_20")]
42 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
43 pub fn priority(&self) -> WebRTCPriorityType {
44 ObjectExt::property(self, "priority")
45 }
46
47 #[cfg(feature = "v1_20")]
48 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
49 pub fn transport(&self) -> Option<WebRTCDTLSTransport> {
50 ObjectExt::property(self, "transport")
51 }
52
53 #[cfg(feature = "v1_20")]
54 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
55 #[doc(alias = "priority")]
56 pub fn connect_priority_notify<F: Fn(&Self) + Send + Sync + 'static>(
57 &self,
58 f: F,
59 ) -> SignalHandlerId {
60 unsafe extern "C" fn notify_priority_trampoline<
61 F: Fn(&WebRTCRTPSender) + Send + Sync + 'static,
62 >(
63 this: *mut ffi::GstWebRTCRTPSender,
64 _param_spec: glib::ffi::gpointer,
65 f: glib::ffi::gpointer,
66 ) {
67 let f: &F = &*(f as *const F);
68 f(&from_glib_borrow(this))
69 }
70 unsafe {
71 let f: Box_<F> = Box_::new(f);
72 connect_raw(
73 self.as_ptr() as *mut _,
74 b"notify::priority\0".as_ptr() as *const _,
75 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
76 notify_priority_trampoline::<F> as *const (),
77 )),
78 Box_::into_raw(f),
79 )
80 }
81 }
82
83 #[cfg(feature = "v1_20")]
84 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
85 #[doc(alias = "transport")]
86 pub fn connect_transport_notify<F: Fn(&Self) + Send + Sync + 'static>(
87 &self,
88 f: F,
89 ) -> SignalHandlerId {
90 unsafe extern "C" fn notify_transport_trampoline<
91 F: Fn(&WebRTCRTPSender) + Send + Sync + 'static,
92 >(
93 this: *mut ffi::GstWebRTCRTPSender,
94 _param_spec: glib::ffi::gpointer,
95 f: glib::ffi::gpointer,
96 ) {
97 let f: &F = &*(f as *const F);
98 f(&from_glib_borrow(this))
99 }
100 unsafe {
101 let f: Box_<F> = Box_::new(f);
102 connect_raw(
103 self.as_ptr() as *mut _,
104 b"notify::transport\0".as_ptr() as *const _,
105 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
106 notify_transport_trampoline::<F> as *const (),
107 )),
108 Box_::into_raw(f),
109 )
110 }
111 }
112}
113
114unsafe impl Send for WebRTCRTPSender {}
115unsafe impl Sync for WebRTCRTPSender {}