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 | 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    //#[cfg(feature = "v1_28")]
885    //#[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
886    //#[doc(alias = "gst_app_sink_set_simple_callbacks")]
887    //pub fn set_simple_callbacks(&self, cb: /*Ignored*/Option<AppSinkSimpleCallbacks>) {
888    //    unsafe { TODO: call ffi:gst_app_sink_set_simple_callbacks() }
889    //}
890
891    /// Instruct `self` to wait for all buffers to be consumed when an EOS is received.
892    /// ## `wait`
893    /// the new state
894    #[doc(alias = "gst_app_sink_set_wait_on_eos")]
895    #[doc(alias = "wait-on-eos")]
896    pub fn set_wait_on_eos(&self, wait: bool) {
897        unsafe {
898            ffi::gst_app_sink_set_wait_on_eos(self.to_glib_none().0, wait.into_glib());
899        }
900    }
901
902    /// This function blocks until a sample or an event or EOS becomes available or the appsink
903    /// element is set to the READY/NULL state or the timeout expires.
904    ///
905    /// This function will only return samples when the appsink is in the PLAYING
906    /// state. All rendered buffers and events will be put in a queue so that the application
907    /// can pull them at its own rate. Note that when the application does not
908    /// pull samples fast enough, the queued buffers could consume a lot of memory,
909    /// especially when dealing with raw video frames.
910    /// Events can be pulled when the appsink is in the READY, PAUSED or PLAYING state.
911    ///
912    /// This function will only pull serialized events, excluding
913    /// the EOS event for which this functions returns
914    /// [`None`]. Use [`is_eos()`][Self::is_eos()] to check for the EOS condition.
915    ///
916    /// This method is a variant of [`try_pull_sample()`][Self::try_pull_sample()] that can be used
917    /// to handle incoming events events as well as samples.
918    ///
919    /// Note that future releases may extend this API to return other object types
920    /// so make sure that your code is checking for the actual type it is handling.
921    /// ## `timeout`
922    /// the maximum amount of time to wait for a sample
923    ///
924    /// # Returns
925    ///
926    /// a [`gst::Sample`][crate::gst::Sample], or `GstEvent` or NULL when the appsink is stopped or EOS or the timeout expires.
927    /// Call `gst_mini_object_unref()` after usage.
928    #[cfg(feature = "v1_20")]
929    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
930    #[doc(alias = "gst_app_sink_try_pull_object")]
931    pub fn try_pull_object(
932        &self,
933        timeout: impl Into<Option<gst::ClockTime>>,
934    ) -> Option<gst::MiniObject> {
935        unsafe {
936            from_glib_full(ffi::gst_app_sink_try_pull_object(
937                self.to_glib_none().0,
938                timeout.into().into_glib(),
939            ))
940        }
941    }
942
943    /// Get the last preroll sample in `self`. This was the sample that caused the
944    /// appsink to preroll in the PAUSED state.
945    ///
946    /// This function is typically used when dealing with a pipeline in the PAUSED
947    /// state. Calling this function after doing a seek will give the sample right
948    /// after the seek position.
949    ///
950    /// Calling this function will clear the internal reference to the preroll
951    /// buffer.
952    ///
953    /// Note that the preroll sample will also be returned as the first sample
954    /// when calling [`pull_sample()`][Self::pull_sample()].
955    ///
956    /// If an EOS event was received before any buffers or the timeout expires,
957    /// this function returns [`None`]. Use gst_app_sink_is_eos () to check for the EOS
958    /// condition.
959    ///
960    /// This function blocks until a preroll sample or EOS is received, the appsink
961    /// element is set to the READY/NULL state, or the timeout expires.
962    /// ## `timeout`
963    /// the maximum amount of time to wait for the preroll sample
964    ///
965    /// # Returns
966    ///
967    /// a [`gst::Sample`][crate::gst::Sample] or NULL when the appsink is stopped or EOS or the timeout expires.
968    ///  Call `gst_sample_unref()` after usage.
969    #[doc(alias = "gst_app_sink_try_pull_preroll")]
970    pub fn try_pull_preroll(
971        &self,
972        timeout: impl Into<Option<gst::ClockTime>>,
973    ) -> Option<gst::Sample> {
974        unsafe {
975            from_glib_full(ffi::gst_app_sink_try_pull_preroll(
976                self.to_glib_none().0,
977                timeout.into().into_glib(),
978            ))
979        }
980    }
981
982    /// This function blocks until a sample or EOS becomes available or the appsink
983    /// element is set to the READY/NULL state or the timeout expires.
984    ///
985    /// This function will only return samples when the appsink is in the PLAYING
986    /// state. All rendered buffers will be put in a queue so that the application
987    /// can pull samples at its own rate. Note that when the application does not
988    /// pull samples fast enough, the queued buffers could consume a lot of memory,
989    /// especially when dealing with raw video frames.
990    ///
991    /// If an EOS event was received before any buffers or the timeout expires,
992    /// this function returns [`None`]. Use gst_app_sink_is_eos () to check for the EOS
993    /// condition.
994    /// ## `timeout`
995    /// the maximum amount of time to wait for a sample
996    ///
997    /// # Returns
998    ///
999    /// a [`gst::Sample`][crate::gst::Sample] or NULL when the appsink is stopped or EOS or the timeout expires.
1000    ///  Call `gst_sample_unref()` after usage.
1001    #[doc(alias = "gst_app_sink_try_pull_sample")]
1002    pub fn try_pull_sample(
1003        &self,
1004        timeout: impl Into<Option<gst::ClockTime>>,
1005    ) -> Option<gst::Sample> {
1006        unsafe {
1007            from_glib_full(ffi::gst_app_sink_try_pull_sample(
1008                self.to_glib_none().0,
1009                timeout.into().into_glib(),
1010            ))
1011        }
1012    }
1013
1014    #[doc(alias = "buffer-list")]
1015    pub fn is_buffer_list(&self) -> bool {
1016        ObjectExt::property(self, "buffer-list")
1017    }
1018
1019    #[doc(alias = "buffer-list")]
1020    pub fn set_buffer_list(&self, buffer_list: bool) {
1021        ObjectExt::set_property(self, "buffer-list", buffer_list)
1022    }
1023
1024    /// Number of buffers that were dropped.
1025    #[cfg(feature = "v1_28")]
1026    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
1027    pub fn dropped(&self) -> u64 {
1028        ObjectExt::property(self, "dropped")
1029    }
1030
1031    /// Number of input buffers that were queued.
1032    #[cfg(feature = "v1_28")]
1033    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
1034    #[doc(alias = "in")]
1035    pub fn get_in(&self) -> u64 {
1036        ObjectExt::property(self, "in")
1037    }
1038
1039    /// Number of output buffers that were dequeued.
1040    #[cfg(feature = "v1_28")]
1041    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
1042    pub fn out(&self) -> u64 {
1043        ObjectExt::property(self, "out")
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 is_silent(&self) -> bool {
1050        ObjectExt::property(self, "silent")
1051    }
1052
1053    /// Don't emit notify for input, output and dropped buffers.
1054    #[cfg(feature = "v1_28")]
1055    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
1056    pub fn set_silent(&self, silent: bool) {
1057        ObjectExt::set_property(self, "silent", silent)
1058    }
1059
1060    #[doc(alias = "buffer-list")]
1061    pub fn connect_buffer_list_notify<F: Fn(&Self) + Send + Sync + 'static>(
1062        &self,
1063        f: F,
1064    ) -> SignalHandlerId {
1065        unsafe extern "C" fn notify_buffer_list_trampoline<
1066            F: Fn(&AppSink) + Send + Sync + 'static,
1067        >(
1068            this: *mut ffi::GstAppSink,
1069            _param_spec: glib::ffi::gpointer,
1070            f: glib::ffi::gpointer,
1071        ) {
1072            unsafe {
1073                let f: &F = &*(f as *const F);
1074                f(&from_glib_borrow(this))
1075            }
1076        }
1077        unsafe {
1078            let f: Box_<F> = Box_::new(f);
1079            connect_raw(
1080                self.as_ptr() as *mut _,
1081                c"notify::buffer-list".as_ptr(),
1082                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1083                    notify_buffer_list_trampoline::<F> as *const (),
1084                )),
1085                Box_::into_raw(f),
1086            )
1087        }
1088    }
1089
1090    #[doc(alias = "caps")]
1091    pub fn connect_caps_notify<F: Fn(&Self) + Send + Sync + 'static>(
1092        &self,
1093        f: F,
1094    ) -> SignalHandlerId {
1095        unsafe extern "C" fn notify_caps_trampoline<F: Fn(&AppSink) + Send + Sync + 'static>(
1096            this: *mut ffi::GstAppSink,
1097            _param_spec: glib::ffi::gpointer,
1098            f: glib::ffi::gpointer,
1099        ) {
1100            unsafe {
1101                let f: &F = &*(f as *const F);
1102                f(&from_glib_borrow(this))
1103            }
1104        }
1105        unsafe {
1106            let f: Box_<F> = Box_::new(f);
1107            connect_raw(
1108                self.as_ptr() as *mut _,
1109                c"notify::caps".as_ptr(),
1110                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1111                    notify_caps_trampoline::<F> as *const (),
1112                )),
1113                Box_::into_raw(f),
1114            )
1115        }
1116    }
1117
1118    #[cfg(feature = "v1_28")]
1119    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
1120    #[doc(alias = "current-level-buffers")]
1121    pub fn connect_current_level_buffers_notify<F: Fn(&Self) + Send + Sync + 'static>(
1122        &self,
1123        f: F,
1124    ) -> SignalHandlerId {
1125        unsafe extern "C" fn notify_current_level_buffers_trampoline<
1126            F: Fn(&AppSink) + Send + Sync + 'static,
1127        >(
1128            this: *mut ffi::GstAppSink,
1129            _param_spec: glib::ffi::gpointer,
1130            f: glib::ffi::gpointer,
1131        ) {
1132            unsafe {
1133                let f: &F = &*(f as *const F);
1134                f(&from_glib_borrow(this))
1135            }
1136        }
1137        unsafe {
1138            let f: Box_<F> = Box_::new(f);
1139            connect_raw(
1140                self.as_ptr() as *mut _,
1141                c"notify::current-level-buffers".as_ptr(),
1142                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1143                    notify_current_level_buffers_trampoline::<F> as *const (),
1144                )),
1145                Box_::into_raw(f),
1146            )
1147        }
1148    }
1149
1150    #[cfg(feature = "v1_28")]
1151    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
1152    #[doc(alias = "current-level-bytes")]
1153    pub fn connect_current_level_bytes_notify<F: Fn(&Self) + Send + Sync + 'static>(
1154        &self,
1155        f: F,
1156    ) -> SignalHandlerId {
1157        unsafe extern "C" fn notify_current_level_bytes_trampoline<
1158            F: Fn(&AppSink) + Send + Sync + 'static,
1159        >(
1160            this: *mut ffi::GstAppSink,
1161            _param_spec: glib::ffi::gpointer,
1162            f: glib::ffi::gpointer,
1163        ) {
1164            unsafe {
1165                let f: &F = &*(f as *const F);
1166                f(&from_glib_borrow(this))
1167            }
1168        }
1169        unsafe {
1170            let f: Box_<F> = Box_::new(f);
1171            connect_raw(
1172                self.as_ptr() as *mut _,
1173                c"notify::current-level-bytes".as_ptr(),
1174                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1175                    notify_current_level_bytes_trampoline::<F> as *const (),
1176                )),
1177                Box_::into_raw(f),
1178            )
1179        }
1180    }
1181
1182    #[cfg(feature = "v1_28")]
1183    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
1184    #[doc(alias = "current-level-time")]
1185    pub fn connect_current_level_time_notify<F: Fn(&Self) + Send + Sync + 'static>(
1186        &self,
1187        f: F,
1188    ) -> SignalHandlerId {
1189        unsafe extern "C" fn notify_current_level_time_trampoline<
1190            F: Fn(&AppSink) + Send + Sync + 'static,
1191        >(
1192            this: *mut ffi::GstAppSink,
1193            _param_spec: glib::ffi::gpointer,
1194            f: glib::ffi::gpointer,
1195        ) {
1196            unsafe {
1197                let f: &F = &*(f as *const F);
1198                f(&from_glib_borrow(this))
1199            }
1200        }
1201        unsafe {
1202            let f: Box_<F> = Box_::new(f);
1203            connect_raw(
1204                self.as_ptr() as *mut _,
1205                c"notify::current-level-time".as_ptr(),
1206                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1207                    notify_current_level_time_trampoline::<F> as *const (),
1208                )),
1209                Box_::into_raw(f),
1210            )
1211        }
1212    }
1213
1214    #[cfg_attr(feature = "v1_28", deprecated = "Since 1.28")]
1215    #[doc(alias = "drop")]
1216    pub fn connect_drop_notify<F: Fn(&Self) + Send + Sync + 'static>(
1217        &self,
1218        f: F,
1219    ) -> SignalHandlerId {
1220        unsafe extern "C" fn notify_drop_trampoline<F: Fn(&AppSink) + Send + Sync + 'static>(
1221            this: *mut ffi::GstAppSink,
1222            _param_spec: glib::ffi::gpointer,
1223            f: glib::ffi::gpointer,
1224        ) {
1225            unsafe {
1226                let f: &F = &*(f as *const F);
1227                f(&from_glib_borrow(this))
1228            }
1229        }
1230        unsafe {
1231            let f: Box_<F> = Box_::new(f);
1232            connect_raw(
1233                self.as_ptr() as *mut _,
1234                c"notify::drop".as_ptr(),
1235                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1236                    notify_drop_trampoline::<F> as *const (),
1237                )),
1238                Box_::into_raw(f),
1239            )
1240        }
1241    }
1242
1243    #[cfg(feature = "v1_28")]
1244    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
1245    #[doc(alias = "dropped")]
1246    pub fn connect_dropped_notify<F: Fn(&Self) + Send + Sync + 'static>(
1247        &self,
1248        f: F,
1249    ) -> SignalHandlerId {
1250        unsafe extern "C" fn notify_dropped_trampoline<F: Fn(&AppSink) + Send + Sync + 'static>(
1251            this: *mut ffi::GstAppSink,
1252            _param_spec: glib::ffi::gpointer,
1253            f: glib::ffi::gpointer,
1254        ) {
1255            unsafe {
1256                let f: &F = &*(f as *const F);
1257                f(&from_glib_borrow(this))
1258            }
1259        }
1260        unsafe {
1261            let f: Box_<F> = Box_::new(f);
1262            connect_raw(
1263                self.as_ptr() as *mut _,
1264                c"notify::dropped".as_ptr(),
1265                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1266                    notify_dropped_trampoline::<F> as *const (),
1267                )),
1268                Box_::into_raw(f),
1269            )
1270        }
1271    }
1272
1273    #[doc(alias = "eos")]
1274    pub fn connect_eos_notify<F: Fn(&Self) + Send + Sync + 'static>(
1275        &self,
1276        f: F,
1277    ) -> SignalHandlerId {
1278        unsafe extern "C" fn notify_eos_trampoline<F: Fn(&AppSink) + Send + Sync + 'static>(
1279            this: *mut ffi::GstAppSink,
1280            _param_spec: glib::ffi::gpointer,
1281            f: glib::ffi::gpointer,
1282        ) {
1283            unsafe {
1284                let f: &F = &*(f as *const F);
1285                f(&from_glib_borrow(this))
1286            }
1287        }
1288        unsafe {
1289            let f: Box_<F> = Box_::new(f);
1290            connect_raw(
1291                self.as_ptr() as *mut _,
1292                c"notify::eos".as_ptr(),
1293                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1294                    notify_eos_trampoline::<F> as *const (),
1295                )),
1296                Box_::into_raw(f),
1297            )
1298        }
1299    }
1300
1301    #[cfg(feature = "v1_28")]
1302    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
1303    #[doc(alias = "in")]
1304    pub fn connect_in_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
1305        unsafe extern "C" fn notify_in_trampoline<F: Fn(&AppSink) + Send + Sync + 'static>(
1306            this: *mut ffi::GstAppSink,
1307            _param_spec: glib::ffi::gpointer,
1308            f: glib::ffi::gpointer,
1309        ) {
1310            unsafe {
1311                let f: &F = &*(f as *const F);
1312                f(&from_glib_borrow(this))
1313            }
1314        }
1315        unsafe {
1316            let f: Box_<F> = Box_::new(f);
1317            connect_raw(
1318                self.as_ptr() as *mut _,
1319                c"notify::in".as_ptr(),
1320                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1321                    notify_in_trampoline::<F> as *const (),
1322                )),
1323                Box_::into_raw(f),
1324            )
1325        }
1326    }
1327
1328    #[cfg(feature = "v1_28")]
1329    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
1330    #[doc(alias = "leaky-type")]
1331    pub fn connect_leaky_type_notify<F: Fn(&Self) + Send + Sync + 'static>(
1332        &self,
1333        f: F,
1334    ) -> SignalHandlerId {
1335        unsafe extern "C" fn notify_leaky_type_trampoline<
1336            F: Fn(&AppSink) + Send + Sync + 'static,
1337        >(
1338            this: *mut ffi::GstAppSink,
1339            _param_spec: glib::ffi::gpointer,
1340            f: glib::ffi::gpointer,
1341        ) {
1342            unsafe {
1343                let f: &F = &*(f as *const F);
1344                f(&from_glib_borrow(this))
1345            }
1346        }
1347        unsafe {
1348            let f: Box_<F> = Box_::new(f);
1349            connect_raw(
1350                self.as_ptr() as *mut _,
1351                c"notify::leaky-type".as_ptr(),
1352                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1353                    notify_leaky_type_trampoline::<F> as *const (),
1354                )),
1355                Box_::into_raw(f),
1356            )
1357        }
1358    }
1359
1360    #[doc(alias = "max-buffers")]
1361    pub fn connect_max_buffers_notify<F: Fn(&Self) + Send + Sync + 'static>(
1362        &self,
1363        f: F,
1364    ) -> SignalHandlerId {
1365        unsafe extern "C" fn notify_max_buffers_trampoline<
1366            F: Fn(&AppSink) + Send + Sync + 'static,
1367        >(
1368            this: *mut ffi::GstAppSink,
1369            _param_spec: glib::ffi::gpointer,
1370            f: glib::ffi::gpointer,
1371        ) {
1372            unsafe {
1373                let f: &F = &*(f as *const F);
1374                f(&from_glib_borrow(this))
1375            }
1376        }
1377        unsafe {
1378            let f: Box_<F> = Box_::new(f);
1379            connect_raw(
1380                self.as_ptr() as *mut _,
1381                c"notify::max-buffers".as_ptr(),
1382                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1383                    notify_max_buffers_trampoline::<F> as *const (),
1384                )),
1385                Box_::into_raw(f),
1386            )
1387        }
1388    }
1389
1390    #[cfg(feature = "v1_24")]
1391    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
1392    #[doc(alias = "max-bytes")]
1393    pub fn connect_max_bytes_notify<F: Fn(&Self) + Send + Sync + 'static>(
1394        &self,
1395        f: F,
1396    ) -> SignalHandlerId {
1397        unsafe extern "C" fn notify_max_bytes_trampoline<
1398            F: Fn(&AppSink) + Send + Sync + 'static,
1399        >(
1400            this: *mut ffi::GstAppSink,
1401            _param_spec: glib::ffi::gpointer,
1402            f: glib::ffi::gpointer,
1403        ) {
1404            unsafe {
1405                let f: &F = &*(f as *const F);
1406                f(&from_glib_borrow(this))
1407            }
1408        }
1409        unsafe {
1410            let f: Box_<F> = Box_::new(f);
1411            connect_raw(
1412                self.as_ptr() as *mut _,
1413                c"notify::max-bytes".as_ptr(),
1414                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1415                    notify_max_bytes_trampoline::<F> as *const (),
1416                )),
1417                Box_::into_raw(f),
1418            )
1419        }
1420    }
1421
1422    #[cfg(feature = "v1_24")]
1423    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
1424    #[doc(alias = "max-time")]
1425    pub fn connect_max_time_notify<F: Fn(&Self) + Send + Sync + 'static>(
1426        &self,
1427        f: F,
1428    ) -> SignalHandlerId {
1429        unsafe extern "C" fn notify_max_time_trampoline<F: Fn(&AppSink) + Send + Sync + 'static>(
1430            this: *mut ffi::GstAppSink,
1431            _param_spec: glib::ffi::gpointer,
1432            f: glib::ffi::gpointer,
1433        ) {
1434            unsafe {
1435                let f: &F = &*(f as *const F);
1436                f(&from_glib_borrow(this))
1437            }
1438        }
1439        unsafe {
1440            let f: Box_<F> = Box_::new(f);
1441            connect_raw(
1442                self.as_ptr() as *mut _,
1443                c"notify::max-time".as_ptr(),
1444                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1445                    notify_max_time_trampoline::<F> as *const (),
1446                )),
1447                Box_::into_raw(f),
1448            )
1449        }
1450    }
1451
1452    #[cfg(feature = "v1_28")]
1453    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
1454    #[doc(alias = "out")]
1455    pub fn connect_out_notify<F: Fn(&Self) + Send + Sync + 'static>(
1456        &self,
1457        f: F,
1458    ) -> SignalHandlerId {
1459        unsafe extern "C" fn notify_out_trampoline<F: Fn(&AppSink) + Send + Sync + 'static>(
1460            this: *mut ffi::GstAppSink,
1461            _param_spec: glib::ffi::gpointer,
1462            f: glib::ffi::gpointer,
1463        ) {
1464            unsafe {
1465                let f: &F = &*(f as *const F);
1466                f(&from_glib_borrow(this))
1467            }
1468        }
1469        unsafe {
1470            let f: Box_<F> = Box_::new(f);
1471            connect_raw(
1472                self.as_ptr() as *mut _,
1473                c"notify::out".as_ptr(),
1474                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1475                    notify_out_trampoline::<F> as *const (),
1476                )),
1477                Box_::into_raw(f),
1478            )
1479        }
1480    }
1481
1482    #[cfg(feature = "v1_28")]
1483    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
1484    #[doc(alias = "silent")]
1485    pub fn connect_silent_notify<F: Fn(&Self) + Send + Sync + 'static>(
1486        &self,
1487        f: F,
1488    ) -> SignalHandlerId {
1489        unsafe extern "C" fn notify_silent_trampoline<F: Fn(&AppSink) + Send + Sync + 'static>(
1490            this: *mut ffi::GstAppSink,
1491            _param_spec: glib::ffi::gpointer,
1492            f: glib::ffi::gpointer,
1493        ) {
1494            unsafe {
1495                let f: &F = &*(f as *const F);
1496                f(&from_glib_borrow(this))
1497            }
1498        }
1499        unsafe {
1500            let f: Box_<F> = Box_::new(f);
1501            connect_raw(
1502                self.as_ptr() as *mut _,
1503                c"notify::silent".as_ptr(),
1504                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1505                    notify_silent_trampoline::<F> as *const (),
1506                )),
1507                Box_::into_raw(f),
1508            )
1509        }
1510    }
1511
1512    #[doc(alias = "wait-on-eos")]
1513    pub fn connect_wait_on_eos_notify<F: Fn(&Self) + Send + Sync + 'static>(
1514        &self,
1515        f: F,
1516    ) -> SignalHandlerId {
1517        unsafe extern "C" fn notify_wait_on_eos_trampoline<
1518            F: Fn(&AppSink) + Send + Sync + 'static,
1519        >(
1520            this: *mut ffi::GstAppSink,
1521            _param_spec: glib::ffi::gpointer,
1522            f: glib::ffi::gpointer,
1523        ) {
1524            unsafe {
1525                let f: &F = &*(f as *const F);
1526                f(&from_glib_borrow(this))
1527            }
1528        }
1529        unsafe {
1530            let f: Box_<F> = Box_::new(f);
1531            connect_raw(
1532                self.as_ptr() as *mut _,
1533                c"notify::wait-on-eos".as_ptr(),
1534                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1535                    notify_wait_on_eos_trampoline::<F> as *const (),
1536                )),
1537                Box_::into_raw(f),
1538            )
1539        }
1540    }
1541}
1542
1543unsafe impl Send for AppSink {}
1544unsafe impl Sync for AppSink {}