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    #[doc(alias = "GstWebRTCICETransport")]
17    pub struct WebRTCICETransport(Object<ffi::GstWebRTCICETransport, ffi::GstWebRTCICETransportClass>);
18
19    match fn {
20        type_ => || ffi::gst_webrtc_ice_transport_get_type(),
21    }
22}
23
24impl WebRTCICETransport {
25    #[doc(alias = "gst_webrtc_ice_transport_connection_state_change")]
26    pub fn connection_state_change(&self, new_state: WebRTCICEConnectionState) {
27        unsafe {
28            ffi::gst_webrtc_ice_transport_connection_state_change(
29                self.to_glib_none().0,
30                new_state.into_glib(),
31            );
32        }
33    }
34
35    #[doc(alias = "gst_webrtc_ice_transport_gathering_state_change")]
36    pub fn gathering_state_change(&self, new_state: WebRTCICEGatheringState) {
37        unsafe {
38            ffi::gst_webrtc_ice_transport_gathering_state_change(
39                self.to_glib_none().0,
40                new_state.into_glib(),
41            );
42        }
43    }
44
45    #[doc(alias = "gst_webrtc_ice_transport_new_candidate")]
46    pub fn new_candidate(&self, stream_id: u32, component: WebRTCICEComponent, attr: &str) {
47        unsafe {
48            ffi::gst_webrtc_ice_transport_new_candidate(
49                self.to_glib_none().0,
50                stream_id,
51                component.into_glib(),
52                attr.to_glib_none().0,
53            );
54        }
55    }
56
57    #[doc(alias = "gst_webrtc_ice_transport_selected_pair_change")]
58    pub fn selected_pair_change(&self) {
59        unsafe {
60            ffi::gst_webrtc_ice_transport_selected_pair_change(self.to_glib_none().0);
61        }
62    }
63
64    pub fn component(&self) -> WebRTCICEComponent {
65        ObjectExt::property(self, "component")
66    }
67
68    #[doc(alias = "gathering-state")]
69    pub fn gathering_state(&self) -> WebRTCICEGatheringState {
70        ObjectExt::property(self, "gathering-state")
71    }
72
73    pub fn state(&self) -> WebRTCICEConnectionState {
74        ObjectExt::property(self, "state")
75    }
76
77    #[doc(alias = "on-new-candidate")]
78    pub fn connect_on_new_candidate<F: Fn(&Self, &str) + Send + Sync + 'static>(
79        &self,
80        f: F,
81    ) -> SignalHandlerId {
82        unsafe extern "C" fn on_new_candidate_trampoline<
83            F: Fn(&WebRTCICETransport, &str) + Send + Sync + 'static,
84        >(
85            this: *mut ffi::GstWebRTCICETransport,
86            object: *mut std::ffi::c_char,
87            f: glib::ffi::gpointer,
88        ) {
89            let f: &F = &*(f as *const F);
90            f(
91                &from_glib_borrow(this),
92                &glib::GString::from_glib_borrow(object),
93            )
94        }
95        unsafe {
96            let f: Box_<F> = Box_::new(f);
97            connect_raw(
98                self.as_ptr() as *mut _,
99                b"on-new-candidate\0".as_ptr() as *const _,
100                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
101                    on_new_candidate_trampoline::<F> as *const (),
102                )),
103                Box_::into_raw(f),
104            )
105        }
106    }
107
108    #[doc(alias = "on-selected-candidate-pair-change")]
109    pub fn connect_on_selected_candidate_pair_change<F: Fn(&Self) + Send + Sync + 'static>(
110        &self,
111        f: F,
112    ) -> SignalHandlerId {
113        unsafe extern "C" fn on_selected_candidate_pair_change_trampoline<
114            F: Fn(&WebRTCICETransport) + Send + Sync + 'static,
115        >(
116            this: *mut ffi::GstWebRTCICETransport,
117            f: glib::ffi::gpointer,
118        ) {
119            let f: &F = &*(f as *const F);
120            f(&from_glib_borrow(this))
121        }
122        unsafe {
123            let f: Box_<F> = Box_::new(f);
124            connect_raw(
125                self.as_ptr() as *mut _,
126                b"on-selected-candidate-pair-change\0".as_ptr() as *const _,
127                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
128                    on_selected_candidate_pair_change_trampoline::<F> as *const (),
129                )),
130                Box_::into_raw(f),
131            )
132        }
133    }
134
135    #[doc(alias = "gathering-state")]
136    pub fn connect_gathering_state_notify<F: Fn(&Self) + Send + Sync + 'static>(
137        &self,
138        f: F,
139    ) -> SignalHandlerId {
140        unsafe extern "C" fn notify_gathering_state_trampoline<
141            F: Fn(&WebRTCICETransport) + Send + Sync + 'static,
142        >(
143            this: *mut ffi::GstWebRTCICETransport,
144            _param_spec: glib::ffi::gpointer,
145            f: glib::ffi::gpointer,
146        ) {
147            let f: &F = &*(f as *const F);
148            f(&from_glib_borrow(this))
149        }
150        unsafe {
151            let f: Box_<F> = Box_::new(f);
152            connect_raw(
153                self.as_ptr() as *mut _,
154                b"notify::gathering-state\0".as_ptr() as *const _,
155                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
156                    notify_gathering_state_trampoline::<F> as *const (),
157                )),
158                Box_::into_raw(f),
159            )
160        }
161    }
162
163    #[doc(alias = "state")]
164    pub fn connect_state_notify<F: Fn(&Self) + Send + Sync + 'static>(
165        &self,
166        f: F,
167    ) -> SignalHandlerId {
168        unsafe extern "C" fn notify_state_trampoline<
169            F: Fn(&WebRTCICETransport) + Send + Sync + 'static,
170        >(
171            this: *mut ffi::GstWebRTCICETransport,
172            _param_spec: glib::ffi::gpointer,
173            f: glib::ffi::gpointer,
174        ) {
175            let f: &F = &*(f as *const F);
176            f(&from_glib_borrow(this))
177        }
178        unsafe {
179            let f: Box_<F> = Box_::new(f);
180            connect_raw(
181                self.as_ptr() as *mut _,
182                b"notify::state\0".as_ptr() as *const _,
183                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
184                    notify_state_trampoline::<F> as *const (),
185                )),
186                Box_::into_raw(f),
187            )
188        }
189    }
190}
191
192unsafe impl Send for WebRTCICETransport {}
193unsafe impl Sync for WebRTCICETransport {}