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 glib::{
7 prelude::*,
8 signal::{connect_raw, SignalHandlerId},
9 translate::*,
10};
11use std::{boxed::Box as Box_, mem::transmute};
12
13glib::wrapper! {
14 #[doc(alias = "GstAppSink")]
15 pub struct AppSink(Object<ffi::GstAppSink, ffi::GstAppSinkClass>) @extends gst::Element, gst::Object, @implements gst::URIHandler;
16
17 match fn {
18 type_ => || ffi::gst_app_sink_get_type(),
19 }
20}
21
22impl AppSink {
23 #[doc(alias = "gst_app_sink_get_buffer_list_support")]
24 #[doc(alias = "get_buffer_list_support")]
25 pub fn is_buffer_list_support(&self) -> bool {
26 unsafe {
27 from_glib(ffi::gst_app_sink_get_buffer_list_support(
28 self.to_glib_none().0,
29 ))
30 }
31 }
32
33 #[doc(alias = "gst_app_sink_get_caps")]
34 #[doc(alias = "get_caps")]
35 pub fn caps(&self) -> Option<gst::Caps> {
36 unsafe { from_glib_full(ffi::gst_app_sink_get_caps(self.to_glib_none().0)) }
37 }
38
39 #[doc(alias = "gst_app_sink_get_drop")]
40 #[doc(alias = "get_drop")]
41 pub fn is_drop(&self) -> bool {
42 unsafe { from_glib(ffi::gst_app_sink_get_drop(self.to_glib_none().0)) }
43 }
44
45 #[doc(alias = "gst_app_sink_get_max_buffers")]
46 #[doc(alias = "get_max_buffers")]
47 pub fn max_buffers(&self) -> u32 {
48 unsafe { ffi::gst_app_sink_get_max_buffers(self.to_glib_none().0) }
49 }
50
51 #[cfg(feature = "v1_24")]
52 #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
53 #[doc(alias = "gst_app_sink_get_max_bytes")]
54 #[doc(alias = "get_max_bytes")]
55 pub fn max_bytes(&self) -> u64 {
56 unsafe { ffi::gst_app_sink_get_max_bytes(self.to_glib_none().0) }
57 }
58
59 #[cfg(feature = "v1_24")]
60 #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
61 #[doc(alias = "gst_app_sink_get_max_time")]
62 #[doc(alias = "get_max_time")]
63 pub fn max_time(&self) -> Option<gst::ClockTime> {
64 unsafe { from_glib(ffi::gst_app_sink_get_max_time(self.to_glib_none().0)) }
65 }
66
67 #[doc(alias = "gst_app_sink_get_wait_on_eos")]
68 #[doc(alias = "get_wait_on_eos")]
69 pub fn is_wait_on_eos(&self) -> bool {
70 unsafe { from_glib(ffi::gst_app_sink_get_wait_on_eos(self.to_glib_none().0)) }
71 }
72
73 #[doc(alias = "gst_app_sink_is_eos")]
74 pub fn is_eos(&self) -> bool {
75 unsafe { from_glib(ffi::gst_app_sink_is_eos(self.to_glib_none().0)) }
76 }
77
78 #[cfg(feature = "v1_20")]
79 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
80 #[doc(alias = "gst_app_sink_pull_object")]
81 pub fn pull_object(&self) -> Result<gst::MiniObject, glib::BoolError> {
82 unsafe {
83 Option::<_>::from_glib_full(ffi::gst_app_sink_pull_object(self.to_glib_none().0))
84 .ok_or_else(|| glib::bool_error!("Failed to pull object"))
85 }
86 }
87
88 #[doc(alias = "gst_app_sink_pull_preroll")]
89 pub fn pull_preroll(&self) -> Result<gst::Sample, glib::BoolError> {
90 unsafe {
91 Option::<_>::from_glib_full(ffi::gst_app_sink_pull_preroll(self.to_glib_none().0))
92 .ok_or_else(|| glib::bool_error!("Failed to pull preroll sample"))
93 }
94 }
95
96 #[doc(alias = "gst_app_sink_pull_sample")]
97 pub fn pull_sample(&self) -> Result<gst::Sample, glib::BoolError> {
98 unsafe {
99 Option::<_>::from_glib_full(ffi::gst_app_sink_pull_sample(self.to_glib_none().0))
100 .ok_or_else(|| glib::bool_error!("Failed to pull sample"))
101 }
102 }
103
104 #[doc(alias = "gst_app_sink_set_buffer_list_support")]
105 pub fn set_buffer_list_support(&self, enable_lists: bool) {
106 unsafe {
107 ffi::gst_app_sink_set_buffer_list_support(
108 self.to_glib_none().0,
109 enable_lists.into_glib(),
110 );
111 }
112 }
113
114 //#[doc(alias = "gst_app_sink_set_callbacks")]
115 //pub fn set_callbacks(&self, callbacks: /*Ignored*/&mut AppSinkCallbacks, user_data: /*Unimplemented*/Option<Basic: Pointer>) {
116 // unsafe { TODO: call ffi:gst_app_sink_set_callbacks() }
117 //}
118
119 #[doc(alias = "gst_app_sink_set_caps")]
120 pub fn set_caps(&self, caps: Option<&gst::Caps>) {
121 unsafe {
122 ffi::gst_app_sink_set_caps(self.to_glib_none().0, caps.to_glib_none().0);
123 }
124 }
125
126 #[doc(alias = "gst_app_sink_set_drop")]
127 pub fn set_drop(&self, drop: bool) {
128 unsafe {
129 ffi::gst_app_sink_set_drop(self.to_glib_none().0, drop.into_glib());
130 }
131 }
132
133 #[doc(alias = "gst_app_sink_set_max_buffers")]
134 pub fn set_max_buffers(&self, max: u32) {
135 unsafe {
136 ffi::gst_app_sink_set_max_buffers(self.to_glib_none().0, max);
137 }
138 }
139
140 #[cfg(feature = "v1_24")]
141 #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
142 #[doc(alias = "gst_app_sink_set_max_bytes")]
143 pub fn set_max_bytes(&self, max: u64) {
144 unsafe {
145 ffi::gst_app_sink_set_max_bytes(self.to_glib_none().0, max);
146 }
147 }
148
149 #[cfg(feature = "v1_24")]
150 #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
151 #[doc(alias = "gst_app_sink_set_max_time")]
152 pub fn set_max_time(&self, max: impl Into<Option<gst::ClockTime>>) {
153 unsafe {
154 ffi::gst_app_sink_set_max_time(self.to_glib_none().0, max.into().into_glib());
155 }
156 }
157
158 #[doc(alias = "gst_app_sink_set_wait_on_eos")]
159 pub fn set_wait_on_eos(&self, wait: bool) {
160 unsafe {
161 ffi::gst_app_sink_set_wait_on_eos(self.to_glib_none().0, wait.into_glib());
162 }
163 }
164
165 #[cfg(feature = "v1_20")]
166 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
167 #[doc(alias = "gst_app_sink_try_pull_object")]
168 pub fn try_pull_object(
169 &self,
170 timeout: impl Into<Option<gst::ClockTime>>,
171 ) -> Option<gst::MiniObject> {
172 unsafe {
173 from_glib_full(ffi::gst_app_sink_try_pull_object(
174 self.to_glib_none().0,
175 timeout.into().into_glib(),
176 ))
177 }
178 }
179
180 #[doc(alias = "gst_app_sink_try_pull_preroll")]
181 pub fn try_pull_preroll(
182 &self,
183 timeout: impl Into<Option<gst::ClockTime>>,
184 ) -> Option<gst::Sample> {
185 unsafe {
186 from_glib_full(ffi::gst_app_sink_try_pull_preroll(
187 self.to_glib_none().0,
188 timeout.into().into_glib(),
189 ))
190 }
191 }
192
193 #[doc(alias = "gst_app_sink_try_pull_sample")]
194 pub fn try_pull_sample(
195 &self,
196 timeout: impl Into<Option<gst::ClockTime>>,
197 ) -> Option<gst::Sample> {
198 unsafe {
199 from_glib_full(ffi::gst_app_sink_try_pull_sample(
200 self.to_glib_none().0,
201 timeout.into().into_glib(),
202 ))
203 }
204 }
205
206 #[doc(alias = "buffer-list")]
207 pub fn is_buffer_list(&self) -> bool {
208 ObjectExt::property(self, "buffer-list")
209 }
210
211 #[doc(alias = "buffer-list")]
212 pub fn set_buffer_list(&self, buffer_list: bool) {
213 ObjectExt::set_property(self, "buffer-list", buffer_list)
214 }
215
216 #[doc(alias = "buffer-list")]
217 pub fn connect_buffer_list_notify<F: Fn(&Self) + Send + Sync + 'static>(
218 &self,
219 f: F,
220 ) -> SignalHandlerId {
221 unsafe extern "C" fn notify_buffer_list_trampoline<
222 F: Fn(&AppSink) + Send + Sync + 'static,
223 >(
224 this: *mut ffi::GstAppSink,
225 _param_spec: glib::ffi::gpointer,
226 f: glib::ffi::gpointer,
227 ) {
228 let f: &F = &*(f as *const F);
229 f(&from_glib_borrow(this))
230 }
231 unsafe {
232 let f: Box_<F> = Box_::new(f);
233 connect_raw(
234 self.as_ptr() as *mut _,
235 b"notify::buffer-list\0".as_ptr() as *const _,
236 Some(transmute::<_, unsafe extern "C" fn()>(
237 notify_buffer_list_trampoline::<F> as *const (),
238 )),
239 Box_::into_raw(f),
240 )
241 }
242 }
243
244 #[doc(alias = "caps")]
245 pub fn connect_caps_notify<F: Fn(&Self) + Send + Sync + 'static>(
246 &self,
247 f: F,
248 ) -> SignalHandlerId {
249 unsafe extern "C" fn notify_caps_trampoline<F: Fn(&AppSink) + Send + Sync + 'static>(
250 this: *mut ffi::GstAppSink,
251 _param_spec: glib::ffi::gpointer,
252 f: glib::ffi::gpointer,
253 ) {
254 let f: &F = &*(f as *const F);
255 f(&from_glib_borrow(this))
256 }
257 unsafe {
258 let f: Box_<F> = Box_::new(f);
259 connect_raw(
260 self.as_ptr() as *mut _,
261 b"notify::caps\0".as_ptr() as *const _,
262 Some(transmute::<_, unsafe extern "C" fn()>(
263 notify_caps_trampoline::<F> as *const (),
264 )),
265 Box_::into_raw(f),
266 )
267 }
268 }
269
270 #[doc(alias = "drop")]
271 pub fn connect_drop_notify<F: Fn(&Self) + Send + Sync + 'static>(
272 &self,
273 f: F,
274 ) -> SignalHandlerId {
275 unsafe extern "C" fn notify_drop_trampoline<F: Fn(&AppSink) + Send + Sync + 'static>(
276 this: *mut ffi::GstAppSink,
277 _param_spec: glib::ffi::gpointer,
278 f: glib::ffi::gpointer,
279 ) {
280 let f: &F = &*(f as *const F);
281 f(&from_glib_borrow(this))
282 }
283 unsafe {
284 let f: Box_<F> = Box_::new(f);
285 connect_raw(
286 self.as_ptr() as *mut _,
287 b"notify::drop\0".as_ptr() as *const _,
288 Some(transmute::<_, unsafe extern "C" fn()>(
289 notify_drop_trampoline::<F> as *const (),
290 )),
291 Box_::into_raw(f),
292 )
293 }
294 }
295
296 #[doc(alias = "eos")]
297 pub fn connect_eos_notify<F: Fn(&Self) + Send + Sync + 'static>(
298 &self,
299 f: F,
300 ) -> SignalHandlerId {
301 unsafe extern "C" fn notify_eos_trampoline<F: Fn(&AppSink) + Send + Sync + 'static>(
302 this: *mut ffi::GstAppSink,
303 _param_spec: glib::ffi::gpointer,
304 f: glib::ffi::gpointer,
305 ) {
306 let f: &F = &*(f as *const F);
307 f(&from_glib_borrow(this))
308 }
309 unsafe {
310 let f: Box_<F> = Box_::new(f);
311 connect_raw(
312 self.as_ptr() as *mut _,
313 b"notify::eos\0".as_ptr() as *const _,
314 Some(transmute::<_, unsafe extern "C" fn()>(
315 notify_eos_trampoline::<F> as *const (),
316 )),
317 Box_::into_raw(f),
318 )
319 }
320 }
321
322 #[doc(alias = "max-buffers")]
323 pub fn connect_max_buffers_notify<F: Fn(&Self) + Send + Sync + 'static>(
324 &self,
325 f: F,
326 ) -> SignalHandlerId {
327 unsafe extern "C" fn notify_max_buffers_trampoline<
328 F: Fn(&AppSink) + Send + Sync + 'static,
329 >(
330 this: *mut ffi::GstAppSink,
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::max-buffers\0".as_ptr() as *const _,
342 Some(transmute::<_, unsafe extern "C" fn()>(
343 notify_max_buffers_trampoline::<F> as *const (),
344 )),
345 Box_::into_raw(f),
346 )
347 }
348 }
349
350 #[cfg(feature = "v1_24")]
351 #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
352 #[doc(alias = "max-bytes")]
353 pub fn connect_max_bytes_notify<F: Fn(&Self) + Send + Sync + 'static>(
354 &self,
355 f: F,
356 ) -> SignalHandlerId {
357 unsafe extern "C" fn notify_max_bytes_trampoline<
358 F: Fn(&AppSink) + Send + Sync + 'static,
359 >(
360 this: *mut ffi::GstAppSink,
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::max-bytes\0".as_ptr() as *const _,
372 Some(transmute::<_, unsafe extern "C" fn()>(
373 notify_max_bytes_trampoline::<F> as *const (),
374 )),
375 Box_::into_raw(f),
376 )
377 }
378 }
379
380 #[cfg(feature = "v1_24")]
381 #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
382 #[doc(alias = "max-time")]
383 pub fn connect_max_time_notify<F: Fn(&Self) + Send + Sync + 'static>(
384 &self,
385 f: F,
386 ) -> SignalHandlerId {
387 unsafe extern "C" fn notify_max_time_trampoline<F: Fn(&AppSink) + Send + Sync + 'static>(
388 this: *mut ffi::GstAppSink,
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::max-time\0".as_ptr() as *const _,
400 Some(transmute::<_, unsafe extern "C" fn()>(
401 notify_max_time_trampoline::<F> as *const (),
402 )),
403 Box_::into_raw(f),
404 )
405 }
406 }
407
408 #[doc(alias = "wait-on-eos")]
409 pub fn connect_wait_on_eos_notify<F: Fn(&Self) + Send + Sync + 'static>(
410 &self,
411 f: F,
412 ) -> SignalHandlerId {
413 unsafe extern "C" fn notify_wait_on_eos_trampoline<
414 F: Fn(&AppSink) + Send + Sync + 'static,
415 >(
416 this: *mut ffi::GstAppSink,
417 _param_spec: glib::ffi::gpointer,
418 f: glib::ffi::gpointer,
419 ) {
420 let f: &F = &*(f as *const F);
421 f(&from_glib_borrow(this))
422 }
423 unsafe {
424 let f: Box_<F> = Box_::new(f);
425 connect_raw(
426 self.as_ptr() as *mut _,
427 b"notify::wait-on-eos\0".as_ptr() as *const _,
428 Some(transmute::<_, unsafe extern "C" fn()>(
429 notify_wait_on_eos_trampoline::<F> as *const (),
430 )),
431 Box_::into_raw(f),
432 )
433 }
434 }
435}
436
437unsafe impl Send for AppSink {}
438unsafe impl Sync for AppSink {}
439