1#[cfg(feature = "v1_20")]
7#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
8use crate::RTPHeaderExtension;
9use crate::ffi;
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::{SignalHandlerId, connect_raw},
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 unsafe {
199 let f: &F = &*(f as *const F);
200 f(
201 RTPBaseDepayload::from_glib_borrow(this).unsafe_cast_ref(),
202 &from_glib_full(ext),
203 )
204 }
205 }
206 unsafe {
207 let f: Box_<F> = Box_::new(f);
208 connect_raw(
209 self.as_ptr() as *mut _,
210 c"add-extension".as_ptr(),
211 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
212 add_extension_trampoline::<Self, F> as *const (),
213 )),
214 Box_::into_raw(f),
215 )
216 }
217 }
218
219 #[cfg(feature = "v1_20")]
220 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
221 fn emit_add_extension(&self, ext: &RTPHeaderExtension) {
222 self.emit_by_name::<()>("add-extension", &[&ext]);
223 }
224
225 #[cfg(feature = "v1_20")]
226 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
227 #[doc(alias = "clear-extensions")]
228 fn connect_clear_extensions<F: Fn(&Self) + Send + Sync + 'static>(
229 &self,
230 f: F,
231 ) -> SignalHandlerId {
232 unsafe extern "C" fn clear_extensions_trampoline<
233 P: IsA<RTPBaseDepayload>,
234 F: Fn(&P) + Send + Sync + 'static,
235 >(
236 this: *mut ffi::GstRTPBaseDepayload,
237 f: glib::ffi::gpointer,
238 ) {
239 unsafe {
240 let f: &F = &*(f as *const F);
241 f(RTPBaseDepayload::from_glib_borrow(this).unsafe_cast_ref())
242 }
243 }
244 unsafe {
245 let f: Box_<F> = Box_::new(f);
246 connect_raw(
247 self.as_ptr() as *mut _,
248 c"clear-extensions".as_ptr(),
249 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
250 clear_extensions_trampoline::<Self, F> as *const (),
251 )),
252 Box_::into_raw(f),
253 )
254 }
255 }
256
257 #[cfg(feature = "v1_20")]
258 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
259 fn emit_clear_extensions(&self) {
260 self.emit_by_name::<()>("clear-extensions", &[]);
261 }
262
263 #[cfg(feature = "v1_20")]
264 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
265 #[doc(alias = "request-extension")]
266 fn connect_request_extension<
267 F: Fn(&Self, u32, Option<&str>) -> Option<RTPHeaderExtension> + Send + Sync + 'static,
268 >(
269 &self,
270 f: F,
271 ) -> SignalHandlerId {
272 unsafe extern "C" fn request_extension_trampoline<
273 P: IsA<RTPBaseDepayload>,
274 F: Fn(&P, u32, Option<&str>) -> Option<RTPHeaderExtension> + Send + Sync + 'static,
275 >(
276 this: *mut ffi::GstRTPBaseDepayload,
277 ext_id: std::ffi::c_uint,
278 ext_uri: *mut std::ffi::c_char,
279 f: glib::ffi::gpointer,
280 ) -> *mut ffi::GstRTPHeaderExtension {
281 unsafe {
282 let f: &F = &*(f as *const F);
283 f(
284 RTPBaseDepayload::from_glib_borrow(this).unsafe_cast_ref(),
285 ext_id,
286 Option::<glib::GString>::from_glib_borrow(ext_uri)
287 .as_ref()
288 .as_ref()
289 .map(|s| s.as_str()),
290 )
291 .to_glib_full()
292 }
293 }
294 unsafe {
295 let f: Box_<F> = Box_::new(f);
296 connect_raw(
297 self.as_ptr() as *mut _,
298 c"request-extension".as_ptr(),
299 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
300 request_extension_trampoline::<Self, F> as *const (),
301 )),
302 Box_::into_raw(f),
303 )
304 }
305 }
306
307 #[cfg(feature = "v1_20")]
308 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
309 #[doc(alias = "auto-header-extension")]
310 fn connect_auto_header_extension_notify<F: Fn(&Self) + Send + Sync + 'static>(
311 &self,
312 f: F,
313 ) -> SignalHandlerId {
314 unsafe extern "C" fn notify_auto_header_extension_trampoline<
315 P: IsA<RTPBaseDepayload>,
316 F: Fn(&P) + Send + Sync + 'static,
317 >(
318 this: *mut ffi::GstRTPBaseDepayload,
319 _param_spec: glib::ffi::gpointer,
320 f: glib::ffi::gpointer,
321 ) {
322 unsafe {
323 let f: &F = &*(f as *const F);
324 f(RTPBaseDepayload::from_glib_borrow(this).unsafe_cast_ref())
325 }
326 }
327 unsafe {
328 let f: Box_<F> = Box_::new(f);
329 connect_raw(
330 self.as_ptr() as *mut _,
331 c"notify::auto-header-extension".as_ptr(),
332 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
333 notify_auto_header_extension_trampoline::<Self, F> as *const (),
334 )),
335 Box_::into_raw(f),
336 )
337 }
338 }
339
340 #[cfg(feature = "v1_18")]
341 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
342 #[doc(alias = "max-reorder")]
343 fn connect_max_reorder_notify<F: Fn(&Self) + Send + Sync + 'static>(
344 &self,
345 f: F,
346 ) -> SignalHandlerId {
347 unsafe extern "C" fn notify_max_reorder_trampoline<
348 P: IsA<RTPBaseDepayload>,
349 F: Fn(&P) + Send + Sync + 'static,
350 >(
351 this: *mut ffi::GstRTPBaseDepayload,
352 _param_spec: glib::ffi::gpointer,
353 f: glib::ffi::gpointer,
354 ) {
355 unsafe {
356 let f: &F = &*(f as *const F);
357 f(RTPBaseDepayload::from_glib_borrow(this).unsafe_cast_ref())
358 }
359 }
360 unsafe {
361 let f: Box_<F> = Box_::new(f);
362 connect_raw(
363 self.as_ptr() as *mut _,
364 c"notify::max-reorder".as_ptr(),
365 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
366 notify_max_reorder_trampoline::<Self, F> as *const (),
367 )),
368 Box_::into_raw(f),
369 )
370 }
371 }
372
373 #[cfg(feature = "v1_16")]
374 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
375 #[doc(alias = "source-info")]
376 fn connect_source_info_notify<F: Fn(&Self) + Send + Sync + 'static>(
377 &self,
378 f: F,
379 ) -> SignalHandlerId {
380 unsafe extern "C" fn notify_source_info_trampoline<
381 P: IsA<RTPBaseDepayload>,
382 F: Fn(&P) + Send + Sync + 'static,
383 >(
384 this: *mut ffi::GstRTPBaseDepayload,
385 _param_spec: glib::ffi::gpointer,
386 f: glib::ffi::gpointer,
387 ) {
388 unsafe {
389 let f: &F = &*(f as *const F);
390 f(RTPBaseDepayload::from_glib_borrow(this).unsafe_cast_ref())
391 }
392 }
393 unsafe {
394 let f: Box_<F> = Box_::new(f);
395 connect_raw(
396 self.as_ptr() as *mut _,
397 c"notify::source-info".as_ptr(),
398 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
399 notify_source_info_trampoline::<Self, F> as *const (),
400 )),
401 Box_::into_raw(f),
402 )
403 }
404 }
405
406 #[doc(alias = "stats")]
407 fn connect_stats_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
408 unsafe extern "C" fn notify_stats_trampoline<
409 P: IsA<RTPBaseDepayload>,
410 F: Fn(&P) + Send + Sync + 'static,
411 >(
412 this: *mut ffi::GstRTPBaseDepayload,
413 _param_spec: glib::ffi::gpointer,
414 f: glib::ffi::gpointer,
415 ) {
416 unsafe {
417 let f: &F = &*(f as *const F);
418 f(RTPBaseDepayload::from_glib_borrow(this).unsafe_cast_ref())
419 }
420 }
421 unsafe {
422 let f: Box_<F> = Box_::new(f);
423 connect_raw(
424 self.as_ptr() as *mut _,
425 c"notify::stats".as_ptr(),
426 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
427 notify_stats_trampoline::<Self, F> as *const (),
428 )),
429 Box_::into_raw(f),
430 )
431 }
432 }
433}
434
435impl<O: IsA<RTPBaseDepayload>> RTPBaseDepayloadExt for O {}