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::{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 = "GstWebRTCRTPSender")]
23 pub struct WebRTCRTPSender(Object<ffi::GstWebRTCRTPSender, ffi::GstWebRTCRTPSenderClass>) @extends gst::Object;
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 unsafe {
68 let f: &F = &*(f as *const F);
69 f(&from_glib_borrow(this))
70 }
71 }
72 unsafe {
73 let f: Box_<F> = Box_::new(f);
74 connect_raw(
75 self.as_ptr() as *mut _,
76 c"notify::priority".as_ptr(),
77 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
78 notify_priority_trampoline::<F> as *const (),
79 )),
80 Box_::into_raw(f),
81 )
82 }
83 }
84
85 #[cfg(feature = "v1_20")]
86 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
87 #[doc(alias = "transport")]
88 pub fn connect_transport_notify<F: Fn(&Self) + Send + Sync + 'static>(
89 &self,
90 f: F,
91 ) -> SignalHandlerId {
92 unsafe extern "C" fn notify_transport_trampoline<
93 F: Fn(&WebRTCRTPSender) + Send + Sync + 'static,
94 >(
95 this: *mut ffi::GstWebRTCRTPSender,
96 _param_spec: glib::ffi::gpointer,
97 f: glib::ffi::gpointer,
98 ) {
99 unsafe {
100 let f: &F = &*(f as *const F);
101 f(&from_glib_borrow(this))
102 }
103 }
104 unsafe {
105 let f: Box_<F> = Box_::new(f);
106 connect_raw(
107 self.as_ptr() as *mut _,
108 c"notify::transport".as_ptr(),
109 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
110 notify_transport_trampoline::<F> as *const (),
111 )),
112 Box_::into_raw(f),
113 )
114 }
115 }
116}
117
118unsafe impl Send for WebRTCRTPSender {}
119unsafe impl Sync for WebRTCRTPSender {}