gstreamer_rtp/auto/
rtp_base_depayload.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;
7#[cfg(feature = "v1_20")]
8#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
9use crate::RTPHeaderExtension;
10#[cfg(feature = "v1_20")]
11#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
12use glib::object::ObjectType as _;
13use glib::{
14    prelude::*,
15    signal::{connect_raw, SignalHandlerId},
16    translate::*,
17};
18use std::boxed::Box as Box_;
19
20glib::wrapper! {
21    #[doc(alias = "GstRTPBaseDepayload")]
22    pub struct RTPBaseDepayload(Object<ffi::GstRTPBaseDepayload, ffi::GstRTPBaseDepayloadClass>) @extends gst::Element, gst::Object;
23
24    match fn {
25        type_ => || ffi::gst_rtp_base_depayload_get_type(),
26    }
27}
28
29impl RTPBaseDepayload {
30    pub const NONE: Option<&'static RTPBaseDepayload> = None;
31}
32
33unsafe impl Send for RTPBaseDepayload {}
34unsafe impl Sync for RTPBaseDepayload {}
35
36pub trait RTPBaseDepayloadExt: IsA<RTPBaseDepayload> + 'static {
37    #[cfg(feature = "v1_24")]
38    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
39    #[doc(alias = "gst_rtp_base_depayload_delayed")]
40    fn delayed(&self) {
41        unsafe {
42            ffi::gst_rtp_base_depayload_delayed(self.as_ref().to_glib_none().0);
43        }
44    }
45
46    #[cfg(feature = "v1_24")]
47    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
48    #[doc(alias = "gst_rtp_base_depayload_dropped")]
49    fn dropped(&self) {
50        unsafe {
51            ffi::gst_rtp_base_depayload_dropped(self.as_ref().to_glib_none().0);
52        }
53    }
54
55    #[cfg(feature = "v1_24")]
56    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
57    #[doc(alias = "gst_rtp_base_depayload_flush")]
58    fn flush(&self, keep_current: bool) {
59        unsafe {
60            ffi::gst_rtp_base_depayload_flush(
61                self.as_ref().to_glib_none().0,
62                keep_current.into_glib(),
63            );
64        }
65    }
66
67    #[cfg(feature = "v1_24")]
68    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
69    #[doc(alias = "gst_rtp_base_depayload_is_aggregate_hdrext_enabled")]
70    fn is_aggregate_hdrext_enabled(&self) -> bool {
71        unsafe {
72            from_glib(ffi::gst_rtp_base_depayload_is_aggregate_hdrext_enabled(
73                self.as_ref().to_glib_none().0,
74            ))
75        }
76    }
77
78    #[cfg(feature = "v1_16")]
79    #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
80    #[doc(alias = "gst_rtp_base_depayload_is_source_info_enabled")]
81    fn is_source_info_enabled(&self) -> bool {
82        unsafe {
83            from_glib(ffi::gst_rtp_base_depayload_is_source_info_enabled(
84                self.as_ref().to_glib_none().0,
85            ))
86        }
87    }
88
89    #[doc(alias = "gst_rtp_base_depayload_push")]
90    fn push(&self, out_buf: gst::Buffer) -> Result<gst::FlowSuccess, gst::FlowError> {
91        unsafe {
92            try_from_glib(ffi::gst_rtp_base_depayload_push(
93                self.as_ref().to_glib_none().0,
94                out_buf.into_glib_ptr(),
95            ))
96        }
97    }
98
99    #[doc(alias = "gst_rtp_base_depayload_push_list")]
100    fn push_list(&self, out_list: gst::BufferList) -> Result<gst::FlowSuccess, gst::FlowError> {
101        unsafe {
102            try_from_glib(ffi::gst_rtp_base_depayload_push_list(
103                self.as_ref().to_glib_none().0,
104                out_list.into_glib_ptr(),
105            ))
106        }
107    }
108
109    #[cfg(feature = "v1_24")]
110    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
111    #[doc(alias = "gst_rtp_base_depayload_set_aggregate_hdrext_enabled")]
112    fn set_aggregate_hdrext_enabled(&self, enable: bool) {
113        unsafe {
114            ffi::gst_rtp_base_depayload_set_aggregate_hdrext_enabled(
115                self.as_ref().to_glib_none().0,
116                enable.into_glib(),
117            );
118        }
119    }
120
121    #[cfg(feature = "v1_16")]
122    #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
123    #[doc(alias = "gst_rtp_base_depayload_set_source_info_enabled")]
124    fn set_source_info_enabled(&self, enable: bool) {
125        unsafe {
126            ffi::gst_rtp_base_depayload_set_source_info_enabled(
127                self.as_ref().to_glib_none().0,
128                enable.into_glib(),
129            );
130        }
131    }
132
133    #[cfg(feature = "v1_20")]
134    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
135    #[doc(alias = "auto-header-extension")]
136    fn is_auto_header_extension(&self) -> bool {
137        ObjectExt::property(self.as_ref(), "auto-header-extension")
138    }
139
140    #[cfg(feature = "v1_20")]
141    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
142    #[doc(alias = "auto-header-extension")]
143    fn set_auto_header_extension(&self, auto_header_extension: bool) {
144        ObjectExt::set_property(
145            self.as_ref(),
146            "auto-header-extension",
147            auto_header_extension,
148        )
149    }
150
151    #[cfg(feature = "v1_18")]
152    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
153    #[doc(alias = "max-reorder")]
154    fn max_reorder(&self) -> i32 {
155        ObjectExt::property(self.as_ref(), "max-reorder")
156    }
157
158    #[cfg(feature = "v1_18")]
159    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
160    #[doc(alias = "max-reorder")]
161    fn set_max_reorder(&self, max_reorder: i32) {
162        ObjectExt::set_property(self.as_ref(), "max-reorder", max_reorder)
163    }
164
165    #[cfg(feature = "v1_16")]
166    #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
167    #[doc(alias = "source-info")]
168    fn is_source_info(&self) -> bool {
169        ObjectExt::property(self.as_ref(), "source-info")
170    }
171
172    #[cfg(feature = "v1_16")]
173    #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
174    #[doc(alias = "source-info")]
175    fn set_source_info(&self, source_info: bool) {
176        ObjectExt::set_property(self.as_ref(), "source-info", source_info)
177    }
178
179    fn stats(&self) -> Option<gst::Structure> {
180        ObjectExt::property(self.as_ref(), "stats")
181    }
182
183    #[cfg(feature = "v1_20")]
184    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
185    #[doc(alias = "add-extension")]
186    fn connect_add_extension<F: Fn(&Self, &RTPHeaderExtension) + Send + Sync + 'static>(
187        &self,
188        f: F,
189    ) -> SignalHandlerId {
190        unsafe extern "C" fn add_extension_trampoline<
191            P: IsA<RTPBaseDepayload>,
192            F: Fn(&P, &RTPHeaderExtension) + Send + Sync + 'static,
193        >(
194            this: *mut ffi::GstRTPBaseDepayload,
195            ext: *mut ffi::GstRTPHeaderExtension,
196            f: glib::ffi::gpointer,
197        ) {
198            let f: &F = &*(f as *const F);
199            f(
200                RTPBaseDepayload::from_glib_borrow(this).unsafe_cast_ref(),
201                &from_glib_full(ext),
202            )
203        }
204        unsafe {
205            let f: Box_<F> = Box_::new(f);
206            connect_raw(
207                self.as_ptr() as *mut _,
208                c"add-extension".as_ptr() as *const _,
209                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
210                    add_extension_trampoline::<Self, F> as *const (),
211                )),
212                Box_::into_raw(f),
213            )
214        }
215    }
216
217    #[cfg(feature = "v1_20")]
218    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
219    fn emit_add_extension(&self, ext: &RTPHeaderExtension) {
220        self.emit_by_name::<()>("add-extension", &[&ext]);
221    }
222
223    #[cfg(feature = "v1_20")]
224    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
225    #[doc(alias = "clear-extensions")]
226    fn connect_clear_extensions<F: Fn(&Self) + Send + Sync + 'static>(
227        &self,
228        f: F,
229    ) -> SignalHandlerId {
230        unsafe extern "C" fn clear_extensions_trampoline<
231            P: IsA<RTPBaseDepayload>,
232            F: Fn(&P) + Send + Sync + 'static,
233        >(
234            this: *mut ffi::GstRTPBaseDepayload,
235            f: glib::ffi::gpointer,
236        ) {
237            let f: &F = &*(f as *const F);
238            f(RTPBaseDepayload::from_glib_borrow(this).unsafe_cast_ref())
239        }
240        unsafe {
241            let f: Box_<F> = Box_::new(f);
242            connect_raw(
243                self.as_ptr() as *mut _,
244                c"clear-extensions".as_ptr() as *const _,
245                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
246                    clear_extensions_trampoline::<Self, F> as *const (),
247                )),
248                Box_::into_raw(f),
249            )
250        }
251    }
252
253    #[cfg(feature = "v1_20")]
254    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
255    fn emit_clear_extensions(&self) {
256        self.emit_by_name::<()>("clear-extensions", &[]);
257    }
258
259    #[cfg(feature = "v1_20")]
260    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
261    #[doc(alias = "request-extension")]
262    fn connect_request_extension<
263        F: Fn(&Self, u32, Option<&str>) -> Option<RTPHeaderExtension> + Send + Sync + 'static,
264    >(
265        &self,
266        f: F,
267    ) -> SignalHandlerId {
268        unsafe extern "C" fn request_extension_trampoline<
269            P: IsA<RTPBaseDepayload>,
270            F: Fn(&P, u32, Option<&str>) -> Option<RTPHeaderExtension> + Send + Sync + 'static,
271        >(
272            this: *mut ffi::GstRTPBaseDepayload,
273            ext_id: std::ffi::c_uint,
274            ext_uri: *mut std::ffi::c_char,
275            f: glib::ffi::gpointer,
276        ) -> *mut ffi::GstRTPHeaderExtension {
277            let f: &F = &*(f as *const F);
278            f(
279                RTPBaseDepayload::from_glib_borrow(this).unsafe_cast_ref(),
280                ext_id,
281                Option::<glib::GString>::from_glib_borrow(ext_uri)
282                    .as_ref()
283                    .as_ref()
284                    .map(|s| s.as_str()),
285            )
286            .to_glib_full()
287        }
288        unsafe {
289            let f: Box_<F> = Box_::new(f);
290            connect_raw(
291                self.as_ptr() as *mut _,
292                c"request-extension".as_ptr() as *const _,
293                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
294                    request_extension_trampoline::<Self, F> as *const (),
295                )),
296                Box_::into_raw(f),
297            )
298        }
299    }
300
301    #[cfg(feature = "v1_20")]
302    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
303    #[doc(alias = "auto-header-extension")]
304    fn connect_auto_header_extension_notify<F: Fn(&Self) + Send + Sync + 'static>(
305        &self,
306        f: F,
307    ) -> SignalHandlerId {
308        unsafe extern "C" fn notify_auto_header_extension_trampoline<
309            P: IsA<RTPBaseDepayload>,
310            F: Fn(&P) + Send + Sync + 'static,
311        >(
312            this: *mut ffi::GstRTPBaseDepayload,
313            _param_spec: glib::ffi::gpointer,
314            f: glib::ffi::gpointer,
315        ) {
316            let f: &F = &*(f as *const F);
317            f(RTPBaseDepayload::from_glib_borrow(this).unsafe_cast_ref())
318        }
319        unsafe {
320            let f: Box_<F> = Box_::new(f);
321            connect_raw(
322                self.as_ptr() as *mut _,
323                c"notify::auto-header-extension".as_ptr() as *const _,
324                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
325                    notify_auto_header_extension_trampoline::<Self, F> as *const (),
326                )),
327                Box_::into_raw(f),
328            )
329        }
330    }
331
332    #[cfg(feature = "v1_18")]
333    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
334    #[doc(alias = "max-reorder")]
335    fn connect_max_reorder_notify<F: Fn(&Self) + Send + Sync + 'static>(
336        &self,
337        f: F,
338    ) -> SignalHandlerId {
339        unsafe extern "C" fn notify_max_reorder_trampoline<
340            P: IsA<RTPBaseDepayload>,
341            F: Fn(&P) + Send + Sync + 'static,
342        >(
343            this: *mut ffi::GstRTPBaseDepayload,
344            _param_spec: glib::ffi::gpointer,
345            f: glib::ffi::gpointer,
346        ) {
347            let f: &F = &*(f as *const F);
348            f(RTPBaseDepayload::from_glib_borrow(this).unsafe_cast_ref())
349        }
350        unsafe {
351            let f: Box_<F> = Box_::new(f);
352            connect_raw(
353                self.as_ptr() as *mut _,
354                c"notify::max-reorder".as_ptr() as *const _,
355                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
356                    notify_max_reorder_trampoline::<Self, F> as *const (),
357                )),
358                Box_::into_raw(f),
359            )
360        }
361    }
362
363    #[cfg(feature = "v1_16")]
364    #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
365    #[doc(alias = "source-info")]
366    fn connect_source_info_notify<F: Fn(&Self) + Send + Sync + 'static>(
367        &self,
368        f: F,
369    ) -> SignalHandlerId {
370        unsafe extern "C" fn notify_source_info_trampoline<
371            P: IsA<RTPBaseDepayload>,
372            F: Fn(&P) + Send + Sync + 'static,
373        >(
374            this: *mut ffi::GstRTPBaseDepayload,
375            _param_spec: glib::ffi::gpointer,
376            f: glib::ffi::gpointer,
377        ) {
378            let f: &F = &*(f as *const F);
379            f(RTPBaseDepayload::from_glib_borrow(this).unsafe_cast_ref())
380        }
381        unsafe {
382            let f: Box_<F> = Box_::new(f);
383            connect_raw(
384                self.as_ptr() as *mut _,
385                c"notify::source-info".as_ptr() as *const _,
386                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
387                    notify_source_info_trampoline::<Self, F> as *const (),
388                )),
389                Box_::into_raw(f),
390            )
391        }
392    }
393
394    #[doc(alias = "stats")]
395    fn connect_stats_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
396        unsafe extern "C" fn notify_stats_trampoline<
397            P: IsA<RTPBaseDepayload>,
398            F: Fn(&P) + Send + Sync + 'static,
399        >(
400            this: *mut ffi::GstRTPBaseDepayload,
401            _param_spec: glib::ffi::gpointer,
402            f: glib::ffi::gpointer,
403        ) {
404            let f: &F = &*(f as *const F);
405            f(RTPBaseDepayload::from_glib_borrow(this).unsafe_cast_ref())
406        }
407        unsafe {
408            let f: Box_<F> = Box_::new(f);
409            connect_raw(
410                self.as_ptr() as *mut _,
411                c"notify::stats".as_ptr() as *const _,
412                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
413                    notify_stats_trampoline::<Self, F> as *const (),
414                )),
415                Box_::into_raw(f),
416            )
417        }
418    }
419}
420
421impl<O: IsA<RTPBaseDepayload>> RTPBaseDepayloadExt for O {}