gstreamer_webrtc/auto/
web_rtcsctp_transport.rs1use 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")]
16 pub struct WebRTCSCTPTransport(Object<ffi::GstWebRTCSCTPTransport, ffi::GstWebRTCSCTPTransportClass>) @extends gst::Object;
17
18 match fn {
19 type_ => || ffi::gst_webrtc_sctp_transport_get_type(),
20 }
21}
22
23impl WebRTCSCTPTransport {
24 #[doc(alias = "max-channels")]
25 pub fn max_channels(&self) -> u32 {
26 ObjectExt::property(self, "max-channels")
27 }
28
29 #[doc(alias = "max-message-size")]
30 pub fn max_message_size(&self) -> u64 {
31 ObjectExt::property(self, "max-message-size")
32 }
33
34 pub fn state(&self) -> WebRTCSCTPTransportState {
35 ObjectExt::property(self, "state")
36 }
37
38 pub fn transport(&self) -> Option<WebRTCDTLSTransport> {
39 ObjectExt::property(self, "transport")
40 }
41
42 #[doc(alias = "max-channels")]
43 pub fn connect_max_channels_notify<F: Fn(&Self) + Send + Sync + 'static>(
44 &self,
45 f: F,
46 ) -> SignalHandlerId {
47 unsafe extern "C" fn notify_max_channels_trampoline<
48 F: Fn(&WebRTCSCTPTransport) + Send + Sync + 'static,
49 >(
50 this: *mut ffi::GstWebRTCSCTPTransport,
51 _param_spec: glib::ffi::gpointer,
52 f: glib::ffi::gpointer,
53 ) {
54 let f: &F = &*(f as *const F);
55 f(&from_glib_borrow(this))
56 }
57 unsafe {
58 let f: Box_<F> = Box_::new(f);
59 connect_raw(
60 self.as_ptr() as *mut _,
61 c"notify::max-channels".as_ptr() as *const _,
62 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
63 notify_max_channels_trampoline::<F> as *const (),
64 )),
65 Box_::into_raw(f),
66 )
67 }
68 }
69
70 #[doc(alias = "max-message-size")]
71 pub fn connect_max_message_size_notify<F: Fn(&Self) + Send + Sync + 'static>(
72 &self,
73 f: F,
74 ) -> SignalHandlerId {
75 unsafe extern "C" fn notify_max_message_size_trampoline<
76 F: Fn(&WebRTCSCTPTransport) + Send + Sync + 'static,
77 >(
78 this: *mut ffi::GstWebRTCSCTPTransport,
79 _param_spec: glib::ffi::gpointer,
80 f: glib::ffi::gpointer,
81 ) {
82 let f: &F = &*(f as *const F);
83 f(&from_glib_borrow(this))
84 }
85 unsafe {
86 let f: Box_<F> = Box_::new(f);
87 connect_raw(
88 self.as_ptr() as *mut _,
89 c"notify::max-message-size".as_ptr() as *const _,
90 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
91 notify_max_message_size_trampoline::<F> as *const (),
92 )),
93 Box_::into_raw(f),
94 )
95 }
96 }
97
98 #[doc(alias = "state")]
99 pub fn connect_state_notify<F: Fn(&Self) + Send + Sync + 'static>(
100 &self,
101 f: F,
102 ) -> SignalHandlerId {
103 unsafe extern "C" fn notify_state_trampoline<
104 F: Fn(&WebRTCSCTPTransport) + Send + Sync + 'static,
105 >(
106 this: *mut ffi::GstWebRTCSCTPTransport,
107 _param_spec: glib::ffi::gpointer,
108 f: glib::ffi::gpointer,
109 ) {
110 let f: &F = &*(f as *const F);
111 f(&from_glib_borrow(this))
112 }
113 unsafe {
114 let f: Box_<F> = Box_::new(f);
115 connect_raw(
116 self.as_ptr() as *mut _,
117 c"notify::state".as_ptr() as *const _,
118 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
119 notify_state_trampoline::<F> as *const (),
120 )),
121 Box_::into_raw(f),
122 )
123 }
124 }
125
126 #[doc(alias = "transport")]
127 pub fn connect_transport_notify<F: Fn(&Self) + Send + Sync + 'static>(
128 &self,
129 f: F,
130 ) -> SignalHandlerId {
131 unsafe extern "C" fn notify_transport_trampoline<
132 F: Fn(&WebRTCSCTPTransport) + Send + Sync + 'static,
133 >(
134 this: *mut ffi::GstWebRTCSCTPTransport,
135 _param_spec: glib::ffi::gpointer,
136 f: glib::ffi::gpointer,
137 ) {
138 let f: &F = &*(f as *const F);
139 f(&from_glib_borrow(this))
140 }
141 unsafe {
142 let f: Box_<F> = Box_::new(f);
143 connect_raw(
144 self.as_ptr() as *mut _,
145 c"notify::transport".as_ptr() as *const _,
146 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
147 notify_transport_trampoline::<F> as *const (),
148 )),
149 Box_::into_raw(f),
150 )
151 }
152 }
153}
154
155unsafe impl Send for WebRTCSCTPTransport {}
156unsafe impl Sync for WebRTCSCTPTransport {}