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" )))] |
8 | use crate::AppLeakyType; |
9 | use crate::{ffi, AppStreamType}; |
10 | use glib::{ |
11 | prelude::*, |
12 | signal::{connect_raw, SignalHandlerId}, |
13 | translate::*, |
14 | }; |
15 | use std::boxed::Box as Box_; |
16 | |
17 | glib::wrapper! { |
18 | #[doc (alias = "GstAppSrc" )] |
19 | pub struct AppSrc(Object<ffi::GstAppSrc, ffi::GstAppSrcClass>) @extends gst::Element, gst::Object, @implements gst::URIHandler; |
20 | |
21 | match fn { |
22 | type_ => || ffi::gst_app_src_get_type(), |
23 | } |
24 | } |
25 | |
26 | impl AppSrc { |
27 | #[doc (alias = "gst_app_src_end_of_stream" )] |
28 | pub fn end_of_stream(&self) -> Result<gst::FlowSuccess, gst::FlowError> { |
29 | unsafe { try_from_glib(ffi::gst_app_src_end_of_stream(self.to_glib_none().0)) } |
30 | } |
31 | |
32 | #[doc (alias = "gst_app_src_get_caps" )] |
33 | #[doc (alias = "get_caps" )] |
34 | pub fn caps(&self) -> Option<gst::Caps> { |
35 | unsafe { from_glib_full(ffi::gst_app_src_get_caps(self.to_glib_none().0)) } |
36 | } |
37 | |
38 | #[cfg (feature = "v1_20" )] |
39 | #[cfg_attr (docsrs, doc(cfg(feature = "v1_20" )))] |
40 | #[doc (alias = "gst_app_src_get_current_level_buffers" )] |
41 | #[doc (alias = "get_current_level_buffers" )] |
42 | #[doc (alias = "current-level-buffers" )] |
43 | pub fn current_level_buffers(&self) -> u64 { |
44 | unsafe { ffi::gst_app_src_get_current_level_buffers(self.to_glib_none().0) } |
45 | } |
46 | |
47 | #[doc (alias = "gst_app_src_get_current_level_bytes" )] |
48 | #[doc (alias = "get_current_level_bytes" )] |
49 | #[doc (alias = "current-level-bytes" )] |
50 | pub fn current_level_bytes(&self) -> u64 { |
51 | unsafe { ffi::gst_app_src_get_current_level_bytes(self.to_glib_none().0) } |
52 | } |
53 | |
54 | #[cfg (feature = "v1_20" )] |
55 | #[cfg_attr (docsrs, doc(cfg(feature = "v1_20" )))] |
56 | #[doc (alias = "gst_app_src_get_current_level_time" )] |
57 | #[doc (alias = "get_current_level_time" )] |
58 | #[doc (alias = "current-level-time" )] |
59 | pub fn current_level_time(&self) -> Option<gst::ClockTime> { |
60 | unsafe { |
61 | from_glib(ffi::gst_app_src_get_current_level_time( |
62 | self.to_glib_none().0, |
63 | )) |
64 | } |
65 | } |
66 | |
67 | #[doc (alias = "gst_app_src_get_duration" )] |
68 | #[doc (alias = "get_duration" )] |
69 | pub fn duration(&self) -> Option<gst::ClockTime> { |
70 | unsafe { from_glib(ffi::gst_app_src_get_duration(self.to_glib_none().0)) } |
71 | } |
72 | |
73 | #[cfg (feature = "v1_20" )] |
74 | #[cfg_attr (docsrs, doc(cfg(feature = "v1_20" )))] |
75 | #[doc (alias = "gst_app_src_get_leaky_type" )] |
76 | #[doc (alias = "get_leaky_type" )] |
77 | #[doc (alias = "leaky-type" )] |
78 | pub fn leaky_type(&self) -> AppLeakyType { |
79 | unsafe { from_glib(ffi::gst_app_src_get_leaky_type(self.to_glib_none().0)) } |
80 | } |
81 | |
82 | #[cfg (feature = "v1_20" )] |
83 | #[cfg_attr (docsrs, doc(cfg(feature = "v1_20" )))] |
84 | #[doc (alias = "gst_app_src_get_max_buffers" )] |
85 | #[doc (alias = "get_max_buffers" )] |
86 | #[doc (alias = "max-buffers" )] |
87 | pub fn max_buffers(&self) -> u64 { |
88 | unsafe { ffi::gst_app_src_get_max_buffers(self.to_glib_none().0) } |
89 | } |
90 | |
91 | #[doc (alias = "gst_app_src_get_max_bytes" )] |
92 | #[doc (alias = "get_max_bytes" )] |
93 | #[doc (alias = "max-bytes" )] |
94 | pub fn max_bytes(&self) -> u64 { |
95 | unsafe { ffi::gst_app_src_get_max_bytes(self.to_glib_none().0) } |
96 | } |
97 | |
98 | #[cfg (feature = "v1_20" )] |
99 | #[cfg_attr (docsrs, doc(cfg(feature = "v1_20" )))] |
100 | #[doc (alias = "gst_app_src_get_max_time" )] |
101 | #[doc (alias = "get_max_time" )] |
102 | #[doc (alias = "max-time" )] |
103 | pub fn max_time(&self) -> Option<gst::ClockTime> { |
104 | unsafe { from_glib(ffi::gst_app_src_get_max_time(self.to_glib_none().0)) } |
105 | } |
106 | |
107 | #[doc (alias = "gst_app_src_get_size" )] |
108 | #[doc (alias = "get_size" )] |
109 | pub fn size(&self) -> i64 { |
110 | unsafe { ffi::gst_app_src_get_size(self.to_glib_none().0) } |
111 | } |
112 | |
113 | #[doc (alias = "gst_app_src_get_stream_type" )] |
114 | #[doc (alias = "get_stream_type" )] |
115 | #[doc (alias = "stream-type" )] |
116 | pub fn stream_type(&self) -> AppStreamType { |
117 | unsafe { from_glib(ffi::gst_app_src_get_stream_type(self.to_glib_none().0)) } |
118 | } |
119 | |
120 | #[doc (alias = "gst_app_src_push_buffer" )] |
121 | pub fn push_buffer(&self, buffer: gst::Buffer) -> Result<gst::FlowSuccess, gst::FlowError> { |
122 | unsafe { |
123 | try_from_glib(ffi::gst_app_src_push_buffer( |
124 | self.to_glib_none().0, |
125 | buffer.into_glib_ptr(), |
126 | )) |
127 | } |
128 | } |
129 | |
130 | #[doc (alias = "gst_app_src_push_buffer_list" )] |
131 | pub fn push_buffer_list( |
132 | &self, |
133 | buffer_list: gst::BufferList, |
134 | ) -> Result<gst::FlowSuccess, gst::FlowError> { |
135 | unsafe { |
136 | try_from_glib(ffi::gst_app_src_push_buffer_list( |
137 | self.to_glib_none().0, |
138 | buffer_list.into_glib_ptr(), |
139 | )) |
140 | } |
141 | } |
142 | |
143 | #[doc (alias = "gst_app_src_push_sample" )] |
144 | pub fn push_sample(&self, sample: &gst::Sample) -> Result<gst::FlowSuccess, gst::FlowError> { |
145 | unsafe { |
146 | try_from_glib(ffi::gst_app_src_push_sample( |
147 | self.to_glib_none().0, |
148 | sample.to_glib_none().0, |
149 | )) |
150 | } |
151 | } |
152 | |
153 | //#[doc(alias = "gst_app_src_set_callbacks")] |
154 | //pub fn set_callbacks(&self, callbacks: /*Ignored*/&mut AppSrcCallbacks, user_data: /*Unimplemented*/Option<Basic: Pointer>) { |
155 | // unsafe { TODO: call ffi:gst_app_src_set_callbacks() } |
156 | //} |
157 | |
158 | #[doc (alias = "gst_app_src_set_caps" )] |
159 | #[doc (alias = "caps" )] |
160 | pub fn set_caps(&self, caps: Option<&gst::Caps>) { |
161 | unsafe { |
162 | ffi::gst_app_src_set_caps(self.to_glib_none().0, caps.to_glib_none().0); |
163 | } |
164 | } |
165 | |
166 | #[doc (alias = "gst_app_src_set_duration" )] |
167 | #[doc (alias = "duration" )] |
168 | pub fn set_duration(&self, duration: impl Into<Option<gst::ClockTime>>) { |
169 | unsafe { |
170 | ffi::gst_app_src_set_duration(self.to_glib_none().0, duration.into().into_glib()); |
171 | } |
172 | } |
173 | |
174 | #[cfg (feature = "v1_20" )] |
175 | #[cfg_attr (docsrs, doc(cfg(feature = "v1_20" )))] |
176 | #[doc (alias = "gst_app_src_set_leaky_type" )] |
177 | #[doc (alias = "leaky-type" )] |
178 | pub fn set_leaky_type(&self, leaky: AppLeakyType) { |
179 | unsafe { |
180 | ffi::gst_app_src_set_leaky_type(self.to_glib_none().0, leaky.into_glib()); |
181 | } |
182 | } |
183 | |
184 | #[cfg (feature = "v1_20" )] |
185 | #[cfg_attr (docsrs, doc(cfg(feature = "v1_20" )))] |
186 | #[doc (alias = "gst_app_src_set_max_buffers" )] |
187 | #[doc (alias = "max-buffers" )] |
188 | pub fn set_max_buffers(&self, max: u64) { |
189 | unsafe { |
190 | ffi::gst_app_src_set_max_buffers(self.to_glib_none().0, max); |
191 | } |
192 | } |
193 | |
194 | #[doc (alias = "gst_app_src_set_max_bytes" )] |
195 | #[doc (alias = "max-bytes" )] |
196 | pub fn set_max_bytes(&self, max: u64) { |
197 | unsafe { |
198 | ffi::gst_app_src_set_max_bytes(self.to_glib_none().0, max); |
199 | } |
200 | } |
201 | |
202 | #[cfg (feature = "v1_20" )] |
203 | #[cfg_attr (docsrs, doc(cfg(feature = "v1_20" )))] |
204 | #[doc (alias = "gst_app_src_set_max_time" )] |
205 | #[doc (alias = "max-time" )] |
206 | pub fn set_max_time(&self, max: impl Into<Option<gst::ClockTime>>) { |
207 | unsafe { |
208 | ffi::gst_app_src_set_max_time(self.to_glib_none().0, max.into().into_glib()); |
209 | } |
210 | } |
211 | |
212 | #[doc (alias = "gst_app_src_set_size" )] |
213 | #[doc (alias = "size" )] |
214 | pub fn set_size(&self, size: i64) { |
215 | unsafe { |
216 | ffi::gst_app_src_set_size(self.to_glib_none().0, size); |
217 | } |
218 | } |
219 | |
220 | #[doc (alias = "gst_app_src_set_stream_type" )] |
221 | #[doc (alias = "stream-type" )] |
222 | pub fn set_stream_type(&self, type_: AppStreamType) { |
223 | unsafe { |
224 | ffi::gst_app_src_set_stream_type(self.to_glib_none().0, type_.into_glib()); |
225 | } |
226 | } |
227 | |
228 | pub fn is_block(&self) -> bool { |
229 | ObjectExt::property(self, "block" ) |
230 | } |
231 | |
232 | pub fn set_block(&self, block: bool) { |
233 | ObjectExt::set_property(self, "block" , block) |
234 | } |
235 | |
236 | pub fn format(&self) -> gst::Format { |
237 | ObjectExt::property(self, "format" ) |
238 | } |
239 | |
240 | pub fn set_format(&self, format: gst::Format) { |
241 | ObjectExt::set_property(self, "format" , format) |
242 | } |
243 | |
244 | #[cfg (feature = "v1_18" )] |
245 | #[cfg_attr (docsrs, doc(cfg(feature = "v1_18" )))] |
246 | #[doc (alias = "handle-segment-change" )] |
247 | pub fn is_handle_segment_change(&self) -> bool { |
248 | ObjectExt::property(self, "handle-segment-change" ) |
249 | } |
250 | |
251 | #[cfg (feature = "v1_18" )] |
252 | #[cfg_attr (docsrs, doc(cfg(feature = "v1_18" )))] |
253 | #[doc (alias = "handle-segment-change" )] |
254 | pub fn set_handle_segment_change(&self, handle_segment_change: bool) { |
255 | ObjectExt::set_property(self, "handle-segment-change" , handle_segment_change) |
256 | } |
257 | |
258 | #[doc (alias = "is-live" )] |
259 | pub fn is_live(&self) -> bool { |
260 | ObjectExt::property(self, "is-live" ) |
261 | } |
262 | |
263 | #[doc (alias = "is-live" )] |
264 | pub fn set_is_live(&self, is_live: bool) { |
265 | ObjectExt::set_property(self, "is-live" , is_live) |
266 | } |
267 | |
268 | #[doc (alias = "max-latency" )] |
269 | pub fn max_latency(&self) -> i64 { |
270 | ObjectExt::property(self, "max-latency" ) |
271 | } |
272 | |
273 | #[doc (alias = "max-latency" )] |
274 | pub fn set_max_latency(&self, max_latency: i64) { |
275 | ObjectExt::set_property(self, "max-latency" , max_latency) |
276 | } |
277 | |
278 | #[doc (alias = "min-latency" )] |
279 | pub fn min_latency(&self) -> i64 { |
280 | ObjectExt::property(self, "min-latency" ) |
281 | } |
282 | |
283 | #[doc (alias = "min-latency" )] |
284 | pub fn set_min_latency(&self, min_latency: i64) { |
285 | ObjectExt::set_property(self, "min-latency" , min_latency) |
286 | } |
287 | |
288 | #[doc (alias = "min-percent" )] |
289 | pub fn min_percent(&self) -> u32 { |
290 | ObjectExt::property(self, "min-percent" ) |
291 | } |
292 | |
293 | #[doc (alias = "min-percent" )] |
294 | pub fn set_min_percent(&self, min_percent: u32) { |
295 | ObjectExt::set_property(self, "min-percent" , min_percent) |
296 | } |
297 | |
298 | #[doc (alias = "block" )] |
299 | pub fn connect_block_notify<F: Fn(&Self) + Send + Sync + 'static>( |
300 | &self, |
301 | f: F, |
302 | ) -> SignalHandlerId { |
303 | unsafe extern "C" fn notify_block_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>( |
304 | this: *mut ffi::GstAppSrc, |
305 | _param_spec: glib::ffi::gpointer, |
306 | f: glib::ffi::gpointer, |
307 | ) { |
308 | let f: &F = &*(f as *const F); |
309 | f(&from_glib_borrow(this)) |
310 | } |
311 | unsafe { |
312 | let f: Box_<F> = Box_::new(f); |
313 | connect_raw( |
314 | self.as_ptr() as *mut _, |
315 | b"notify::block \0" .as_ptr() as *const _, |
316 | Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( |
317 | notify_block_trampoline::<F> as *const (), |
318 | )), |
319 | Box_::into_raw(f), |
320 | ) |
321 | } |
322 | } |
323 | |
324 | #[doc (alias = "caps" )] |
325 | pub fn connect_caps_notify<F: Fn(&Self) + Send + Sync + 'static>( |
326 | &self, |
327 | f: F, |
328 | ) -> SignalHandlerId { |
329 | unsafe extern "C" fn notify_caps_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>( |
330 | this: *mut ffi::GstAppSrc, |
331 | _param_spec: glib::ffi::gpointer, |
332 | f: glib::ffi::gpointer, |
333 | ) { |
334 | let f: &F = &*(f as *const F); |
335 | f(&from_glib_borrow(this)) |
336 | } |
337 | unsafe { |
338 | let f: Box_<F> = Box_::new(f); |
339 | connect_raw( |
340 | self.as_ptr() as *mut _, |
341 | b"notify::caps \0" .as_ptr() as *const _, |
342 | Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( |
343 | notify_caps_trampoline::<F> as *const (), |
344 | )), |
345 | Box_::into_raw(f), |
346 | ) |
347 | } |
348 | } |
349 | |
350 | #[cfg (feature = "v1_20" )] |
351 | #[cfg_attr (docsrs, doc(cfg(feature = "v1_20" )))] |
352 | #[doc (alias = "current-level-buffers" )] |
353 | pub fn connect_current_level_buffers_notify<F: Fn(&Self) + Send + Sync + 'static>( |
354 | &self, |
355 | f: F, |
356 | ) -> SignalHandlerId { |
357 | unsafe extern "C" fn notify_current_level_buffers_trampoline< |
358 | F: Fn(&AppSrc) + Send + Sync + 'static, |
359 | >( |
360 | this: *mut ffi::GstAppSrc, |
361 | _param_spec: glib::ffi::gpointer, |
362 | f: glib::ffi::gpointer, |
363 | ) { |
364 | let f: &F = &*(f as *const F); |
365 | f(&from_glib_borrow(this)) |
366 | } |
367 | unsafe { |
368 | let f: Box_<F> = Box_::new(f); |
369 | connect_raw( |
370 | self.as_ptr() as *mut _, |
371 | b"notify::current-level-buffers \0" .as_ptr() as *const _, |
372 | Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( |
373 | notify_current_level_buffers_trampoline::<F> as *const (), |
374 | )), |
375 | Box_::into_raw(f), |
376 | ) |
377 | } |
378 | } |
379 | |
380 | #[doc (alias = "current-level-bytes" )] |
381 | pub fn connect_current_level_bytes_notify<F: Fn(&Self) + Send + Sync + 'static>( |
382 | &self, |
383 | f: F, |
384 | ) -> SignalHandlerId { |
385 | unsafe extern "C" fn notify_current_level_bytes_trampoline< |
386 | F: Fn(&AppSrc) + Send + Sync + 'static, |
387 | >( |
388 | this: *mut ffi::GstAppSrc, |
389 | _param_spec: glib::ffi::gpointer, |
390 | f: glib::ffi::gpointer, |
391 | ) { |
392 | let f: &F = &*(f as *const F); |
393 | f(&from_glib_borrow(this)) |
394 | } |
395 | unsafe { |
396 | let f: Box_<F> = Box_::new(f); |
397 | connect_raw( |
398 | self.as_ptr() as *mut _, |
399 | b"notify::current-level-bytes \0" .as_ptr() as *const _, |
400 | Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( |
401 | notify_current_level_bytes_trampoline::<F> as *const (), |
402 | )), |
403 | Box_::into_raw(f), |
404 | ) |
405 | } |
406 | } |
407 | |
408 | #[cfg (feature = "v1_20" )] |
409 | #[cfg_attr (docsrs, doc(cfg(feature = "v1_20" )))] |
410 | #[doc (alias = "current-level-time" )] |
411 | pub fn connect_current_level_time_notify<F: Fn(&Self) + Send + Sync + 'static>( |
412 | &self, |
413 | f: F, |
414 | ) -> SignalHandlerId { |
415 | unsafe extern "C" fn notify_current_level_time_trampoline< |
416 | F: Fn(&AppSrc) + Send + Sync + 'static, |
417 | >( |
418 | this: *mut ffi::GstAppSrc, |
419 | _param_spec: glib::ffi::gpointer, |
420 | f: glib::ffi::gpointer, |
421 | ) { |
422 | let f: &F = &*(f as *const F); |
423 | f(&from_glib_borrow(this)) |
424 | } |
425 | unsafe { |
426 | let f: Box_<F> = Box_::new(f); |
427 | connect_raw( |
428 | self.as_ptr() as *mut _, |
429 | b"notify::current-level-time \0" .as_ptr() as *const _, |
430 | Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( |
431 | notify_current_level_time_trampoline::<F> as *const (), |
432 | )), |
433 | Box_::into_raw(f), |
434 | ) |
435 | } |
436 | } |
437 | |
438 | #[doc (alias = "duration" )] |
439 | pub fn connect_duration_notify<F: Fn(&Self) + Send + Sync + 'static>( |
440 | &self, |
441 | f: F, |
442 | ) -> SignalHandlerId { |
443 | unsafe extern "C" fn notify_duration_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>( |
444 | this: *mut ffi::GstAppSrc, |
445 | _param_spec: glib::ffi::gpointer, |
446 | f: glib::ffi::gpointer, |
447 | ) { |
448 | let f: &F = &*(f as *const F); |
449 | f(&from_glib_borrow(this)) |
450 | } |
451 | unsafe { |
452 | let f: Box_<F> = Box_::new(f); |
453 | connect_raw( |
454 | self.as_ptr() as *mut _, |
455 | b"notify::duration \0" .as_ptr() as *const _, |
456 | Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( |
457 | notify_duration_trampoline::<F> as *const (), |
458 | )), |
459 | Box_::into_raw(f), |
460 | ) |
461 | } |
462 | } |
463 | |
464 | #[doc (alias = "format" )] |
465 | pub fn connect_format_notify<F: Fn(&Self) + Send + Sync + 'static>( |
466 | &self, |
467 | f: F, |
468 | ) -> SignalHandlerId { |
469 | unsafe extern "C" fn notify_format_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>( |
470 | this: *mut ffi::GstAppSrc, |
471 | _param_spec: glib::ffi::gpointer, |
472 | f: glib::ffi::gpointer, |
473 | ) { |
474 | let f: &F = &*(f as *const F); |
475 | f(&from_glib_borrow(this)) |
476 | } |
477 | unsafe { |
478 | let f: Box_<F> = Box_::new(f); |
479 | connect_raw( |
480 | self.as_ptr() as *mut _, |
481 | b"notify::format \0" .as_ptr() as *const _, |
482 | Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( |
483 | notify_format_trampoline::<F> as *const (), |
484 | )), |
485 | Box_::into_raw(f), |
486 | ) |
487 | } |
488 | } |
489 | |
490 | #[cfg (feature = "v1_18" )] |
491 | #[cfg_attr (docsrs, doc(cfg(feature = "v1_18" )))] |
492 | #[doc (alias = "handle-segment-change" )] |
493 | pub fn connect_handle_segment_change_notify<F: Fn(&Self) + Send + Sync + 'static>( |
494 | &self, |
495 | f: F, |
496 | ) -> SignalHandlerId { |
497 | unsafe extern "C" fn notify_handle_segment_change_trampoline< |
498 | F: Fn(&AppSrc) + Send + Sync + 'static, |
499 | >( |
500 | this: *mut ffi::GstAppSrc, |
501 | _param_spec: glib::ffi::gpointer, |
502 | f: glib::ffi::gpointer, |
503 | ) { |
504 | let f: &F = &*(f as *const F); |
505 | f(&from_glib_borrow(this)) |
506 | } |
507 | unsafe { |
508 | let f: Box_<F> = Box_::new(f); |
509 | connect_raw( |
510 | self.as_ptr() as *mut _, |
511 | b"notify::handle-segment-change \0" .as_ptr() as *const _, |
512 | Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( |
513 | notify_handle_segment_change_trampoline::<F> as *const (), |
514 | )), |
515 | Box_::into_raw(f), |
516 | ) |
517 | } |
518 | } |
519 | |
520 | #[doc (alias = "is-live" )] |
521 | pub fn connect_is_live_notify<F: Fn(&Self) + Send + Sync + 'static>( |
522 | &self, |
523 | f: F, |
524 | ) -> SignalHandlerId { |
525 | unsafe extern "C" fn notify_is_live_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>( |
526 | this: *mut ffi::GstAppSrc, |
527 | _param_spec: glib::ffi::gpointer, |
528 | f: glib::ffi::gpointer, |
529 | ) { |
530 | let f: &F = &*(f as *const F); |
531 | f(&from_glib_borrow(this)) |
532 | } |
533 | unsafe { |
534 | let f: Box_<F> = Box_::new(f); |
535 | connect_raw( |
536 | self.as_ptr() as *mut _, |
537 | b"notify::is-live \0" .as_ptr() as *const _, |
538 | Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( |
539 | notify_is_live_trampoline::<F> as *const (), |
540 | )), |
541 | Box_::into_raw(f), |
542 | ) |
543 | } |
544 | } |
545 | |
546 | #[cfg (feature = "v1_20" )] |
547 | #[cfg_attr (docsrs, doc(cfg(feature = "v1_20" )))] |
548 | #[doc (alias = "leaky-type" )] |
549 | pub fn connect_leaky_type_notify<F: Fn(&Self) + Send + Sync + 'static>( |
550 | &self, |
551 | f: F, |
552 | ) -> SignalHandlerId { |
553 | unsafe extern "C" fn notify_leaky_type_trampoline< |
554 | F: Fn(&AppSrc) + Send + Sync + 'static, |
555 | >( |
556 | this: *mut ffi::GstAppSrc, |
557 | _param_spec: glib::ffi::gpointer, |
558 | f: glib::ffi::gpointer, |
559 | ) { |
560 | let f: &F = &*(f as *const F); |
561 | f(&from_glib_borrow(this)) |
562 | } |
563 | unsafe { |
564 | let f: Box_<F> = Box_::new(f); |
565 | connect_raw( |
566 | self.as_ptr() as *mut _, |
567 | b"notify::leaky-type \0" .as_ptr() as *const _, |
568 | Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( |
569 | notify_leaky_type_trampoline::<F> as *const (), |
570 | )), |
571 | Box_::into_raw(f), |
572 | ) |
573 | } |
574 | } |
575 | |
576 | #[cfg (feature = "v1_20" )] |
577 | #[cfg_attr (docsrs, doc(cfg(feature = "v1_20" )))] |
578 | #[doc (alias = "max-buffers" )] |
579 | pub fn connect_max_buffers_notify<F: Fn(&Self) + Send + Sync + 'static>( |
580 | &self, |
581 | f: F, |
582 | ) -> SignalHandlerId { |
583 | unsafe extern "C" fn notify_max_buffers_trampoline< |
584 | F: Fn(&AppSrc) + Send + Sync + 'static, |
585 | >( |
586 | this: *mut ffi::GstAppSrc, |
587 | _param_spec: glib::ffi::gpointer, |
588 | f: glib::ffi::gpointer, |
589 | ) { |
590 | let f: &F = &*(f as *const F); |
591 | f(&from_glib_borrow(this)) |
592 | } |
593 | unsafe { |
594 | let f: Box_<F> = Box_::new(f); |
595 | connect_raw( |
596 | self.as_ptr() as *mut _, |
597 | b"notify::max-buffers \0" .as_ptr() as *const _, |
598 | Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( |
599 | notify_max_buffers_trampoline::<F> as *const (), |
600 | )), |
601 | Box_::into_raw(f), |
602 | ) |
603 | } |
604 | } |
605 | |
606 | #[doc (alias = "max-bytes" )] |
607 | pub fn connect_max_bytes_notify<F: Fn(&Self) + Send + Sync + 'static>( |
608 | &self, |
609 | f: F, |
610 | ) -> SignalHandlerId { |
611 | unsafe extern "C" fn notify_max_bytes_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>( |
612 | this: *mut ffi::GstAppSrc, |
613 | _param_spec: glib::ffi::gpointer, |
614 | f: glib::ffi::gpointer, |
615 | ) { |
616 | let f: &F = &*(f as *const F); |
617 | f(&from_glib_borrow(this)) |
618 | } |
619 | unsafe { |
620 | let f: Box_<F> = Box_::new(f); |
621 | connect_raw( |
622 | self.as_ptr() as *mut _, |
623 | b"notify::max-bytes \0" .as_ptr() as *const _, |
624 | Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( |
625 | notify_max_bytes_trampoline::<F> as *const (), |
626 | )), |
627 | Box_::into_raw(f), |
628 | ) |
629 | } |
630 | } |
631 | |
632 | #[doc (alias = "max-latency" )] |
633 | pub fn connect_max_latency_notify<F: Fn(&Self) + Send + Sync + 'static>( |
634 | &self, |
635 | f: F, |
636 | ) -> SignalHandlerId { |
637 | unsafe extern "C" fn notify_max_latency_trampoline< |
638 | F: Fn(&AppSrc) + Send + Sync + 'static, |
639 | >( |
640 | this: *mut ffi::GstAppSrc, |
641 | _param_spec: glib::ffi::gpointer, |
642 | f: glib::ffi::gpointer, |
643 | ) { |
644 | let f: &F = &*(f as *const F); |
645 | f(&from_glib_borrow(this)) |
646 | } |
647 | unsafe { |
648 | let f: Box_<F> = Box_::new(f); |
649 | connect_raw( |
650 | self.as_ptr() as *mut _, |
651 | b"notify::max-latency \0" .as_ptr() as *const _, |
652 | Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( |
653 | notify_max_latency_trampoline::<F> as *const (), |
654 | )), |
655 | Box_::into_raw(f), |
656 | ) |
657 | } |
658 | } |
659 | |
660 | #[cfg (feature = "v1_20" )] |
661 | #[cfg_attr (docsrs, doc(cfg(feature = "v1_20" )))] |
662 | #[doc (alias = "max-time" )] |
663 | pub fn connect_max_time_notify<F: Fn(&Self) + Send + Sync + 'static>( |
664 | &self, |
665 | f: F, |
666 | ) -> SignalHandlerId { |
667 | unsafe extern "C" fn notify_max_time_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>( |
668 | this: *mut ffi::GstAppSrc, |
669 | _param_spec: glib::ffi::gpointer, |
670 | f: glib::ffi::gpointer, |
671 | ) { |
672 | let f: &F = &*(f as *const F); |
673 | f(&from_glib_borrow(this)) |
674 | } |
675 | unsafe { |
676 | let f: Box_<F> = Box_::new(f); |
677 | connect_raw( |
678 | self.as_ptr() as *mut _, |
679 | b"notify::max-time \0" .as_ptr() as *const _, |
680 | Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( |
681 | notify_max_time_trampoline::<F> as *const (), |
682 | )), |
683 | Box_::into_raw(f), |
684 | ) |
685 | } |
686 | } |
687 | |
688 | #[doc (alias = "min-latency" )] |
689 | pub fn connect_min_latency_notify<F: Fn(&Self) + Send + Sync + 'static>( |
690 | &self, |
691 | f: F, |
692 | ) -> SignalHandlerId { |
693 | unsafe extern "C" fn notify_min_latency_trampoline< |
694 | F: Fn(&AppSrc) + Send + Sync + 'static, |
695 | >( |
696 | this: *mut ffi::GstAppSrc, |
697 | _param_spec: glib::ffi::gpointer, |
698 | f: glib::ffi::gpointer, |
699 | ) { |
700 | let f: &F = &*(f as *const F); |
701 | f(&from_glib_borrow(this)) |
702 | } |
703 | unsafe { |
704 | let f: Box_<F> = Box_::new(f); |
705 | connect_raw( |
706 | self.as_ptr() as *mut _, |
707 | b"notify::min-latency \0" .as_ptr() as *const _, |
708 | Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( |
709 | notify_min_latency_trampoline::<F> as *const (), |
710 | )), |
711 | Box_::into_raw(f), |
712 | ) |
713 | } |
714 | } |
715 | |
716 | #[doc (alias = "min-percent" )] |
717 | pub fn connect_min_percent_notify<F: Fn(&Self) + Send + Sync + 'static>( |
718 | &self, |
719 | f: F, |
720 | ) -> SignalHandlerId { |
721 | unsafe extern "C" fn notify_min_percent_trampoline< |
722 | F: Fn(&AppSrc) + Send + Sync + 'static, |
723 | >( |
724 | this: *mut ffi::GstAppSrc, |
725 | _param_spec: glib::ffi::gpointer, |
726 | f: glib::ffi::gpointer, |
727 | ) { |
728 | let f: &F = &*(f as *const F); |
729 | f(&from_glib_borrow(this)) |
730 | } |
731 | unsafe { |
732 | let f: Box_<F> = Box_::new(f); |
733 | connect_raw( |
734 | self.as_ptr() as *mut _, |
735 | b"notify::min-percent \0" .as_ptr() as *const _, |
736 | Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( |
737 | notify_min_percent_trampoline::<F> as *const (), |
738 | )), |
739 | Box_::into_raw(f), |
740 | ) |
741 | } |
742 | } |
743 | |
744 | #[doc (alias = "size" )] |
745 | pub fn connect_size_notify<F: Fn(&Self) + Send + Sync + 'static>( |
746 | &self, |
747 | f: F, |
748 | ) -> SignalHandlerId { |
749 | unsafe extern "C" fn notify_size_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>( |
750 | this: *mut ffi::GstAppSrc, |
751 | _param_spec: glib::ffi::gpointer, |
752 | f: glib::ffi::gpointer, |
753 | ) { |
754 | let f: &F = &*(f as *const F); |
755 | f(&from_glib_borrow(this)) |
756 | } |
757 | unsafe { |
758 | let f: Box_<F> = Box_::new(f); |
759 | connect_raw( |
760 | self.as_ptr() as *mut _, |
761 | b"notify::size \0" .as_ptr() as *const _, |
762 | Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( |
763 | notify_size_trampoline::<F> as *const (), |
764 | )), |
765 | Box_::into_raw(f), |
766 | ) |
767 | } |
768 | } |
769 | |
770 | #[doc (alias = "stream-type" )] |
771 | pub fn connect_stream_type_notify<F: Fn(&Self) + Send + Sync + 'static>( |
772 | &self, |
773 | f: F, |
774 | ) -> SignalHandlerId { |
775 | unsafe extern "C" fn notify_stream_type_trampoline< |
776 | F: Fn(&AppSrc) + Send + Sync + 'static, |
777 | >( |
778 | this: *mut ffi::GstAppSrc, |
779 | _param_spec: glib::ffi::gpointer, |
780 | f: glib::ffi::gpointer, |
781 | ) { |
782 | let f: &F = &*(f as *const F); |
783 | f(&from_glib_borrow(this)) |
784 | } |
785 | unsafe { |
786 | let f: Box_<F> = Box_::new(f); |
787 | connect_raw( |
788 | self.as_ptr() as *mut _, |
789 | b"notify::stream-type \0" .as_ptr() as *const _, |
790 | Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( |
791 | notify_stream_type_trampoline::<F> as *const (), |
792 | )), |
793 | Box_::into_raw(f), |
794 | ) |
795 | } |
796 | } |
797 | } |
798 | |
799 | unsafe impl Send for AppSrc {} |
800 | unsafe impl Sync for AppSrc {} |
801 | |