Skip to main content

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