Skip to main content

gstreamer_webrtc/auto/
web_rtcrtp_transceiver.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
6#[cfg(feature = "v1_20")]
7#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
8use crate::WebRTCKind;
9#[cfg(feature = "v1_18")]
10#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
11use crate::WebRTCRTPTransceiverDirection;
12use crate::{WebRTCRTPReceiver, WebRTCRTPSender, ffi};
13#[cfg(feature = "v1_18")]
14#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
15use glib::signal::{SignalHandlerId, connect_raw};
16use glib::{prelude::*, translate::*};
17#[cfg(feature = "v1_18")]
18#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
19use std::boxed::Box as Box_;
20
21glib::wrapper! {
22    #[doc(alias = "GstWebRTCRTPTransceiver")]
23    pub struct WebRTCRTPTransceiver(Object<ffi::GstWebRTCRTPTransceiver, ffi::GstWebRTCRTPTransceiverClass>) @extends gst::Object;
24
25    match fn {
26        type_ => || ffi::gst_webrtc_rtp_transceiver_get_type(),
27    }
28}
29
30impl WebRTCRTPTransceiver {
31    #[cfg(feature = "v1_20")]
32    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
33    #[doc(alias = "codec-preferences")]
34    pub fn codec_preferences(&self) -> Option<gst::Caps> {
35        ObjectExt::property(self, "codec-preferences")
36    }
37
38    #[cfg(feature = "v1_20")]
39    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
40    #[doc(alias = "codec-preferences")]
41    pub fn set_codec_preferences(&self, codec_preferences: Option<&gst::Caps>) {
42        ObjectExt::set_property(self, "codec-preferences", codec_preferences)
43    }
44
45    #[cfg(feature = "v1_20")]
46    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
47    #[doc(alias = "current-direction")]
48    pub fn current_direction(&self) -> WebRTCRTPTransceiverDirection {
49        ObjectExt::property(self, "current-direction")
50    }
51
52    #[cfg(feature = "v1_18")]
53    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
54    pub fn direction(&self) -> WebRTCRTPTransceiverDirection {
55        ObjectExt::property(self, "direction")
56    }
57
58    #[cfg(feature = "v1_18")]
59    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
60    pub fn set_direction(&self, direction: WebRTCRTPTransceiverDirection) {
61        ObjectExt::set_property(self, "direction", direction)
62    }
63
64    #[cfg(feature = "v1_20")]
65    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
66    pub fn kind(&self) -> WebRTCKind {
67        ObjectExt::property(self, "kind")
68    }
69
70    #[cfg(feature = "v1_20")]
71    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
72    pub fn mid(&self) -> Option<glib::GString> {
73        ObjectExt::property(self, "mid")
74    }
75
76    pub fn mlineindex(&self) -> u32 {
77        ObjectExt::property(self, "mlineindex")
78    }
79
80    pub fn receiver(&self) -> Option<WebRTCRTPReceiver> {
81        ObjectExt::property(self, "receiver")
82    }
83
84    pub fn sender(&self) -> Option<WebRTCRTPSender> {
85        ObjectExt::property(self, "sender")
86    }
87
88    #[cfg(feature = "v1_20")]
89    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
90    #[doc(alias = "codec-preferences")]
91    pub fn connect_codec_preferences_notify<F: Fn(&Self) + Send + Sync + 'static>(
92        &self,
93        f: F,
94    ) -> SignalHandlerId {
95        unsafe extern "C" fn notify_codec_preferences_trampoline<
96            F: Fn(&WebRTCRTPTransceiver) + Send + Sync + 'static,
97        >(
98            this: *mut ffi::GstWebRTCRTPTransceiver,
99            _param_spec: glib::ffi::gpointer,
100            f: glib::ffi::gpointer,
101        ) {
102            unsafe {
103                let f: &F = &*(f as *const F);
104                f(&from_glib_borrow(this))
105            }
106        }
107        unsafe {
108            let f: Box_<F> = Box_::new(f);
109            connect_raw(
110                self.as_ptr() as *mut _,
111                c"notify::codec-preferences".as_ptr(),
112                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
113                    notify_codec_preferences_trampoline::<F> as *const (),
114                )),
115                Box_::into_raw(f),
116            )
117        }
118    }
119
120    #[cfg(feature = "v1_20")]
121    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
122    #[doc(alias = "current-direction")]
123    pub fn connect_current_direction_notify<F: Fn(&Self) + Send + Sync + 'static>(
124        &self,
125        f: F,
126    ) -> SignalHandlerId {
127        unsafe extern "C" fn notify_current_direction_trampoline<
128            F: Fn(&WebRTCRTPTransceiver) + Send + Sync + 'static,
129        >(
130            this: *mut ffi::GstWebRTCRTPTransceiver,
131            _param_spec: glib::ffi::gpointer,
132            f: glib::ffi::gpointer,
133        ) {
134            unsafe {
135                let f: &F = &*(f as *const F);
136                f(&from_glib_borrow(this))
137            }
138        }
139        unsafe {
140            let f: Box_<F> = Box_::new(f);
141            connect_raw(
142                self.as_ptr() as *mut _,
143                c"notify::current-direction".as_ptr(),
144                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
145                    notify_current_direction_trampoline::<F> as *const (),
146                )),
147                Box_::into_raw(f),
148            )
149        }
150    }
151
152    #[cfg(feature = "v1_18")]
153    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
154    #[doc(alias = "direction")]
155    pub fn connect_direction_notify<F: Fn(&Self) + Send + Sync + 'static>(
156        &self,
157        f: F,
158    ) -> SignalHandlerId {
159        unsafe extern "C" fn notify_direction_trampoline<
160            F: Fn(&WebRTCRTPTransceiver) + Send + Sync + 'static,
161        >(
162            this: *mut ffi::GstWebRTCRTPTransceiver,
163            _param_spec: glib::ffi::gpointer,
164            f: glib::ffi::gpointer,
165        ) {
166            unsafe {
167                let f: &F = &*(f as *const F);
168                f(&from_glib_borrow(this))
169            }
170        }
171        unsafe {
172            let f: Box_<F> = Box_::new(f);
173            connect_raw(
174                self.as_ptr() as *mut _,
175                c"notify::direction".as_ptr(),
176                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
177                    notify_direction_trampoline::<F> as *const (),
178                )),
179                Box_::into_raw(f),
180            )
181        }
182    }
183
184    #[cfg(feature = "v1_20")]
185    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
186    #[doc(alias = "kind")]
187    pub fn connect_kind_notify<F: Fn(&Self) + Send + Sync + 'static>(
188        &self,
189        f: F,
190    ) -> SignalHandlerId {
191        unsafe extern "C" fn notify_kind_trampoline<
192            F: Fn(&WebRTCRTPTransceiver) + Send + Sync + 'static,
193        >(
194            this: *mut ffi::GstWebRTCRTPTransceiver,
195            _param_spec: glib::ffi::gpointer,
196            f: glib::ffi::gpointer,
197        ) {
198            unsafe {
199                let f: &F = &*(f as *const F);
200                f(&from_glib_borrow(this))
201            }
202        }
203        unsafe {
204            let f: Box_<F> = Box_::new(f);
205            connect_raw(
206                self.as_ptr() as *mut _,
207                c"notify::kind".as_ptr(),
208                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
209                    notify_kind_trampoline::<F> as *const (),
210                )),
211                Box_::into_raw(f),
212            )
213        }
214    }
215
216    #[cfg(feature = "v1_20")]
217    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
218    #[doc(alias = "mid")]
219    pub fn connect_mid_notify<F: Fn(&Self) + Send + Sync + 'static>(
220        &self,
221        f: F,
222    ) -> SignalHandlerId {
223        unsafe extern "C" fn notify_mid_trampoline<
224            F: Fn(&WebRTCRTPTransceiver) + Send + Sync + 'static,
225        >(
226            this: *mut ffi::GstWebRTCRTPTransceiver,
227            _param_spec: glib::ffi::gpointer,
228            f: glib::ffi::gpointer,
229        ) {
230            unsafe {
231                let f: &F = &*(f as *const F);
232                f(&from_glib_borrow(this))
233            }
234        }
235        unsafe {
236            let f: Box_<F> = Box_::new(f);
237            connect_raw(
238                self.as_ptr() as *mut _,
239                c"notify::mid".as_ptr(),
240                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
241                    notify_mid_trampoline::<F> as *const (),
242                )),
243                Box_::into_raw(f),
244            )
245        }
246    }
247}
248
249unsafe impl Send for WebRTCRTPTransceiver {}
250unsafe impl Sync for WebRTCRTPTransceiver {}