gstreamer_webrtc/auto/
web_rtcice_transport.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
4// DO NOT EDIT
5
6use crate::{ffi, WebRTCICEComponent, WebRTCICEConnectionState, WebRTCICEGatheringState};
7use glib::{
8    object::ObjectType as _,
9    prelude::*,
10    signal::{connect_raw, SignalHandlerId},
11    translate::*,
12};
13use std::boxed::Box as Box_;
14
15glib::wrapper! {
16    ///
17    ///
18    /// This is an Abstract Base Class, you cannot instantiate it.
19    ///
20    /// ## Properties
21    ///
22    ///
23    /// #### `component`
24    ///  Readable | Writeable | Construct Only
25    ///
26    ///
27    /// #### `gathering-state`
28    ///  Readable
29    ///
30    ///
31    /// #### `state`
32    ///  Readable
33    /// <details><summary><h4>Object</h4></summary>
34    ///
35    ///
36    /// #### `name`
37    ///  Readable | Writeable | Construct
38    ///
39    ///
40    /// #### `parent`
41    ///  The parent of the object. Please note, that when changing the 'parent'
42    /// property, we don't emit [`notify`][struct@crate::glib::Object#notify] and `GstObject::deep-notify`
43    /// signals due to locking issues. In some cases one can use
44    /// `GstBin::element-added` or `GstBin::element-removed` signals on the parent to
45    /// achieve a similar effect.
46    ///
47    /// Readable | Writeable
48    /// </details>
49    ///
50    /// ## Signals
51    ///
52    ///
53    /// #### `on-new-candidate`
54    ///
55    ///
56    ///
57    /// #### `on-selected-candidate-pair-change`
58    ///
59    /// <details><summary><h4>Object</h4></summary>
60    ///
61    ///
62    /// #### `deep-notify`
63    ///  The deep notify signal is used to be notified of property changes. It is
64    /// typically attached to the toplevel bin to receive notifications from all
65    /// the elements contained in that bin.
66    ///
67    /// Detailed
68    /// </details>
69    ///
70    /// # Implements
71    ///
72    /// [`trait@glib::ObjectExt`]
73    #[doc(alias = "GstWebRTCICETransport")]
74    pub struct WebRTCICETransport(Object<ffi::GstWebRTCICETransport, ffi::GstWebRTCICETransportClass>);
75
76    match fn {
77        type_ => || ffi::gst_webrtc_ice_transport_get_type(),
78    }
79}
80
81impl WebRTCICETransport {
82    #[doc(alias = "gst_webrtc_ice_transport_connection_state_change")]
83    pub fn connection_state_change(&self, new_state: WebRTCICEConnectionState) {
84        unsafe {
85            ffi::gst_webrtc_ice_transport_connection_state_change(
86                self.to_glib_none().0,
87                new_state.into_glib(),
88            );
89        }
90    }
91
92    #[doc(alias = "gst_webrtc_ice_transport_gathering_state_change")]
93    pub fn gathering_state_change(&self, new_state: WebRTCICEGatheringState) {
94        unsafe {
95            ffi::gst_webrtc_ice_transport_gathering_state_change(
96                self.to_glib_none().0,
97                new_state.into_glib(),
98            );
99        }
100    }
101
102    #[doc(alias = "gst_webrtc_ice_transport_new_candidate")]
103    pub fn new_candidate(&self, stream_id: u32, component: WebRTCICEComponent, attr: &str) {
104        unsafe {
105            ffi::gst_webrtc_ice_transport_new_candidate(
106                self.to_glib_none().0,
107                stream_id,
108                component.into_glib(),
109                attr.to_glib_none().0,
110            );
111        }
112    }
113
114    #[doc(alias = "gst_webrtc_ice_transport_selected_pair_change")]
115    pub fn selected_pair_change(&self) {
116        unsafe {
117            ffi::gst_webrtc_ice_transport_selected_pair_change(self.to_glib_none().0);
118        }
119    }
120
121    pub fn component(&self) -> WebRTCICEComponent {
122        ObjectExt::property(self, "component")
123    }
124
125    #[doc(alias = "gathering-state")]
126    pub fn gathering_state(&self) -> WebRTCICEGatheringState {
127        ObjectExt::property(self, "gathering-state")
128    }
129
130    pub fn state(&self) -> WebRTCICEConnectionState {
131        ObjectExt::property(self, "state")
132    }
133
134    #[doc(alias = "on-new-candidate")]
135    pub fn connect_on_new_candidate<F: Fn(&Self, &str) + Send + Sync + 'static>(
136        &self,
137        f: F,
138    ) -> SignalHandlerId {
139        unsafe extern "C" fn on_new_candidate_trampoline<
140            F: Fn(&WebRTCICETransport, &str) + Send + Sync + 'static,
141        >(
142            this: *mut ffi::GstWebRTCICETransport,
143            object: *mut std::ffi::c_char,
144            f: glib::ffi::gpointer,
145        ) {
146            let f: &F = &*(f as *const F);
147            f(
148                &from_glib_borrow(this),
149                &glib::GString::from_glib_borrow(object),
150            )
151        }
152        unsafe {
153            let f: Box_<F> = Box_::new(f);
154            connect_raw(
155                self.as_ptr() as *mut _,
156                c"on-new-candidate".as_ptr() as *const _,
157                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
158                    on_new_candidate_trampoline::<F> as *const (),
159                )),
160                Box_::into_raw(f),
161            )
162        }
163    }
164
165    #[doc(alias = "on-selected-candidate-pair-change")]
166    pub fn connect_on_selected_candidate_pair_change<F: Fn(&Self) + Send + Sync + 'static>(
167        &self,
168        f: F,
169    ) -> SignalHandlerId {
170        unsafe extern "C" fn on_selected_candidate_pair_change_trampoline<
171            F: Fn(&WebRTCICETransport) + Send + Sync + 'static,
172        >(
173            this: *mut ffi::GstWebRTCICETransport,
174            f: glib::ffi::gpointer,
175        ) {
176            let f: &F = &*(f as *const F);
177            f(&from_glib_borrow(this))
178        }
179        unsafe {
180            let f: Box_<F> = Box_::new(f);
181            connect_raw(
182                self.as_ptr() as *mut _,
183                c"on-selected-candidate-pair-change".as_ptr() as *const _,
184                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
185                    on_selected_candidate_pair_change_trampoline::<F> as *const (),
186                )),
187                Box_::into_raw(f),
188            )
189        }
190    }
191
192    #[doc(alias = "gathering-state")]
193    pub fn connect_gathering_state_notify<F: Fn(&Self) + Send + Sync + 'static>(
194        &self,
195        f: F,
196    ) -> SignalHandlerId {
197        unsafe extern "C" fn notify_gathering_state_trampoline<
198            F: Fn(&WebRTCICETransport) + Send + Sync + 'static,
199        >(
200            this: *mut ffi::GstWebRTCICETransport,
201            _param_spec: glib::ffi::gpointer,
202            f: glib::ffi::gpointer,
203        ) {
204            let f: &F = &*(f as *const F);
205            f(&from_glib_borrow(this))
206        }
207        unsafe {
208            let f: Box_<F> = Box_::new(f);
209            connect_raw(
210                self.as_ptr() as *mut _,
211                c"notify::gathering-state".as_ptr() as *const _,
212                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
213                    notify_gathering_state_trampoline::<F> as *const (),
214                )),
215                Box_::into_raw(f),
216            )
217        }
218    }
219
220    #[doc(alias = "state")]
221    pub fn connect_state_notify<F: Fn(&Self) + Send + Sync + 'static>(
222        &self,
223        f: F,
224    ) -> SignalHandlerId {
225        unsafe extern "C" fn notify_state_trampoline<
226            F: Fn(&WebRTCICETransport) + Send + Sync + 'static,
227        >(
228            this: *mut ffi::GstWebRTCICETransport,
229            _param_spec: glib::ffi::gpointer,
230            f: glib::ffi::gpointer,
231        ) {
232            let f: &F = &*(f as *const F);
233            f(&from_glib_borrow(this))
234        }
235        unsafe {
236            let f: Box_<F> = Box_::new(f);
237            connect_raw(
238                self.as_ptr() as *mut _,
239                c"notify::state".as_ptr() as *const _,
240                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
241                    notify_state_trampoline::<F> as *const (),
242                )),
243                Box_::into_raw(f),
244            )
245        }
246    }
247}
248
249unsafe impl Send for WebRTCICETransport {}
250unsafe impl Sync for WebRTCICETransport {}