gstreamer_webrtc/auto/
web_rtcsctp_transport.rs1use crate::{WebRTCDTLSTransport, WebRTCSCTPTransportState, ffi};
7use glib::{
8 prelude::*,
9 signal::{SignalHandlerId, connect_raw},
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>) @extends gst::Object;
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 unsafe {
96 let f: &F = &*(f as *const F);
97 f(&from_glib_borrow(this))
98 }
99 }
100 unsafe {
101 let f: Box_<F> = Box_::new(f);
102 connect_raw(
103 self.as_ptr() as *mut _,
104 c"notify::max-channels".as_ptr(),
105 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
106 notify_max_channels_trampoline::<F> as *const (),
107 )),
108 Box_::into_raw(f),
109 )
110 }
111 }
112
113 #[doc(alias = "max-message-size")]
114 pub fn connect_max_message_size_notify<F: Fn(&Self) + Send + Sync + 'static>(
115 &self,
116 f: F,
117 ) -> SignalHandlerId {
118 unsafe extern "C" fn notify_max_message_size_trampoline<
119 F: Fn(&WebRTCSCTPTransport) + Send + Sync + 'static,
120 >(
121 this: *mut ffi::GstWebRTCSCTPTransport,
122 _param_spec: glib::ffi::gpointer,
123 f: glib::ffi::gpointer,
124 ) {
125 unsafe {
126 let f: &F = &*(f as *const F);
127 f(&from_glib_borrow(this))
128 }
129 }
130 unsafe {
131 let f: Box_<F> = Box_::new(f);
132 connect_raw(
133 self.as_ptr() as *mut _,
134 c"notify::max-message-size".as_ptr(),
135 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
136 notify_max_message_size_trampoline::<F> as *const (),
137 )),
138 Box_::into_raw(f),
139 )
140 }
141 }
142
143 #[doc(alias = "state")]
144 pub fn connect_state_notify<F: Fn(&Self) + Send + Sync + 'static>(
145 &self,
146 f: F,
147 ) -> SignalHandlerId {
148 unsafe extern "C" fn notify_state_trampoline<
149 F: Fn(&WebRTCSCTPTransport) + Send + Sync + 'static,
150 >(
151 this: *mut ffi::GstWebRTCSCTPTransport,
152 _param_spec: glib::ffi::gpointer,
153 f: glib::ffi::gpointer,
154 ) {
155 unsafe {
156 let f: &F = &*(f as *const F);
157 f(&from_glib_borrow(this))
158 }
159 }
160 unsafe {
161 let f: Box_<F> = Box_::new(f);
162 connect_raw(
163 self.as_ptr() as *mut _,
164 c"notify::state".as_ptr(),
165 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
166 notify_state_trampoline::<F> as *const (),
167 )),
168 Box_::into_raw(f),
169 )
170 }
171 }
172
173 #[doc(alias = "transport")]
174 pub fn connect_transport_notify<F: Fn(&Self) + Send + Sync + 'static>(
175 &self,
176 f: F,
177 ) -> SignalHandlerId {
178 unsafe extern "C" fn notify_transport_trampoline<
179 F: Fn(&WebRTCSCTPTransport) + Send + Sync + 'static,
180 >(
181 this: *mut ffi::GstWebRTCSCTPTransport,
182 _param_spec: glib::ffi::gpointer,
183 f: glib::ffi::gpointer,
184 ) {
185 unsafe {
186 let f: &F = &*(f as *const F);
187 f(&from_glib_borrow(this))
188 }
189 }
190 unsafe {
191 let f: Box_<F> = Box_::new(f);
192 connect_raw(
193 self.as_ptr() as *mut _,
194 c"notify::transport".as_ptr(),
195 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
196 notify_transport_trampoline::<F> as *const (),
197 )),
198 Box_::into_raw(f),
199 )
200 }
201 }
202}
203
204unsafe impl Send for WebRTCSCTPTransport {}
205unsafe impl Sync for WebRTCSCTPTransport {}