gstreamer_webrtc/auto/
web_rtcsctp_transport.rs
1use crate::{ffi, WebRTCDTLSTransport, WebRTCSCTPTransportState};
7use glib::{
8 prelude::*,
9 signal::{connect_raw, SignalHandlerId},
10 translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15 #[doc(alias = "GstWebRTCSCTPTransport")]
57 pub struct WebRTCSCTPTransport(Object<ffi::GstWebRTCSCTPTransport, ffi::GstWebRTCSCTPTransportClass>);
58
59 match fn {
60 type_ => || ffi::gst_webrtc_sctp_transport_get_type(),
61 }
62}
63
64impl WebRTCSCTPTransport {
65 #[doc(alias = "max-channels")]
66 pub fn max_channels(&self) -> u32 {
67 ObjectExt::property(self, "max-channels")
68 }
69
70 #[doc(alias = "max-message-size")]
71 pub fn max_message_size(&self) -> u64 {
72 ObjectExt::property(self, "max-message-size")
73 }
74
75 pub fn state(&self) -> WebRTCSCTPTransportState {
76 ObjectExt::property(self, "state")
77 }
78
79 pub fn transport(&self) -> Option<WebRTCDTLSTransport> {
80 ObjectExt::property(self, "transport")
81 }
82
83 #[doc(alias = "max-channels")]
84 pub fn connect_max_channels_notify<F: Fn(&Self) + Send + Sync + 'static>(
85 &self,
86 f: F,
87 ) -> SignalHandlerId {
88 unsafe extern "C" fn notify_max_channels_trampoline<
89 F: Fn(&WebRTCSCTPTransport) + Send + Sync + 'static,
90 >(
91 this: *mut ffi::GstWebRTCSCTPTransport,
92 _param_spec: glib::ffi::gpointer,
93 f: glib::ffi::gpointer,
94 ) {
95 let f: &F = &*(f as *const F);
96 f(&from_glib_borrow(this))
97 }
98 unsafe {
99 let f: Box_<F> = Box_::new(f);
100 connect_raw(
101 self.as_ptr() as *mut _,
102 c"notify::max-channels".as_ptr() as *const _,
103 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
104 notify_max_channels_trampoline::<F> as *const (),
105 )),
106 Box_::into_raw(f),
107 )
108 }
109 }
110
111 #[doc(alias = "max-message-size")]
112 pub fn connect_max_message_size_notify<F: Fn(&Self) + Send + Sync + 'static>(
113 &self,
114 f: F,
115 ) -> SignalHandlerId {
116 unsafe extern "C" fn notify_max_message_size_trampoline<
117 F: Fn(&WebRTCSCTPTransport) + Send + Sync + 'static,
118 >(
119 this: *mut ffi::GstWebRTCSCTPTransport,
120 _param_spec: glib::ffi::gpointer,
121 f: glib::ffi::gpointer,
122 ) {
123 let f: &F = &*(f as *const F);
124 f(&from_glib_borrow(this))
125 }
126 unsafe {
127 let f: Box_<F> = Box_::new(f);
128 connect_raw(
129 self.as_ptr() as *mut _,
130 c"notify::max-message-size".as_ptr() as *const _,
131 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
132 notify_max_message_size_trampoline::<F> as *const (),
133 )),
134 Box_::into_raw(f),
135 )
136 }
137 }
138
139 #[doc(alias = "state")]
140 pub fn connect_state_notify<F: Fn(&Self) + Send + Sync + 'static>(
141 &self,
142 f: F,
143 ) -> SignalHandlerId {
144 unsafe extern "C" fn notify_state_trampoline<
145 F: Fn(&WebRTCSCTPTransport) + Send + Sync + 'static,
146 >(
147 this: *mut ffi::GstWebRTCSCTPTransport,
148 _param_spec: glib::ffi::gpointer,
149 f: glib::ffi::gpointer,
150 ) {
151 let f: &F = &*(f as *const F);
152 f(&from_glib_borrow(this))
153 }
154 unsafe {
155 let f: Box_<F> = Box_::new(f);
156 connect_raw(
157 self.as_ptr() as *mut _,
158 c"notify::state".as_ptr() as *const _,
159 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
160 notify_state_trampoline::<F> as *const (),
161 )),
162 Box_::into_raw(f),
163 )
164 }
165 }
166
167 #[doc(alias = "transport")]
168 pub fn connect_transport_notify<F: Fn(&Self) + Send + Sync + 'static>(
169 &self,
170 f: F,
171 ) -> SignalHandlerId {
172 unsafe extern "C" fn notify_transport_trampoline<
173 F: Fn(&WebRTCSCTPTransport) + Send + Sync + 'static,
174 >(
175 this: *mut ffi::GstWebRTCSCTPTransport,
176 _param_spec: glib::ffi::gpointer,
177 f: glib::ffi::gpointer,
178 ) {
179 let f: &F = &*(f as *const F);
180 f(&from_glib_borrow(this))
181 }
182 unsafe {
183 let f: Box_<F> = Box_::new(f);
184 connect_raw(
185 self.as_ptr() as *mut _,
186 c"notify::transport".as_ptr() as *const _,
187 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
188 notify_transport_trampoline::<F> as *const (),
189 )),
190 Box_::into_raw(f),
191 )
192 }
193 }
194}
195
196unsafe impl Send for WebRTCSCTPTransport {}
197unsafe impl Sync for WebRTCSCTPTransport {}