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")]
60 pub struct WebRTCRTPSender(Object<ffi::GstWebRTCRTPSender, ffi::GstWebRTCRTPSenderClass>) @extends gst::Object;
61
62 match fn {
63 type_ => || ffi::gst_webrtc_rtp_sender_get_type(),
64 }
65}
66
67impl WebRTCRTPSender {
68 #[cfg(feature = "v1_20")]
74 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
75 #[doc(alias = "gst_webrtc_rtp_sender_set_priority")]
76 #[doc(alias = "priority")]
77 pub fn set_priority(&self, priority: WebRTCPriorityType) {
78 unsafe {
79 ffi::gst_webrtc_rtp_sender_set_priority(self.to_glib_none().0, priority.into_glib());
80 }
81 }
82
83 #[cfg(feature = "v1_20")]
85 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
86 pub fn priority(&self) -> WebRTCPriorityType {
87 ObjectExt::property(self, "priority")
88 }
89
90 #[cfg(feature = "v1_20")]
92 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
93 pub fn transport(&self) -> Option<WebRTCDTLSTransport> {
94 ObjectExt::property(self, "transport")
95 }
96
97 #[cfg(feature = "v1_20")]
98 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
99 #[doc(alias = "priority")]
100 pub fn connect_priority_notify<F: Fn(&Self) + Send + Sync + 'static>(
101 &self,
102 f: F,
103 ) -> SignalHandlerId {
104 unsafe extern "C" fn notify_priority_trampoline<
105 F: Fn(&WebRTCRTPSender) + Send + Sync + 'static,
106 >(
107 this: *mut ffi::GstWebRTCRTPSender,
108 _param_spec: glib::ffi::gpointer,
109 f: glib::ffi::gpointer,
110 ) {
111 unsafe {
112 let f: &F = &*(f as *const F);
113 f(&from_glib_borrow(this))
114 }
115 }
116 unsafe {
117 let f: Box_<F> = Box_::new(f);
118 connect_raw(
119 self.as_ptr() as *mut _,
120 c"notify::priority".as_ptr(),
121 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
122 notify_priority_trampoline::<F> as *const (),
123 )),
124 Box_::into_raw(f),
125 )
126 }
127 }
128
129 #[cfg(feature = "v1_20")]
130 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
131 #[doc(alias = "transport")]
132 pub fn connect_transport_notify<F: Fn(&Self) + Send + Sync + 'static>(
133 &self,
134 f: F,
135 ) -> SignalHandlerId {
136 unsafe extern "C" fn notify_transport_trampoline<
137 F: Fn(&WebRTCRTPSender) + Send + Sync + 'static,
138 >(
139 this: *mut ffi::GstWebRTCRTPSender,
140 _param_spec: glib::ffi::gpointer,
141 f: glib::ffi::gpointer,
142 ) {
143 unsafe {
144 let f: &F = &*(f as *const F);
145 f(&from_glib_borrow(this))
146 }
147 }
148 unsafe {
149 let f: Box_<F> = Box_::new(f);
150 connect_raw(
151 self.as_ptr() as *mut _,
152 c"notify::transport".as_ptr(),
153 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
154 notify_transport_trampoline::<F> as *const (),
155 )),
156 Box_::into_raw(f),
157 )
158 }
159 }
160}
161
162unsafe impl Send for WebRTCRTPSender {}
163unsafe impl Sync for WebRTCRTPSender {}