gstreamer_app/auto/
app_sink.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#![allow(deprecated)]
6
7use crate::ffi;
8#[cfg(feature = "v1_28")]
9#[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
10use crate::AppLeakyType;
11use glib::{
12    prelude::*,
13    signal::{connect_raw, SignalHandlerId},
14    translate::*,
15};
16use std::boxed::Box as Box_;
17
18glib::wrapper! {
19    /// Appsink is a sink plugin that supports many different methods for making
20    /// the application get a handle on the GStreamer data in a pipeline. Unlike
21    /// most GStreamer elements, Appsink provides external API functions.
22    ///
23    /// appsink can be used by linking to the gstappsink.h header file to access the
24    /// methods or by using the appsink action signals and properties.
25    ///
26    /// The normal way of retrieving samples from appsink is by using the
27    /// [`pull_sample()`][Self::pull_sample()] and [`pull_preroll()`][Self::pull_preroll()] methods.
28    /// These methods block until a sample becomes available in the sink or when the
29    /// sink is shut down or reaches EOS. There are also timed variants of these
30    /// methods, [`try_pull_sample()`][Self::try_pull_sample()] and [`try_pull_preroll()`][Self::try_pull_preroll()],
31    /// which accept a timeout parameter to limit the amount of time to wait.
32    ///
33    /// Appsink will internally use a queue to collect buffers from the streaming
34    /// thread. If the application is not pulling samples fast enough, this queue
35    /// will consume a lot of memory over time. The "max-buffers", "max-time" and "max-bytes"
36    /// properties can be used to limit the queue size. The "leaky-type" property controls whether the
37    /// streaming thread blocks or if older buffers are dropped when the maximum
38    /// queue size is reached. Note that blocking the streaming thread can negatively
39    /// affect real-time performance and should be avoided.
40    ///
41    /// If a blocking behaviour is not desirable, setting the "emit-signals" property
42    /// to [`true`] will make appsink emit the "new-sample" and "new-preroll" signals
43    /// when a sample can be pulled without blocking.
44    ///
45    /// The "caps" property on appsink can be used to control the formats that
46    /// appsink can receive. This property can contain non-fixed caps, the format of
47    /// the pulled samples can be obtained by getting the sample caps.
48    ///
49    /// If one of the pull-preroll or pull-sample methods return [`None`], the appsink
50    /// is stopped or in the EOS state. You can check for the EOS state with the
51    /// "eos" property or with the [`is_eos()`][Self::is_eos()] method.
52    ///
53    /// The eos signal can also be used to be informed when the EOS state is reached
54    /// to avoid polling.
55    ///
56    /// ## Properties
57    ///
58    ///
59    /// #### `buffer-list`
60    ///  Readable | Writeable
61    ///
62    ///
63    /// #### `caps`
64    ///  Readable | Writeable
65    ///
66    ///
67    /// #### `current-level-buffers`
68    ///  The number of currently queued buffers inside appsink.
69    ///
70    /// Readable
71    ///
72    ///
73    /// #### `current-level-bytes`
74    ///  The number of currently queued bytes inside appsink.
75    ///
76    /// Readable
77    ///
78    ///
79    /// #### `current-level-time`
80    ///  The amount of currently queued time inside appsink.
81    ///
82    /// Readable
83    ///
84    ///
85    /// #### `drop`
86    ///  Drop old buffers when the buffer queue is filled.
87    ///
88    /// Readable | Writeable
89    ///
90    ///
91    /// #### `dropped`
92    ///  Number of buffers that were dropped.
93    ///
94    /// Readable
95    ///
96    ///
97    /// #### `emit-signals`
98    ///  Readable | Writeable
99    ///
100    ///
101    /// #### `eos`
102    ///  Readable
103    ///
104    ///
105    /// #### `in`
106    ///  Number of input buffers that were queued.
107    ///
108    /// Readable
109    ///
110    ///
111    /// #### `leaky-type`
112    ///  When set to any other value than GST_APP_LEAKY_TYPE_NONE then the appsink
113    /// will drop any buffers that are pushed into it once its internal queue is
114    /// full. The selected type defines whether to drop the oldest or new
115    /// buffers.
116    ///
117    /// Readable | Writeable
118    ///
119    ///
120    /// #### `max-buffers`
121    ///  Maximum amount of buffers in the queue (0 = unlimited).
122    ///
123    /// Readable | Writeable
124    ///
125    ///
126    /// #### `max-bytes`
127    ///  Maximum amount of bytes in the queue (0 = unlimited)
128    ///
129    /// Readable | Writeable
130    ///
131    ///
132    /// #### `max-time`
133    ///  Maximum total duration of data in the queue (0 = unlimited)
134    ///
135    /// Readable | Writeable
136    ///
137    ///
138    /// #### `out`
139    ///  Number of output buffers that were dequeued.
140    ///
141    /// Readable
142    ///
143    ///
144    /// #### `silent`
145    ///  Don't emit notify for input, output and dropped buffers.
146    ///
147    /// Readable | Writeable
148    ///
149    ///
150    /// #### `wait-on-eos`
151    ///  Wait for all buffers to be processed after receiving an EOS.
152    ///
153    /// In cases where it is uncertain if an `appsink` will have a consumer for its buffers
154    /// when it receives an EOS, set to [`false`] to ensure that the `appsink` will not hang.
155    ///
156    /// Readable | Writeable
157    /// <details><summary><h4>BaseSink</h4></summary>
158    ///
159    ///
160    /// #### `async`
161    ///  If set to [`true`], the basesink will perform asynchronous state changes.
162    /// When set to [`false`], the sink will not signal the parent when it prerolls.
163    /// Use this option when dealing with sparse streams or when synchronisation is
164    /// not required.
165    ///
166    /// Readable | Writeable
167    ///
168    ///
169    /// #### `blocksize`
170    ///  The amount of bytes to pull when operating in pull mode.
171    ///
172    /// Readable | Writeable
173    ///
174    ///
175    /// #### `enable-last-sample`
176    ///  Enable the last-sample property. If [`false`], basesink doesn't keep a
177    /// reference to the last buffer arrived and the last-sample property is always
178    /// set to [`None`]. This can be useful if you need buffers to be released as soon
179    /// as possible, eg. if you're using a buffer pool.
180    ///
181    /// Readable | Writeable
182    ///
183    ///
184    /// #### `last-sample`
185    ///  The last buffer that arrived in the sink and was used for preroll or for
186    /// rendering. This property can be used to generate thumbnails. This property
187    /// can be [`None`] when the sink has not yet received a buffer.
188    ///
189    /// Readable
190    ///
191    ///
192    /// #### `max-bitrate`
193    ///  Control the maximum amount of bits that will be rendered per second.
194    /// Setting this property to a value bigger than 0 will make the sink delay
195    /// rendering of the buffers when it would exceed to max-bitrate.
196    ///
197    /// Readable | Writeable
198    ///
199    ///
200    /// #### `max-lateness`
201    ///  Readable | Writeable
202    ///
203    ///
204    /// #### `processing-deadline`
205    ///  Maximum amount of time (in nanoseconds) that the pipeline can take
206    /// for processing the buffer. This is added to the latency of live
207    /// pipelines.
208    ///
209    /// Readable | Writeable
210    ///
211    ///
212    /// #### `qos`
213    ///  Readable | Writeable
214    ///
215    ///
216    /// #### `render-delay`
217    ///  The additional delay between synchronisation and actual rendering of the
218    /// media. This property will add additional latency to the device in order to
219    /// make other sinks compensate for the delay.
220    ///
221    /// Readable | Writeable
222    ///
223    ///
224    /// #### `stats`
225    ///  Various `GstBaseSink` statistics. This property returns a [`gst::Structure`][crate::gst::Structure]
226    /// with name `application/x-gst-base-sink-stats` with the following fields:
227    ///
228    /// - "average-rate" G_TYPE_DOUBLE average frame rate
229    /// - "dropped" G_TYPE_UINT64 Number of dropped frames
230    /// - "rendered" G_TYPE_UINT64 Number of rendered frames
231    ///
232    /// Readable
233    ///
234    ///
235    /// #### `sync`
236    ///  Readable | Writeable
237    ///
238    ///
239    /// #### `throttle-time`
240    ///  The time to insert between buffers. This property can be used to control
241    /// the maximum amount of buffers per second to render. Setting this property
242    /// to a value bigger than 0 will make the sink create THROTTLE QoS events.
243    ///
244    /// Readable | Writeable
245    ///
246    ///
247    /// #### `ts-offset`
248    ///  Controls the final synchronisation, a negative value will render the buffer
249    /// earlier while a positive value delays playback. This property can be
250    /// used to fix synchronisation in bad files.
251    ///
252    /// Readable | Writeable
253    /// </details>
254    /// <details><summary><h4>Object</h4></summary>
255    ///
256    ///
257    /// #### `name`
258    ///  Readable | Writeable | Construct
259    ///
260    ///
261    /// #### `parent`
262    ///  The parent of the object. Please note, that when changing the 'parent'
263    /// property, we don't emit [`notify`][struct@crate::glib::Object#notify] and [`deep-notify`][struct@crate::gst::Object#deep-notify]
264    /// signals due to locking issues. In some cases one can use
265    /// `GstBin::element-added` or `GstBin::element-removed` signals on the parent to
266    /// achieve a similar effect.
267    ///
268    /// Readable | Writeable
269    /// </details>
270    ///
271    /// ## Signals
272    ///
273    ///
274    /// #### `eos`
275    ///  Signal that the end-of-stream has been reached. This signal is emitted from
276    /// the streaming thread.
277    ///
278    ///
279    ///
280    ///
281    /// #### `new-preroll`
282    ///  Signal that a new preroll sample is available.
283    ///
284    /// This signal is emitted from the streaming thread and only when the
285    /// "emit-signals" property is [`true`].
286    ///
287    /// The new preroll sample can be retrieved with the "pull-preroll" action
288    /// signal or [`AppSink::pull_preroll()`][crate::AppSink::pull_preroll()] either from this signal callback
289    /// or from any other thread.
290    ///
291    /// Note that this signal is only emitted when the "emit-signals" property is
292    /// set to [`true`], which it is not by default for performance reasons.
293    ///
294    ///
295    ///
296    ///
297    /// #### `new-sample`
298    ///  Signal that a new sample is available.
299    ///
300    /// This signal is emitted from the streaming thread and only when the
301    /// "emit-signals" property is [`true`].
302    ///
303    /// The new sample can be retrieved with the "pull-sample" action
304    /// signal or [`AppSink::pull_sample()`][crate::AppSink::pull_sample()] either from this signal callback
305    /// or from any other thread.
306    ///
307    /// Note that this signal is only emitted when the "emit-signals" property is
308    /// set to [`true`], which it is not by default for performance reasons.
309    ///
310    ///
311    ///
312    ///
313    /// #### `new-serialized-event`
314    ///  Signal that a new downstream serialized event is available.
315    ///
316    /// This signal is emitted from the streaming thread and only when the
317    /// "emit-signals" property is [`true`].
318    ///
319    /// The new event can be retrieved with the "try-pull-object" action
320    /// signal or [`AppSink::pull_object()`][crate::AppSink::pull_object()] either from this signal callback
321    /// or from any other thread.
322    ///
323    /// EOS will not be notified using this signal, use [`eos`][struct@crate::AppSink#eos] instead.
324    /// EOS cannot be pulled either, use [`AppSink::is_eos()`][crate::AppSink::is_eos()] to check for it.
325    ///
326    /// Note that this signal is only emitted when the "emit-signals" property is
327    /// set to [`true`], which it is not by default for performance reasons.
328    ///
329    /// The callback should return [`true`] if the event has been handled, which will
330    /// skip basesink handling of the event, [`false`] otherwise.
331    ///
332    ///
333    ///
334    ///
335    /// #### `propose-allocation`
336    ///  Signal that a new propose_allocation query is available.
337    ///
338    /// This signal is emitted from the streaming thread and only when the
339    /// "emit-signals" property is [`true`].
340    ///
341    ///
342    ///
343    ///
344    /// #### `pull-preroll`
345    ///  Get the last preroll sample in `appsink`. This was the sample that caused the
346    /// appsink to preroll in the PAUSED state.
347    ///
348    /// This function is typically used when dealing with a pipeline in the PAUSED
349    /// state. Calling this function after doing a seek will give the sample right
350    /// after the seek position.
351    ///
352    /// Calling this function will clear the internal reference to the preroll
353    /// buffer.
354    ///
355    /// Note that the preroll sample will also be returned as the first sample
356    /// when calling [`AppSink::pull_sample()`][crate::AppSink::pull_sample()] or the "pull-sample" action signal.
357    ///
358    /// If an EOS event was received before any buffers, this function returns
359    /// [`None`]. Use gst_app_sink_is_eos () to check for the EOS condition.
360    ///
361    /// This function blocks until a preroll sample or EOS is received or the appsink
362    /// element is set to the READY/NULL state.
363    ///
364    /// Action
365    ///
366    ///
367    /// #### `pull-sample`
368    ///  This function blocks until a sample or EOS becomes available or the appsink
369    /// element is set to the READY/NULL state.
370    ///
371    /// This function will only return samples when the appsink is in the PLAYING
372    /// state. All rendered samples will be put in a queue so that the application
373    /// can pull samples at its own rate.
374    ///
375    /// Note that when the application does not pull samples fast enough, the
376    /// queued samples could consume a lot of memory, especially when dealing with
377    /// raw video frames. It's possible to control the behaviour of the queue with
378    /// the "leaky-type" and "max-buffers" / "max-bytes" / "max-time" set of properties.
379    ///
380    /// If an EOS event was received before any buffers, this function returns
381    /// [`None`]. Use gst_app_sink_is_eos () to check for the EOS condition.
382    ///
383    /// Action
384    ///
385    ///
386    /// #### `try-pull-object`
387    ///  This function blocks until a sample or an event becomes available or the appsink
388    /// element is set to the READY/NULL state or the timeout expires.
389    ///
390    /// This function will only return samples when the appsink is in the PLAYING
391    /// state. All rendered samples and events will be put in a queue so that the application
392    /// can pull them at its own rate.
393    /// Events can be pulled when the appsink is in the READY, PAUSED or PLAYING state.
394    ///
395    /// Note that when the application does not pull samples fast enough, the
396    /// queued samples could consume a lot of memory, especially when dealing with
397    /// raw video frames. It's possible to control the behaviour of the queue with
398    /// the "leaky-type" and "max-buffers" / "max-bytes" / "max-time" set of properties.
399    ///
400    /// This function will only pull serialized events, excluding
401    /// the EOS event for which this functions returns
402    /// [`None`]. Use [`AppSink::is_eos()`][crate::AppSink::is_eos()] to check for the EOS condition.
403    ///
404    /// This signal is a variant of [`try-pull-sample`][struct@crate::AppSink#try-pull-sample]: that can be used
405    /// to handle incoming events as well as samples.
406    ///
407    /// Note that future releases may extend this API to return other object types
408    /// so make sure that your code is checking for the actual type it is handling.
409    ///
410    /// Action
411    ///
412    ///
413    /// #### `try-pull-preroll`
414    ///  Get the last preroll sample in `appsink`. This was the sample that caused the
415    /// appsink to preroll in the PAUSED state.
416    ///
417    /// This function is typically used when dealing with a pipeline in the PAUSED
418    /// state. Calling this function after doing a seek will give the sample right
419    /// after the seek position.
420    ///
421    /// Calling this function will clear the internal reference to the preroll
422    /// buffer.
423    ///
424    /// Note that the preroll sample will also be returned as the first sample
425    /// when calling [`AppSink::pull_sample()`][crate::AppSink::pull_sample()] or the "pull-sample" action signal.
426    ///
427    /// If an EOS event was received before any buffers or the timeout expires,
428    /// this function returns [`None`]. Use gst_app_sink_is_eos () to check for the EOS
429    /// condition.
430    ///
431    /// This function blocks until a preroll sample or EOS is received, the appsink
432    /// element is set to the READY/NULL state, or the timeout expires.
433    ///
434    /// Action
435    ///
436    ///
437    /// #### `try-pull-sample`
438    ///  This function blocks until a sample or EOS becomes available or the appsink
439    /// element is set to the READY/NULL state or the timeout expires.
440    ///
441    /// This function will only return samples when the appsink is in the PLAYING
442    /// state. All rendered samples will be put in a queue so that the application
443    /// can pull samples at its own rate.
444    ///
445    /// Note that when the application does not pull samples fast enough, the
446    /// queued samples could consume a lot of memory, especially when dealing with
447    /// raw video frames. It's possible to control the behaviour of the queue with
448    /// the "leaky-type" and "max-buffers" / "max-bytes" / "max-time" set of properties.
449    ///
450    /// If an EOS event was received before any buffers or the timeout expires,
451    /// this function returns [`None`]. Use gst_app_sink_is_eos () to check
452    /// for the EOS condition.
453    ///
454    /// Action
455    /// <details><summary><h4>Element</h4></summary>
456    ///
457    ///
458    /// #### `no-more-pads`
459    ///  This signals that the element will not generate more dynamic pads.
460    /// Note that this signal will usually be emitted from the context of
461    /// the streaming thread.
462    ///
463    ///
464    ///
465    ///
466    /// #### `pad-added`
467    ///  a new `GstPad` has been added to the element. Note that this signal will
468    /// usually be emitted from the context of the streaming thread. Also keep in
469    /// mind that if you add new elements to the pipeline in the signal handler
470    /// you will need to set them to the desired target state with
471    /// [`ElementExtManual::set_state()`][crate::gst::prelude::ElementExtManual::set_state()] or [`ElementExtManual::sync_state_with_parent()`][crate::gst::prelude::ElementExtManual::sync_state_with_parent()].
472    ///
473    ///
474    ///
475    ///
476    /// #### `pad-removed`
477    ///  a `GstPad` has been removed from the element
478    ///
479    ///
480    /// </details>
481    /// <details><summary><h4>Object</h4></summary>
482    ///
483    ///
484    /// #### `deep-notify`
485    ///  The deep notify signal is used to be notified of property changes. It is
486    /// typically attached to the toplevel bin to receive notifications from all
487    /// the elements contained in that bin.
488    ///
489    /// Detailed
490    /// </details>
491    ///
492    /// # Implements
493    ///
494    /// [`trait@gst::prelude::ElementExt`], [`trait@gst::prelude::ObjectExt`], [`trait@glib::ObjectExt`], [`trait@gst::prelude::URIHandlerExt`]
495    #[doc(alias = "GstAppSink")]
496    pub struct AppSink(Object<ffi::GstAppSink, ffi::GstAppSinkClass>) @extends gst::Element, gst::Object, @implements gst::URIHandler;
497
498    match fn {
499        type_ => || ffi::gst_app_sink_get_type(),
500    }
501}
502
503impl AppSink {
504    /// Check if `self` supports buffer lists.
505    ///
506    /// # Returns
507    ///
508    /// [`true`] if `self` supports buffer lists.
509    #[doc(alias = "gst_app_sink_get_buffer_list_support")]
510    #[doc(alias = "get_buffer_list_support")]
511    pub fn is_buffer_list_support(&self) -> bool {
512        unsafe {
513            from_glib(ffi::gst_app_sink_get_buffer_list_support(
514                self.to_glib_none().0,
515            ))
516        }
517    }
518
519    /// Get the configured caps on `self`.
520    ///
521    /// # Returns
522    ///
523    /// the [`gst::Caps`][crate::gst::Caps] accepted by the sink. `gst_caps_unref()` after usage.
524    #[doc(alias = "gst_app_sink_get_caps")]
525    #[doc(alias = "get_caps")]
526    pub fn caps(&self) -> Option<gst::Caps> {
527        unsafe { from_glib_full(ffi::gst_app_sink_get_caps(self.to_glib_none().0)) }
528    }
529
530    /// Get the number of currently queued buffers inside `self`.
531    ///
532    /// # Returns
533    ///
534    /// The number of currently queued buffers.
535    #[cfg(feature = "v1_28")]
536    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
537    #[doc(alias = "gst_app_sink_get_current_level_buffers")]
538    #[doc(alias = "get_current_level_buffers")]
539    #[doc(alias = "current-level-buffers")]
540    pub fn current_level_buffers(&self) -> u64 {
541        unsafe { ffi::gst_app_sink_get_current_level_buffers(self.to_glib_none().0) }
542    }
543
544    /// Get the number of currently queued bytes inside `self`.
545    ///
546    /// # Returns
547    ///
548    /// The number of currently queued bytes.
549    #[cfg(feature = "v1_28")]
550    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
551    #[doc(alias = "gst_app_sink_get_current_level_bytes")]
552    #[doc(alias = "get_current_level_bytes")]
553    #[doc(alias = "current-level-bytes")]
554    pub fn current_level_bytes(&self) -> u64 {
555        unsafe { ffi::gst_app_sink_get_current_level_bytes(self.to_glib_none().0) }
556    }
557
558    /// Get the amount of currently queued time inside `self`.
559    ///
560    /// # Returns
561    ///
562    /// The amount of currently queued time.
563    #[cfg(feature = "v1_28")]
564    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
565    #[doc(alias = "gst_app_sink_get_current_level_time")]
566    #[doc(alias = "get_current_level_time")]
567    #[doc(alias = "current-level-time")]
568    pub fn current_level_time(&self) -> Option<gst::ClockTime> {
569        unsafe {
570            from_glib(ffi::gst_app_sink_get_current_level_time(
571                self.to_glib_none().0,
572            ))
573        }
574    }
575
576    /// Check if `self` will drop old buffers when the maximum amount of queued
577    /// data is reached (meaning max buffers, time or bytes limit, whichever is hit first).
578    ///
579    /// # Deprecated since 1.28
580    ///
581    /// Use [`AppSrc::leaky_type()`][crate::AppSrc::leaky_type()] instead.
582    ///
583    /// # Returns
584    ///
585    /// [`true`] if `self` is dropping old buffers when the queue is
586    /// filled.
587    #[cfg_attr(feature = "v1_28", deprecated = "Since 1.28")]
588    #[allow(deprecated)]
589    #[doc(alias = "gst_app_sink_get_drop")]
590    #[doc(alias = "get_drop")]
591    #[doc(alias = "drop")]
592    pub fn is_drop(&self) -> bool {
593        unsafe { from_glib(ffi::gst_app_sink_get_drop(self.to_glib_none().0)) }
594    }
595
596    /// Returns the currently set [`AppLeakyType`][crate::AppLeakyType]. See [`set_leaky_type()`][Self::set_leaky_type()]
597    /// for more details.
598    ///
599    /// # Returns
600    ///
601    /// The currently set [`AppLeakyType`][crate::AppLeakyType].
602    #[cfg(feature = "v1_28")]
603    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
604    #[doc(alias = "gst_app_sink_get_leaky_type")]
605    #[doc(alias = "get_leaky_type")]
606    #[doc(alias = "leaky-type")]
607    pub fn leaky_type(&self) -> AppLeakyType {
608        unsafe { from_glib(ffi::gst_app_sink_get_leaky_type(self.to_glib_none().0)) }
609    }
610
611    /// Get the maximum amount of buffers that can be queued in `self`.
612    ///
613    /// # Returns
614    ///
615    /// The maximum amount of buffers that can be queued.
616    #[doc(alias = "gst_app_sink_get_max_buffers")]
617    #[doc(alias = "get_max_buffers")]
618    #[doc(alias = "max-buffers")]
619    pub fn max_buffers(&self) -> u32 {
620        unsafe { ffi::gst_app_sink_get_max_buffers(self.to_glib_none().0) }
621    }
622
623    /// Get the maximum total size, in bytes, that can be queued in `self`.
624    ///
625    /// # Returns
626    ///
627    /// The maximum amount of bytes that can be queued
628    #[cfg(feature = "v1_24")]
629    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
630    #[doc(alias = "gst_app_sink_get_max_bytes")]
631    #[doc(alias = "get_max_bytes")]
632    #[doc(alias = "max-bytes")]
633    pub fn max_bytes(&self) -> u64 {
634        unsafe { ffi::gst_app_sink_get_max_bytes(self.to_glib_none().0) }
635    }
636
637    /// Get the maximum total duration that can be queued in `self`.
638    ///
639    /// # Returns
640    ///
641    /// The maximum total duration that can be queued.
642    #[cfg(feature = "v1_24")]
643    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
644    #[doc(alias = "gst_app_sink_get_max_time")]
645    #[doc(alias = "get_max_time")]
646    #[doc(alias = "max-time")]
647    pub fn max_time(&self) -> Option<gst::ClockTime> {
648        unsafe { from_glib(ffi::gst_app_sink_get_max_time(self.to_glib_none().0)) }
649    }
650
651    /// Check if `self` will wait for all buffers to be consumed when an EOS is
652    /// received.
653    ///
654    /// # Returns
655    ///
656    /// [`true`] if `self` will wait for all buffers to be consumed when an
657    /// EOS is received.
658    #[doc(alias = "gst_app_sink_get_wait_on_eos")]
659    #[doc(alias = "get_wait_on_eos")]
660    #[doc(alias = "wait-on-eos")]
661    pub fn is_wait_on_eos(&self) -> bool {
662        unsafe { from_glib(ffi::gst_app_sink_get_wait_on_eos(self.to_glib_none().0)) }
663    }
664
665    /// Check if `self` is EOS, which is when no more samples can be pulled because
666    /// an EOS event was received.
667    ///
668    /// This function also returns [`true`] when the appsink is not in the PAUSED or
669    /// PLAYING state.
670    ///
671    /// # Returns
672    ///
673    /// [`true`] if no more samples can be pulled and the appsink is EOS.
674    #[doc(alias = "gst_app_sink_is_eos")]
675    #[doc(alias = "eos")]
676    pub fn is_eos(&self) -> bool {
677        unsafe { from_glib(ffi::gst_app_sink_is_eos(self.to_glib_none().0)) }
678    }
679
680    /// This function blocks until a sample or an event becomes available or the appsink
681    /// element is set to the READY/NULL state.
682    ///
683    /// This function will only return samples when the appsink is in the PLAYING
684    /// state. All rendered buffers and events will be put in a queue so that the application
685    /// can pull them at its own rate. Note that when the application does not
686    /// pull samples fast enough, the queued buffers could consume a lot of memory,
687    /// especially when dealing with raw video frames.
688    /// Events can be pulled when the appsink is in the READY, PAUSED or PLAYING state.
689    ///
690    /// This function will only pull serialized events, excluding
691    /// the EOS event for which this functions returns
692    /// [`None`]. Use [`is_eos()`][Self::is_eos()] to check for the EOS condition.
693    ///
694    /// This method is a variant of [`pull_sample()`][Self::pull_sample()] that can be used
695    /// to handle incoming events events as well as samples.
696    ///
697    /// Note that future releases may extend this API to return other object types
698    /// so make sure that your code is checking for the actual type it is handling.
699    ///
700    /// # Returns
701    ///
702    /// a [`gst::Sample`][crate::gst::Sample], or a `GstEvent` or NULL when the appsink is stopped or EOS.
703    ///  Call `gst_mini_object_unref()` after usage.
704    #[cfg(feature = "v1_20")]
705    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
706    #[doc(alias = "gst_app_sink_pull_object")]
707    pub fn pull_object(&self) -> Result<gst::MiniObject, glib::BoolError> {
708        unsafe {
709            Option::<_>::from_glib_full(ffi::gst_app_sink_pull_object(self.to_glib_none().0))
710                .ok_or_else(|| glib::bool_error!("Failed to pull object"))
711        }
712    }
713
714    /// Get the last preroll sample in `self`. This was the sample that caused the
715    /// appsink to preroll in the PAUSED state.
716    ///
717    /// This function is typically used when dealing with a pipeline in the PAUSED
718    /// state. Calling this function after doing a seek will give the sample right
719    /// after the seek position.
720    ///
721    /// Calling this function will clear the internal reference to the preroll
722    /// buffer.
723    ///
724    /// Note that the preroll sample will also be returned as the first sample
725    /// when calling [`pull_sample()`][Self::pull_sample()].
726    ///
727    /// If an EOS event was received before any buffers, this function returns
728    /// [`None`]. Use gst_app_sink_is_eos () to check for the EOS condition.
729    ///
730    /// This function blocks until a preroll sample or EOS is received or the appsink
731    /// element is set to the READY/NULL state.
732    ///
733    /// # Returns
734    ///
735    /// a [`gst::Sample`][crate::gst::Sample] or NULL when the appsink is stopped or EOS.
736    ///  Call `gst_sample_unref()` after usage.
737    #[doc(alias = "gst_app_sink_pull_preroll")]
738    pub fn pull_preroll(&self) -> Result<gst::Sample, glib::BoolError> {
739        unsafe {
740            Option::<_>::from_glib_full(ffi::gst_app_sink_pull_preroll(self.to_glib_none().0))
741                .ok_or_else(|| glib::bool_error!("Failed to pull preroll sample"))
742        }
743    }
744
745    /// This function blocks until a sample or EOS becomes available or the appsink
746    /// element is set to the READY/NULL state.
747    ///
748    /// This function will only return samples when the appsink is in the PLAYING
749    /// state. All rendered buffers will be put in a queue so that the application
750    /// can pull samples at its own rate. Note that when the application does not
751    /// pull samples fast enough, the queued buffers could consume a lot of memory,
752    /// especially when dealing with raw video frames.
753    ///
754    /// If an EOS event was received before any buffers, this function returns
755    /// [`None`]. Use gst_app_sink_is_eos () to check for the EOS condition.
756    ///
757    /// # Returns
758    ///
759    /// a [`gst::Sample`][crate::gst::Sample] or NULL when the appsink is stopped or EOS.
760    ///  Call `gst_sample_unref()` after usage.
761    #[doc(alias = "gst_app_sink_pull_sample")]
762    pub fn pull_sample(&self) -> Result<gst::Sample, glib::BoolError> {
763        unsafe {
764            Option::<_>::from_glib_full(ffi::gst_app_sink_pull_sample(self.to_glib_none().0))
765                .ok_or_else(|| glib::bool_error!("Failed to pull sample"))
766        }
767    }
768
769    /// Instruct `self` to enable or disable buffer list support.
770    ///
771    /// For backwards-compatibility reasons applications need to opt in
772    /// to indicate that they will be able to handle buffer lists.
773    /// ## `enable_lists`
774    /// enable or disable buffer list support
775    #[doc(alias = "gst_app_sink_set_buffer_list_support")]
776    pub fn set_buffer_list_support(&self, enable_lists: bool) {
777        unsafe {
778            ffi::gst_app_sink_set_buffer_list_support(
779                self.to_glib_none().0,
780                enable_lists.into_glib(),
781            );
782        }
783    }
784
785    //#[doc(alias = "gst_app_sink_set_callbacks")]
786    //pub fn set_callbacks(&self, callbacks: /*Ignored*/&mut AppSinkCallbacks, user_data: /*Unimplemented*/Option<Basic: Pointer>) {
787    //    unsafe { TODO: call ffi:gst_app_sink_set_callbacks() }
788    //}
789
790    /// Set the capabilities on the appsink element. This function takes
791    /// a copy of the caps structure. After calling this method, the sink will only
792    /// accept caps that match `caps`. If `caps` is non-fixed, or incomplete,
793    /// you must check the caps on the samples to get the actual used caps.
794    /// ## `caps`
795    /// caps to set
796    #[doc(alias = "gst_app_sink_set_caps")]
797    #[doc(alias = "caps")]
798    pub fn set_caps(&self, caps: Option<&gst::Caps>) {
799        unsafe {
800            ffi::gst_app_sink_set_caps(self.to_glib_none().0, caps.to_glib_none().0);
801        }
802    }
803
804    /// Instruct `self` to drop old buffers when the maximum amount of queued
805    /// data is reached, that is, when any configured limit is hit (max-buffers, max-time or max-bytes).
806    ///
807    /// # Deprecated since 1.28
808    ///
809    /// Use [`AppSrc::leaky_type()`][crate::AppSrc::leaky_type()] instead.
810    /// ## `drop`
811    /// the new state
812    #[cfg_attr(feature = "v1_28", deprecated = "Since 1.28")]
813    #[allow(deprecated)]
814    #[doc(alias = "gst_app_sink_set_drop")]
815    #[doc(alias = "drop")]
816    pub fn set_drop(&self, drop: bool) {
817        unsafe {
818            ffi::gst_app_sink_set_drop(self.to_glib_none().0, drop.into_glib());
819        }
820    }
821
822    /// When set to any other value than GST_APP_LEAKY_TYPE_NONE then the appsink
823    /// will drop any buffers that are pushed into it once its internal queue is
824    /// full. The selected type defines whether to drop the oldest or new
825    /// buffers.
826    /// ## `leaky`
827    /// the [`AppLeakyType`][crate::AppLeakyType]
828    #[cfg(feature = "v1_28")]
829    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
830    #[doc(alias = "gst_app_sink_set_leaky_type")]
831    #[doc(alias = "leaky-type")]
832    pub fn set_leaky_type(&self, leaky: AppLeakyType) {
833        unsafe {
834            ffi::gst_app_sink_set_leaky_type(self.to_glib_none().0, leaky.into_glib());
835        }
836    }
837
838    /// Set the maximum amount of buffers that can be queued in `self`. After this
839    /// amount of buffers are queued in appsink, any more buffers will block upstream
840    /// elements until a sample is pulled from `self`, unless 'drop' is set, in which
841    /// case new buffers will be discarded.
842    /// ## `max`
843    /// the maximum number of buffers to queue
844    #[doc(alias = "gst_app_sink_set_max_buffers")]
845    #[doc(alias = "max-buffers")]
846    pub fn set_max_buffers(&self, max: u32) {
847        unsafe {
848            ffi::gst_app_sink_set_max_buffers(self.to_glib_none().0, max);
849        }
850    }
851
852    /// Set the maximum total size that can be queued in `self`. After this
853    /// amount of buffers are queued in appsink, any more buffers will block upstream
854    /// elements until a sample is pulled from `self`, unless 'drop' is set, in which
855    /// case new buffers will be discarded.
856    /// ## `max`
857    /// the maximum total size of buffers to queue, in bytes
858    #[cfg(feature = "v1_24")]
859    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
860    #[doc(alias = "gst_app_sink_set_max_bytes")]
861    #[doc(alias = "max-bytes")]
862    pub fn set_max_bytes(&self, max: u64) {
863        unsafe {
864            ffi::gst_app_sink_set_max_bytes(self.to_glib_none().0, max);
865        }
866    }
867
868    /// Set the maximum total duration that can be queued in `self`. After this
869    /// amount of buffers are queued in appsink, any more buffers will block upstream
870    /// elements until a sample is pulled from `self`, unless 'drop' is set, in which
871    /// case new buffers will be discarded.
872    /// ## `max`
873    /// the maximum total duration to queue
874    #[cfg(feature = "v1_24")]
875    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
876    #[doc(alias = "gst_app_sink_set_max_time")]
877    #[doc(alias = "max-time")]
878    pub fn set_max_time(&self, max: impl Into<Option<gst::ClockTime>>) {
879        unsafe {
880            ffi::gst_app_sink_set_max_time(self.to_glib_none().0, max.into().into_glib());
881        }
882    }
883
884    /// Instruct `self` to wait for all buffers to be consumed when an EOS is received.
885    /// ## `wait`
886    /// the new state
887    #[doc(alias = "gst_app_sink_set_wait_on_eos")]
888    #[doc(alias = "wait-on-eos")]
889    pub fn set_wait_on_eos(&self, wait: bool) {
890        unsafe {
891            ffi::gst_app_sink_set_wait_on_eos(self.to_glib_none().0, wait.into_glib());
892        }
893    }
894
895    /// This function blocks until a sample or an event or EOS becomes available or the appsink
896    /// element is set to the READY/NULL state or the timeout expires.
897    ///
898    /// This function will only return samples when the appsink is in the PLAYING
899    /// state. All rendered buffers and events will be put in a queue so that the application
900    /// can pull them at its own rate. Note that when the application does not
901    /// pull samples fast enough, the queued buffers could consume a lot of memory,
902    /// especially when dealing with raw video frames.
903    /// Events can be pulled when the appsink is in the READY, PAUSED or PLAYING state.
904    ///
905    /// This function will only pull serialized events, excluding
906    /// the EOS event for which this functions returns
907    /// [`None`]. Use [`is_eos()`][Self::is_eos()] to check for the EOS condition.
908    ///
909    /// This method is a variant of [`try_pull_sample()`][Self::try_pull_sample()] that can be used
910    /// to handle incoming events events as well as samples.
911    ///
912    /// Note that future releases may extend this API to return other object types
913    /// so make sure that your code is checking for the actual type it is handling.
914    /// ## `timeout`
915    /// the maximum amount of time to wait for a sample
916    ///
917    /// # Returns
918    ///
919    /// a [`gst::Sample`][crate::gst::Sample], or `GstEvent` or NULL when the appsink is stopped or EOS or the timeout expires.
920    /// Call `gst_mini_object_unref()` after usage.
921    #[cfg(feature = "v1_20")]
922    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
923    #[doc(alias = "gst_app_sink_try_pull_object")]
924    pub fn try_pull_object(
925        &self,
926        timeout: impl Into<Option<gst::ClockTime>>,
927    ) -> Option<gst::MiniObject> {
928        unsafe {
929            from_glib_full(ffi::gst_app_sink_try_pull_object(
930                self.to_glib_none().0,
931                timeout.into().into_glib(),
932            ))
933        }
934    }
935
936    /// Get the last preroll sample in `self`. This was the sample that caused the
937    /// appsink to preroll in the PAUSED state.
938    ///
939    /// This function is typically used when dealing with a pipeline in the PAUSED
940    /// state. Calling this function after doing a seek will give the sample right
941    /// after the seek position.
942    ///
943    /// Calling this function will clear the internal reference to the preroll
944    /// buffer.
945    ///
946    /// Note that the preroll sample will also be returned as the first sample
947    /// when calling [`pull_sample()`][Self::pull_sample()].
948    ///
949    /// If an EOS event was received before any buffers or the timeout expires,
950    /// this function returns [`None`]. Use gst_app_sink_is_eos () to check for the EOS
951    /// condition.
952    ///
953    /// This function blocks until a preroll sample or EOS is received, the appsink
954    /// element is set to the READY/NULL state, or the timeout expires.
955    /// ## `timeout`
956    /// the maximum amount of time to wait for the preroll sample
957    ///
958    /// # Returns
959    ///
960    /// a [`gst::Sample`][crate::gst::Sample] or NULL when the appsink is stopped or EOS or the timeout expires.
961    ///  Call `gst_sample_unref()` after usage.
962    #[doc(alias = "gst_app_sink_try_pull_preroll")]
963    pub fn try_pull_preroll(
964        &self,
965        timeout: impl Into<Option<gst::ClockTime>>,
966    ) -> Option<gst::Sample> {
967        unsafe {
968            from_glib_full(ffi::gst_app_sink_try_pull_preroll(
969                self.to_glib_none().0,
970                timeout.into().into_glib(),
971            ))
972        }
973    }
974
975    /// This function blocks until a sample or EOS becomes available or the appsink
976    /// element is set to the READY/NULL state or the timeout expires.
977    ///
978    /// This function will only return samples when the appsink is in the PLAYING
979    /// state. All rendered buffers will be put in a queue so that the application
980    /// can pull samples at its own rate. Note that when the application does not
981    /// pull samples fast enough, the queued buffers could consume a lot of memory,
982    /// especially when dealing with raw video frames.
983    ///
984    /// If an EOS event was received before any buffers or the timeout expires,
985    /// this function returns [`None`]. Use gst_app_sink_is_eos () to check for the EOS
986    /// condition.
987    /// ## `timeout`
988    /// the maximum amount of time to wait for a sample
989    ///
990    /// # Returns
991    ///
992    /// a [`gst::Sample`][crate::gst::Sample] or NULL when the appsink is stopped or EOS or the timeout expires.
993    ///  Call `gst_sample_unref()` after usage.
994    #[doc(alias = "gst_app_sink_try_pull_sample")]
995    pub fn try_pull_sample(
996        &self,
997        timeout: impl Into<Option<gst::ClockTime>>,
998    ) -> Option<gst::Sample> {
999        unsafe {
1000            from_glib_full(ffi::gst_app_sink_try_pull_sample(
1001                self.to_glib_none().0,
1002                timeout.into().into_glib(),
1003            ))
1004        }
1005    }
1006
1007    #[doc(alias = "buffer-list")]
1008    pub fn is_buffer_list(&self) -> bool {
1009        ObjectExt::property(self, "buffer-list")
1010    }
1011
1012    #[doc(alias = "buffer-list")]
1013    pub fn set_buffer_list(&self, buffer_list: bool) {
1014        ObjectExt::set_property(self, "buffer-list", buffer_list)
1015    }
1016
1017    /// Number of buffers that were dropped.
1018    #[cfg(feature = "v1_28")]
1019    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
1020    pub fn dropped(&self) -> u64 {
1021        ObjectExt::property(self, "dropped")
1022    }
1023
1024    /// Number of input buffers that were queued.
1025    #[cfg(feature = "v1_28")]
1026    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
1027    #[doc(alias = "in")]
1028    pub fn get_in(&self) -> u64 {
1029        ObjectExt::property(self, "in")
1030    }
1031
1032    /// Number of output buffers that were dequeued.
1033    #[cfg(feature = "v1_28")]
1034    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
1035    pub fn out(&self) -> u64 {
1036        ObjectExt::property(self, "out")
1037    }
1038
1039    /// Don't emit notify for input, output and dropped buffers.
1040    #[cfg(feature = "v1_28")]
1041    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
1042    pub fn is_silent(&self) -> bool {
1043        ObjectExt::property(self, "silent")
1044    }
1045
1046    /// Don't emit notify for input, output and dropped buffers.
1047    #[cfg(feature = "v1_28")]
1048    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
1049    pub fn set_silent(&self, silent: bool) {
1050        ObjectExt::set_property(self, "silent", silent)
1051    }
1052
1053    #[doc(alias = "buffer-list")]
1054    pub fn connect_buffer_list_notify<F: Fn(&Self) + Send + Sync + 'static>(
1055        &self,
1056        f: F,
1057    ) -> SignalHandlerId {
1058        unsafe extern "C" fn notify_buffer_list_trampoline<
1059            F: Fn(&AppSink) + Send + Sync + 'static,
1060        >(
1061            this: *mut ffi::GstAppSink,
1062            _param_spec: glib::ffi::gpointer,
1063            f: glib::ffi::gpointer,
1064        ) {
1065            let f: &F = &*(f as *const F);
1066            f(&from_glib_borrow(this))
1067        }
1068        unsafe {
1069            let f: Box_<F> = Box_::new(f);
1070            connect_raw(
1071                self.as_ptr() as *mut _,
1072                c"notify::buffer-list".as_ptr() as *const _,
1073                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1074                    notify_buffer_list_trampoline::<F> as *const (),
1075                )),
1076                Box_::into_raw(f),
1077            )
1078        }
1079    }
1080
1081    #[doc(alias = "caps")]
1082    pub fn connect_caps_notify<F: Fn(&Self) + Send + Sync + 'static>(
1083        &self,
1084        f: F,
1085    ) -> SignalHandlerId {
1086        unsafe extern "C" fn notify_caps_trampoline<F: Fn(&AppSink) + Send + Sync + 'static>(
1087            this: *mut ffi::GstAppSink,
1088            _param_spec: glib::ffi::gpointer,
1089            f: glib::ffi::gpointer,
1090        ) {
1091            let f: &F = &*(f as *const F);
1092            f(&from_glib_borrow(this))
1093        }
1094        unsafe {
1095            let f: Box_<F> = Box_::new(f);
1096            connect_raw(
1097                self.as_ptr() as *mut _,
1098                c"notify::caps".as_ptr() as *const _,
1099                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1100                    notify_caps_trampoline::<F> as *const (),
1101                )),
1102                Box_::into_raw(f),
1103            )
1104        }
1105    }
1106
1107    #[cfg(feature = "v1_28")]
1108    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
1109    #[doc(alias = "current-level-buffers")]
1110    pub fn connect_current_level_buffers_notify<F: Fn(&Self) + Send + Sync + 'static>(
1111        &self,
1112        f: F,
1113    ) -> SignalHandlerId {
1114        unsafe extern "C" fn notify_current_level_buffers_trampoline<
1115            F: Fn(&AppSink) + Send + Sync + 'static,
1116        >(
1117            this: *mut ffi::GstAppSink,
1118            _param_spec: glib::ffi::gpointer,
1119            f: glib::ffi::gpointer,
1120        ) {
1121            let f: &F = &*(f as *const F);
1122            f(&from_glib_borrow(this))
1123        }
1124        unsafe {
1125            let f: Box_<F> = Box_::new(f);
1126            connect_raw(
1127                self.as_ptr() as *mut _,
1128                c"notify::current-level-buffers".as_ptr() as *const _,
1129                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1130                    notify_current_level_buffers_trampoline::<F> as *const (),
1131                )),
1132                Box_::into_raw(f),
1133            )
1134        }
1135    }
1136
1137    #[cfg(feature = "v1_28")]
1138    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
1139    #[doc(alias = "current-level-bytes")]
1140    pub fn connect_current_level_bytes_notify<F: Fn(&Self) + Send + Sync + 'static>(
1141        &self,
1142        f: F,
1143    ) -> SignalHandlerId {
1144        unsafe extern "C" fn notify_current_level_bytes_trampoline<
1145            F: Fn(&AppSink) + Send + Sync + 'static,
1146        >(
1147            this: *mut ffi::GstAppSink,
1148            _param_spec: glib::ffi::gpointer,
1149            f: glib::ffi::gpointer,
1150        ) {
1151            let f: &F = &*(f as *const F);
1152            f(&from_glib_borrow(this))
1153        }
1154        unsafe {
1155            let f: Box_<F> = Box_::new(f);
1156            connect_raw(
1157                self.as_ptr() as *mut _,
1158                c"notify::current-level-bytes".as_ptr() as *const _,
1159                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1160                    notify_current_level_bytes_trampoline::<F> as *const (),
1161                )),
1162                Box_::into_raw(f),
1163            )
1164        }
1165    }
1166
1167    #[cfg(feature = "v1_28")]
1168    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
1169    #[doc(alias = "current-level-time")]
1170    pub fn connect_current_level_time_notify<F: Fn(&Self) + Send + Sync + 'static>(
1171        &self,
1172        f: F,
1173    ) -> SignalHandlerId {
1174        unsafe extern "C" fn notify_current_level_time_trampoline<
1175            F: Fn(&AppSink) + Send + Sync + 'static,
1176        >(
1177            this: *mut ffi::GstAppSink,
1178            _param_spec: glib::ffi::gpointer,
1179            f: glib::ffi::gpointer,
1180        ) {
1181            let f: &F = &*(f as *const F);
1182            f(&from_glib_borrow(this))
1183        }
1184        unsafe {
1185            let f: Box_<F> = Box_::new(f);
1186            connect_raw(
1187                self.as_ptr() as *mut _,
1188                c"notify::current-level-time".as_ptr() as *const _,
1189                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1190                    notify_current_level_time_trampoline::<F> as *const (),
1191                )),
1192                Box_::into_raw(f),
1193            )
1194        }
1195    }
1196
1197    #[cfg_attr(feature = "v1_28", deprecated = "Since 1.28")]
1198    #[doc(alias = "drop")]
1199    pub fn connect_drop_notify<F: Fn(&Self) + Send + Sync + 'static>(
1200        &self,
1201        f: F,
1202    ) -> SignalHandlerId {
1203        unsafe extern "C" fn notify_drop_trampoline<F: Fn(&AppSink) + Send + Sync + 'static>(
1204            this: *mut ffi::GstAppSink,
1205            _param_spec: glib::ffi::gpointer,
1206            f: glib::ffi::gpointer,
1207        ) {
1208            let f: &F = &*(f as *const F);
1209            f(&from_glib_borrow(this))
1210        }
1211        unsafe {
1212            let f: Box_<F> = Box_::new(f);
1213            connect_raw(
1214                self.as_ptr() as *mut _,
1215                c"notify::drop".as_ptr() as *const _,
1216                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1217                    notify_drop_trampoline::<F> as *const (),
1218                )),
1219                Box_::into_raw(f),
1220            )
1221        }
1222    }
1223
1224    #[cfg(feature = "v1_28")]
1225    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
1226    #[doc(alias = "dropped")]
1227    pub fn connect_dropped_notify<F: Fn(&Self) + Send + Sync + 'static>(
1228        &self,
1229        f: F,
1230    ) -> SignalHandlerId {
1231        unsafe extern "C" fn notify_dropped_trampoline<F: Fn(&AppSink) + Send + Sync + 'static>(
1232            this: *mut ffi::GstAppSink,
1233            _param_spec: glib::ffi::gpointer,
1234            f: glib::ffi::gpointer,
1235        ) {
1236            let f: &F = &*(f as *const F);
1237            f(&from_glib_borrow(this))
1238        }
1239        unsafe {
1240            let f: Box_<F> = Box_::new(f);
1241            connect_raw(
1242                self.as_ptr() as *mut _,
1243                c"notify::dropped".as_ptr() as *const _,
1244                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1245                    notify_dropped_trampoline::<F> as *const (),
1246                )),
1247                Box_::into_raw(f),
1248            )
1249        }
1250    }
1251
1252    #[doc(alias = "eos")]
1253    pub fn connect_eos_notify<F: Fn(&Self) + Send + Sync + 'static>(
1254        &self,
1255        f: F,
1256    ) -> SignalHandlerId {
1257        unsafe extern "C" fn notify_eos_trampoline<F: Fn(&AppSink) + Send + Sync + 'static>(
1258            this: *mut ffi::GstAppSink,
1259            _param_spec: glib::ffi::gpointer,
1260            f: glib::ffi::gpointer,
1261        ) {
1262            let f: &F = &*(f as *const F);
1263            f(&from_glib_borrow(this))
1264        }
1265        unsafe {
1266            let f: Box_<F> = Box_::new(f);
1267            connect_raw(
1268                self.as_ptr() as *mut _,
1269                c"notify::eos".as_ptr() as *const _,
1270                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1271                    notify_eos_trampoline::<F> as *const (),
1272                )),
1273                Box_::into_raw(f),
1274            )
1275        }
1276    }
1277
1278    #[cfg(feature = "v1_28")]
1279    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
1280    #[doc(alias = "in")]
1281    pub fn connect_in_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
1282        unsafe extern "C" fn notify_in_trampoline<F: Fn(&AppSink) + Send + Sync + 'static>(
1283            this: *mut ffi::GstAppSink,
1284            _param_spec: glib::ffi::gpointer,
1285            f: glib::ffi::gpointer,
1286        ) {
1287            let f: &F = &*(f as *const F);
1288            f(&from_glib_borrow(this))
1289        }
1290        unsafe {
1291            let f: Box_<F> = Box_::new(f);
1292            connect_raw(
1293                self.as_ptr() as *mut _,
1294                c"notify::in".as_ptr() as *const _,
1295                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1296                    notify_in_trampoline::<F> as *const (),
1297                )),
1298                Box_::into_raw(f),
1299            )
1300        }
1301    }
1302
1303    #[cfg(feature = "v1_28")]
1304    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
1305    #[doc(alias = "leaky-type")]
1306    pub fn connect_leaky_type_notify<F: Fn(&Self) + Send + Sync + 'static>(
1307        &self,
1308        f: F,
1309    ) -> SignalHandlerId {
1310        unsafe extern "C" fn notify_leaky_type_trampoline<
1311            F: Fn(&AppSink) + Send + Sync + 'static,
1312        >(
1313            this: *mut ffi::GstAppSink,
1314            _param_spec: glib::ffi::gpointer,
1315            f: glib::ffi::gpointer,
1316        ) {
1317            let f: &F = &*(f as *const F);
1318            f(&from_glib_borrow(this))
1319        }
1320        unsafe {
1321            let f: Box_<F> = Box_::new(f);
1322            connect_raw(
1323                self.as_ptr() as *mut _,
1324                c"notify::leaky-type".as_ptr() as *const _,
1325                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1326                    notify_leaky_type_trampoline::<F> as *const (),
1327                )),
1328                Box_::into_raw(f),
1329            )
1330        }
1331    }
1332
1333    #[doc(alias = "max-buffers")]
1334    pub fn connect_max_buffers_notify<F: Fn(&Self) + Send + Sync + 'static>(
1335        &self,
1336        f: F,
1337    ) -> SignalHandlerId {
1338        unsafe extern "C" fn notify_max_buffers_trampoline<
1339            F: Fn(&AppSink) + Send + Sync + 'static,
1340        >(
1341            this: *mut ffi::GstAppSink,
1342            _param_spec: glib::ffi::gpointer,
1343            f: glib::ffi::gpointer,
1344        ) {
1345            let f: &F = &*(f as *const F);
1346            f(&from_glib_borrow(this))
1347        }
1348        unsafe {
1349            let f: Box_<F> = Box_::new(f);
1350            connect_raw(
1351                self.as_ptr() as *mut _,
1352                c"notify::max-buffers".as_ptr() as *const _,
1353                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1354                    notify_max_buffers_trampoline::<F> as *const (),
1355                )),
1356                Box_::into_raw(f),
1357            )
1358        }
1359    }
1360
1361    #[cfg(feature = "v1_24")]
1362    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
1363    #[doc(alias = "max-bytes")]
1364    pub fn connect_max_bytes_notify<F: Fn(&Self) + Send + Sync + 'static>(
1365        &self,
1366        f: F,
1367    ) -> SignalHandlerId {
1368        unsafe extern "C" fn notify_max_bytes_trampoline<
1369            F: Fn(&AppSink) + Send + Sync + 'static,
1370        >(
1371            this: *mut ffi::GstAppSink,
1372            _param_spec: glib::ffi::gpointer,
1373            f: glib::ffi::gpointer,
1374        ) {
1375            let f: &F = &*(f as *const F);
1376            f(&from_glib_borrow(this))
1377        }
1378        unsafe {
1379            let f: Box_<F> = Box_::new(f);
1380            connect_raw(
1381                self.as_ptr() as *mut _,
1382                c"notify::max-bytes".as_ptr() as *const _,
1383                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1384                    notify_max_bytes_trampoline::<F> as *const (),
1385                )),
1386                Box_::into_raw(f),
1387            )
1388        }
1389    }
1390
1391    #[cfg(feature = "v1_24")]
1392    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
1393    #[doc(alias = "max-time")]
1394    pub fn connect_max_time_notify<F: Fn(&Self) + Send + Sync + 'static>(
1395        &self,
1396        f: F,
1397    ) -> SignalHandlerId {
1398        unsafe extern "C" fn notify_max_time_trampoline<F: Fn(&AppSink) + Send + Sync + 'static>(
1399            this: *mut ffi::GstAppSink,
1400            _param_spec: glib::ffi::gpointer,
1401            f: glib::ffi::gpointer,
1402        ) {
1403            let f: &F = &*(f as *const F);
1404            f(&from_glib_borrow(this))
1405        }
1406        unsafe {
1407            let f: Box_<F> = Box_::new(f);
1408            connect_raw(
1409                self.as_ptr() as *mut _,
1410                c"notify::max-time".as_ptr() as *const _,
1411                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1412                    notify_max_time_trampoline::<F> as *const (),
1413                )),
1414                Box_::into_raw(f),
1415            )
1416        }
1417    }
1418
1419    #[cfg(feature = "v1_28")]
1420    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
1421    #[doc(alias = "out")]
1422    pub fn connect_out_notify<F: Fn(&Self) + Send + Sync + 'static>(
1423        &self,
1424        f: F,
1425    ) -> SignalHandlerId {
1426        unsafe extern "C" fn notify_out_trampoline<F: Fn(&AppSink) + Send + Sync + 'static>(
1427            this: *mut ffi::GstAppSink,
1428            _param_spec: glib::ffi::gpointer,
1429            f: glib::ffi::gpointer,
1430        ) {
1431            let f: &F = &*(f as *const F);
1432            f(&from_glib_borrow(this))
1433        }
1434        unsafe {
1435            let f: Box_<F> = Box_::new(f);
1436            connect_raw(
1437                self.as_ptr() as *mut _,
1438                c"notify::out".as_ptr() as *const _,
1439                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1440                    notify_out_trampoline::<F> as *const (),
1441                )),
1442                Box_::into_raw(f),
1443            )
1444        }
1445    }
1446
1447    #[cfg(feature = "v1_28")]
1448    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
1449    #[doc(alias = "silent")]
1450    pub fn connect_silent_notify<F: Fn(&Self) + Send + Sync + 'static>(
1451        &self,
1452        f: F,
1453    ) -> SignalHandlerId {
1454        unsafe extern "C" fn notify_silent_trampoline<F: Fn(&AppSink) + Send + Sync + 'static>(
1455            this: *mut ffi::GstAppSink,
1456            _param_spec: glib::ffi::gpointer,
1457            f: glib::ffi::gpointer,
1458        ) {
1459            let f: &F = &*(f as *const F);
1460            f(&from_glib_borrow(this))
1461        }
1462        unsafe {
1463            let f: Box_<F> = Box_::new(f);
1464            connect_raw(
1465                self.as_ptr() as *mut _,
1466                c"notify::silent".as_ptr() as *const _,
1467                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1468                    notify_silent_trampoline::<F> as *const (),
1469                )),
1470                Box_::into_raw(f),
1471            )
1472        }
1473    }
1474
1475    #[doc(alias = "wait-on-eos")]
1476    pub fn connect_wait_on_eos_notify<F: Fn(&Self) + Send + Sync + 'static>(
1477        &self,
1478        f: F,
1479    ) -> SignalHandlerId {
1480        unsafe extern "C" fn notify_wait_on_eos_trampoline<
1481            F: Fn(&AppSink) + Send + Sync + 'static,
1482        >(
1483            this: *mut ffi::GstAppSink,
1484            _param_spec: glib::ffi::gpointer,
1485            f: glib::ffi::gpointer,
1486        ) {
1487            let f: &F = &*(f as *const F);
1488            f(&from_glib_borrow(this))
1489        }
1490        unsafe {
1491            let f: Box_<F> = Box_::new(f);
1492            connect_raw(
1493                self.as_ptr() as *mut _,
1494                c"notify::wait-on-eos".as_ptr() as *const _,
1495                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1496                    notify_wait_on_eos_trampoline::<F> as *const (),
1497                )),
1498                Box_::into_raw(f),
1499            )
1500        }
1501    }
1502}
1503
1504unsafe impl Send for AppSink {}
1505unsafe impl Sync for AppSink {}