gstreamer_app/auto/
app_src.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
6#[cfg(feature = "v1_20")]
7#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
8use crate::AppLeakyType;
9use crate::{ffi, AppStreamType};
10use glib::{
11    prelude::*,
12    signal::{connect_raw, SignalHandlerId},
13    translate::*,
14};
15use std::boxed::Box as Box_;
16
17glib::wrapper! {
18    /// The appsrc element can be used by applications to insert data into a
19    /// GStreamer pipeline. Unlike most GStreamer elements, appsrc provides
20    /// external API functions.
21    ///
22    /// appsrc can be used by linking with the libgstapp library to access the
23    /// methods directly or by using the appsrc action signals.
24    ///
25    /// Before operating appsrc, the caps property must be set to fixed caps
26    /// describing the format of the data that will be pushed with appsrc. An
27    /// exception to this is when pushing buffers with unknown caps, in which case no
28    /// caps should be set. This is typically true of file-like sources that push raw
29    /// byte buffers. If you don't want to explicitly set the caps, you can use
30    /// gst_app_src_push_sample. This method gets the caps associated with the
31    /// sample and sets them on the appsrc replacing any previously set caps (if
32    /// different from sample's caps).
33    ///
34    /// The main way of handing data to the appsrc element is by calling the
35    /// [`push_buffer()`][Self::push_buffer()] method or by emitting the push-buffer action signal.
36    /// This will put the buffer onto a queue from which appsrc will read from in its
37    /// streaming thread. It is important to note that data transport will not happen
38    /// from the thread that performed the push-buffer call.
39    ///
40    /// The "max-bytes", "max-buffers" and "max-time" properties control how much
41    /// data can be queued in appsrc before appsrc considers the queue full. A
42    /// filled internal queue will always signal the "enough-data" signal, which
43    /// signals the application that it should stop pushing data into appsrc. The
44    /// "block" property will cause appsrc to block the push-buffer method until
45    /// free data becomes available again.
46    ///
47    /// When the internal queue is running out of data, the "need-data" signal is
48    /// emitted, which signals the application that it should start pushing more data
49    /// into appsrc.
50    ///
51    /// In addition to the "need-data" and "enough-data" signals, appsrc can emit the
52    /// "seek-data" signal when the "stream-mode" property is set to "seekable" or
53    /// "random-access". The signal argument will contain the new desired position in
54    /// the stream expressed in the unit set with the "format" property. After
55    /// receiving the seek-data signal, the application should push-buffers from the
56    /// new position.
57    ///
58    /// These signals allow the application to operate the appsrc in two different
59    /// ways:
60    ///
61    /// The push mode, in which the application repeatedly calls the push-buffer/push-sample
62    /// method with a new buffer/sample. Optionally, the queue size in the appsrc
63    /// can be controlled with the enough-data and need-data signals by respectively
64    /// stopping/starting the push-buffer/push-sample calls. This is a typical
65    /// mode of operation for the stream-type "stream" and "seekable". Use this
66    /// mode when implementing various network protocols or hardware devices.
67    ///
68    /// The pull mode, in which the need-data signal triggers the next push-buffer call.
69    /// This mode is typically used in the "random-access" stream-type. Use this
70    /// mode for file access or other randomly accessible sources. In this mode, a
71    /// buffer of exactly the amount of bytes given by the need-data signal should be
72    /// pushed into appsrc.
73    ///
74    /// In all modes, the size property on appsrc should contain the total stream
75    /// size in bytes. Setting this property is mandatory in the random-access mode.
76    /// For the stream and seekable modes, setting this property is optional but
77    /// recommended.
78    ///
79    /// When the application has finished pushing data into appsrc, it should call
80    /// [`end_of_stream()`][Self::end_of_stream()] or emit the end-of-stream action signal. After
81    /// this call, no more buffers can be pushed into appsrc until a flushing seek
82    /// occurs or the state of the appsrc has gone through READY.
83    ///
84    /// ## Properties
85    ///
86    ///
87    /// #### `block`
88    ///  When max-bytes are queued and after the enough-data signal has been emitted,
89    /// block any further push-buffer calls until the amount of queued bytes drops
90    /// below the max-bytes limit.
91    ///
92    /// Readable | Writeable
93    ///
94    ///
95    /// #### `caps`
96    ///  The GstCaps that will negotiated downstream and will be put
97    /// on outgoing buffers.
98    ///
99    /// Readable | Writeable
100    ///
101    ///
102    /// #### `current-level-buffers`
103    ///  The number of currently queued buffers inside appsrc.
104    ///
105    /// Readable
106    ///
107    ///
108    /// #### `current-level-bytes`
109    ///  The number of currently queued bytes inside appsrc.
110    ///
111    /// Readable
112    ///
113    ///
114    /// #### `current-level-time`
115    ///  The amount of currently queued time inside appsrc.
116    ///
117    /// Readable
118    ///
119    ///
120    /// #### `dropped`
121    ///  Number of buffers that were dropped.
122    ///
123    /// Readable
124    ///
125    ///
126    /// #### `duration`
127    ///  The total duration in nanoseconds of the data stream. If the total duration is known, it
128    /// is recommended to configure it with this property.
129    ///
130    /// Readable | Writeable
131    ///
132    ///
133    /// #### `emit-signals`
134    ///  Make appsrc emit the "need-data", "enough-data" and "seek-data" signals.
135    /// This option is by default enabled for backwards compatibility reasons but
136    /// can disabled when needed because signal emission is expensive.
137    ///
138    /// Readable | Writeable
139    ///
140    ///
141    /// #### `format`
142    ///  The format to use for segment events. When the source is producing
143    /// timestamped buffers this property should be set to GST_FORMAT_TIME.
144    ///
145    /// Readable | Writeable
146    ///
147    ///
148    /// #### `handle-segment-change`
149    ///  When enabled, appsrc will check GstSegment in GstSample which was
150    /// pushed via [`AppSrc::push_sample()`][crate::AppSrc::push_sample()] or "push-sample" signal action.
151    /// If a GstSegment is changed, corresponding segment event will be followed
152    /// by next data flow.
153    ///
154    /// FIXME: currently only GST_FORMAT_TIME format is supported and therefore
155    /// GstAppSrc::format should be time. However, possibly [`AppSrc`][crate::AppSrc] can support
156    /// other formats.
157    ///
158    /// Readable | Writeable
159    ///
160    ///
161    /// #### `in`
162    ///  Number of input buffers that were queued.
163    ///
164    /// Readable
165    ///
166    ///
167    /// #### `is-live`
168    ///  Instruct the source to behave like a live source. This includes that it
169    /// will only push out buffers in the PLAYING state.
170    ///
171    /// Readable | Writeable
172    ///
173    ///
174    /// #### `leaky-type`
175    ///  When set to any other value than GST_APP_LEAKY_TYPE_NONE then the appsrc
176    /// will drop any buffers that are pushed into it once its internal queue is
177    /// full. The selected type defines whether to drop the oldest or new
178    /// buffers.
179    ///
180    /// Readable | Writeable
181    ///
182    ///
183    /// #### `max-buffers`
184    ///  The maximum amount of buffers that can be queued internally.
185    /// After the maximum amount of buffers are queued, appsrc will emit the
186    /// "enough-data" signal.
187    ///
188    /// Readable | Writeable
189    ///
190    ///
191    /// #### `max-bytes`
192    ///  The maximum amount of bytes that can be queued internally.
193    /// After the maximum amount of bytes are queued, appsrc will emit the
194    /// "enough-data" signal.
195    ///
196    /// Readable | Writeable
197    ///
198    ///
199    /// #### `max-latency`
200    ///  Readable | Writeable
201    ///
202    ///
203    /// #### `max-time`
204    ///  The maximum amount of time that can be queued internally.
205    /// After the maximum amount of time are queued, appsrc will emit the
206    /// "enough-data" signal.
207    ///
208    /// Readable | Writeable
209    ///
210    ///
211    /// #### `min-latency`
212    ///  The minimum latency of the source. A value of -1 will use the default
213    /// latency calculations of `GstBaseSrc`.
214    ///
215    /// Readable | Writeable
216    ///
217    ///
218    /// #### `min-percent`
219    ///  Make appsrc emit the "need-data" signal when the amount of bytes in the
220    /// queue drops below this percentage of max-bytes.
221    ///
222    /// Readable | Writeable
223    ///
224    ///
225    /// #### `out`
226    ///  Number of output buffers that were dequeued.
227    ///
228    /// Readable
229    ///
230    ///
231    /// #### `silent`
232    ///  Don't emit notify for input, output and dropped buffers.
233    ///
234    /// Readable | Writeable
235    ///
236    ///
237    /// #### `size`
238    ///  The total size in bytes of the data stream. If the total size is known, it
239    /// is recommended to configure it with this property.
240    ///
241    /// Readable | Writeable
242    ///
243    ///
244    /// #### `stream-type`
245    ///  The type of stream that this source is producing. For seekable streams the
246    /// application should connect to the seek-data signal.
247    ///
248    /// Readable | Writeable
249    /// <details><summary><h4>BaseSrc</h4></summary>
250    ///
251    ///
252    /// #### `automatic-eos`
253    ///  See `gst_base_src_set_automatic_eos()`
254    ///
255    /// Readable | Writeable
256    ///
257    ///
258    /// #### `blocksize`
259    ///  Readable | Writeable
260    ///
261    ///
262    /// #### `do-timestamp`
263    ///  Readable | Writeable
264    ///
265    ///
266    /// #### `num-buffers`
267    ///  Readable | Writeable
268    ///
269    ///
270    /// #### `typefind`
271    ///  Readable | Writeable
272    /// </details>
273    /// <details><summary><h4>Object</h4></summary>
274    ///
275    ///
276    /// #### `name`
277    ///  Readable | Writeable | Construct
278    ///
279    ///
280    /// #### `parent`
281    ///  The parent of the object. Please note, that when changing the 'parent'
282    /// property, we don't emit [`notify`][struct@crate::glib::Object#notify] and [`deep-notify`][struct@crate::gst::Object#deep-notify]
283    /// signals due to locking issues. In some cases one can use
284    /// `GstBin::element-added` or `GstBin::element-removed` signals on the parent to
285    /// achieve a similar effect.
286    ///
287    /// Readable | Writeable
288    /// </details>
289    ///
290    /// ## Signals
291    ///
292    ///
293    /// #### `end-of-stream`
294    ///  Notify `appsrc` that no more buffer are available.
295    ///
296    /// Action
297    ///
298    ///
299    /// #### `enough-data`
300    ///  Signal that the source has enough data. It is recommended that the
301    /// application stops calling push-buffer until the need-data signal is
302    /// emitted again to avoid excessive buffer queueing.
303    ///
304    ///
305    ///
306    ///
307    /// #### `need-data`
308    ///  Signal that the source needs more data. In the callback or from another
309    /// thread you should call push-buffer or end-of-stream.
310    ///
311    /// `length` is just a hint and when it is set to -1, any number of bytes can be
312    /// pushed into `appsrc`.
313    ///
314    /// You can call push-buffer multiple times until the enough-data signal is
315    /// fired.
316    ///
317    ///
318    ///
319    ///
320    /// #### `push-buffer`
321    ///  Adds a buffer to the queue of buffers that the appsrc element will
322    /// push to its source pad.
323    ///
324    /// This function does not take ownership of the buffer, but it takes a
325    /// reference so the buffer can be unreffed at any time after calling this
326    /// function.
327    ///
328    /// When the block property is TRUE, this function can block until free space
329    /// becomes available in the queue.
330    ///
331    /// Action
332    ///
333    ///
334    /// #### `push-buffer-list`
335    ///  Adds a buffer list to the queue of buffers and buffer lists that the
336    /// appsrc element will push to its source pad.
337    ///
338    /// This function does not take ownership of the buffer list, but it takes a
339    /// reference so the buffer list can be unreffed at any time after calling
340    /// this function.
341    ///
342    /// When the block property is TRUE, this function can block until free space
343    /// becomes available in the queue.
344    ///
345    /// Action
346    ///
347    ///
348    /// #### `push-sample`
349    ///  Extract a buffer from the provided sample and adds the extracted buffer
350    /// to the queue of buffers that the appsrc element will
351    /// push to its source pad. This function set the appsrc caps based on the caps
352    /// in the sample and reset the caps if they change.
353    /// Only the caps and the buffer of the provided sample are used and not
354    /// for example the segment in the sample.
355    ///
356    /// This function does not take ownership of the sample, but it takes a
357    /// reference so the sample can be unreffed at any time after calling this
358    /// function.
359    ///
360    /// When the block property is TRUE, this function can block until free space
361    /// becomes available in the queue.
362    ///
363    /// Action
364    ///
365    ///
366    /// #### `seek-data`
367    ///  Seek to the given offset. The next push-buffer should produce buffers from
368    /// the new `offset`.
369    /// This callback is only called for seekable stream types.
370    ///
371    ///
372    /// <details><summary><h4>Element</h4></summary>
373    ///
374    ///
375    /// #### `no-more-pads`
376    ///  This signals that the element will not generate more dynamic pads.
377    /// Note that this signal will usually be emitted from the context of
378    /// the streaming thread.
379    ///
380    ///
381    ///
382    ///
383    /// #### `pad-added`
384    ///  a new `GstPad` has been added to the element. Note that this signal will
385    /// usually be emitted from the context of the streaming thread. Also keep in
386    /// mind that if you add new elements to the pipeline in the signal handler
387    /// you will need to set them to the desired target state with
388    /// [`ElementExtManual::set_state()`][crate::gst::prelude::ElementExtManual::set_state()] or [`ElementExtManual::sync_state_with_parent()`][crate::gst::prelude::ElementExtManual::sync_state_with_parent()].
389    ///
390    ///
391    ///
392    ///
393    /// #### `pad-removed`
394    ///  a `GstPad` has been removed from the element
395    ///
396    ///
397    /// </details>
398    /// <details><summary><h4>Object</h4></summary>
399    ///
400    ///
401    /// #### `deep-notify`
402    ///  The deep notify signal is used to be notified of property changes. It is
403    /// typically attached to the toplevel bin to receive notifications from all
404    /// the elements contained in that bin.
405    ///
406    /// Detailed
407    /// </details>
408    ///
409    /// # Implements
410    ///
411    /// [`trait@gst::prelude::ElementExt`], [`trait@gst::prelude::ObjectExt`], [`trait@glib::ObjectExt`], [`trait@gst::prelude::URIHandlerExt`]
412    #[doc(alias = "GstAppSrc")]
413    pub struct AppSrc(Object<ffi::GstAppSrc, ffi::GstAppSrcClass>) @extends gst::Element, gst::Object, @implements gst::URIHandler;
414
415    match fn {
416        type_ => || ffi::gst_app_src_get_type(),
417    }
418}
419
420impl AppSrc {
421    /// Indicates to the appsrc element that the last buffer queued in the
422    /// element is the last buffer of the stream.
423    ///
424    /// # Returns
425    ///
426    /// [`gst::FlowReturn::Ok`][crate::gst::FlowReturn::Ok] when the EOS was successfully queued.
427    /// [`gst::FlowReturn::Flushing`][crate::gst::FlowReturn::Flushing] when `self` is not PAUSED or PLAYING.
428    #[doc(alias = "gst_app_src_end_of_stream")]
429    pub fn end_of_stream(&self) -> Result<gst::FlowSuccess, gst::FlowError> {
430        unsafe { try_from_glib(ffi::gst_app_src_end_of_stream(self.to_glib_none().0)) }
431    }
432
433    /// Get the configured caps on `self`.
434    ///
435    /// # Returns
436    ///
437    /// the [`gst::Caps`][crate::gst::Caps] produced by the source. `gst_caps_unref()` after usage.
438    #[doc(alias = "gst_app_src_get_caps")]
439    #[doc(alias = "get_caps")]
440    pub fn caps(&self) -> Option<gst::Caps> {
441        unsafe { from_glib_full(ffi::gst_app_src_get_caps(self.to_glib_none().0)) }
442    }
443
444    /// Get the number of currently queued buffers inside `self`.
445    ///
446    /// # Returns
447    ///
448    /// The number of currently queued buffers.
449    #[cfg(feature = "v1_20")]
450    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
451    #[doc(alias = "gst_app_src_get_current_level_buffers")]
452    #[doc(alias = "get_current_level_buffers")]
453    #[doc(alias = "current-level-buffers")]
454    pub fn current_level_buffers(&self) -> u64 {
455        unsafe { ffi::gst_app_src_get_current_level_buffers(self.to_glib_none().0) }
456    }
457
458    /// Get the number of currently queued bytes inside `self`.
459    ///
460    /// # Returns
461    ///
462    /// The number of currently queued bytes.
463    #[doc(alias = "gst_app_src_get_current_level_bytes")]
464    #[doc(alias = "get_current_level_bytes")]
465    #[doc(alias = "current-level-bytes")]
466    pub fn current_level_bytes(&self) -> u64 {
467        unsafe { ffi::gst_app_src_get_current_level_bytes(self.to_glib_none().0) }
468    }
469
470    /// Get the amount of currently queued time inside `self`.
471    ///
472    /// # Returns
473    ///
474    /// The amount of currently queued time.
475    #[cfg(feature = "v1_20")]
476    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
477    #[doc(alias = "gst_app_src_get_current_level_time")]
478    #[doc(alias = "get_current_level_time")]
479    #[doc(alias = "current-level-time")]
480    pub fn current_level_time(&self) -> gst::ClockTime {
481        unsafe {
482            try_from_glib(ffi::gst_app_src_get_current_level_time(
483                self.to_glib_none().0,
484            ))
485            .expect("mandatory glib value is None")
486        }
487    }
488
489    /// Get the duration of the stream in nanoseconds. A value of GST_CLOCK_TIME_NONE means that the duration is
490    /// not known.
491    ///
492    /// # Returns
493    ///
494    /// the duration of the stream previously set with [`set_duration()`][Self::set_duration()];
495    #[doc(alias = "gst_app_src_get_duration")]
496    #[doc(alias = "get_duration")]
497    pub fn duration(&self) -> Option<gst::ClockTime> {
498        unsafe { from_glib(ffi::gst_app_src_get_duration(self.to_glib_none().0)) }
499    }
500
501    /// Returns the currently set [`AppLeakyType`][crate::AppLeakyType]. See [`set_leaky_type()`][Self::set_leaky_type()]
502    /// for more details.
503    ///
504    /// # Returns
505    ///
506    /// The currently set [`AppLeakyType`][crate::AppLeakyType].
507    #[cfg(feature = "v1_20")]
508    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
509    #[doc(alias = "gst_app_src_get_leaky_type")]
510    #[doc(alias = "get_leaky_type")]
511    #[doc(alias = "leaky-type")]
512    pub fn leaky_type(&self) -> AppLeakyType {
513        unsafe { from_glib(ffi::gst_app_src_get_leaky_type(self.to_glib_none().0)) }
514    }
515
516    /// Get the maximum amount of buffers that can be queued in `self`.
517    ///
518    /// # Returns
519    ///
520    /// The maximum amount of buffers that can be queued.
521    #[cfg(feature = "v1_20")]
522    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
523    #[doc(alias = "gst_app_src_get_max_buffers")]
524    #[doc(alias = "get_max_buffers")]
525    #[doc(alias = "max-buffers")]
526    pub fn max_buffers(&self) -> u64 {
527        unsafe { ffi::gst_app_src_get_max_buffers(self.to_glib_none().0) }
528    }
529
530    /// Get the maximum amount of bytes that can be queued in `self`.
531    ///
532    /// # Returns
533    ///
534    /// The maximum amount of bytes that can be queued.
535    #[doc(alias = "gst_app_src_get_max_bytes")]
536    #[doc(alias = "get_max_bytes")]
537    #[doc(alias = "max-bytes")]
538    pub fn max_bytes(&self) -> u64 {
539        unsafe { ffi::gst_app_src_get_max_bytes(self.to_glib_none().0) }
540    }
541
542    /// Get the maximum amount of time that can be queued in `self`.
543    ///
544    /// # Returns
545    ///
546    /// The maximum amount of time that can be queued.
547    #[cfg(feature = "v1_20")]
548    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
549    #[doc(alias = "gst_app_src_get_max_time")]
550    #[doc(alias = "get_max_time")]
551    #[doc(alias = "max-time")]
552    pub fn max_time(&self) -> gst::ClockTime {
553        unsafe {
554            try_from_glib(ffi::gst_app_src_get_max_time(self.to_glib_none().0))
555                .expect("mandatory glib value is None")
556        }
557    }
558
559    /// Get the size of the stream in bytes. A value of -1 means that the size is
560    /// not known.
561    ///
562    /// # Returns
563    ///
564    /// the size of the stream previously set with [`set_size()`][Self::set_size()];
565    #[doc(alias = "gst_app_src_get_size")]
566    #[doc(alias = "get_size")]
567    pub fn size(&self) -> i64 {
568        unsafe { ffi::gst_app_src_get_size(self.to_glib_none().0) }
569    }
570
571    /// Get the stream type. Control the stream type of `self`
572    /// with [`set_stream_type()`][Self::set_stream_type()].
573    ///
574    /// # Returns
575    ///
576    /// the stream type.
577    #[doc(alias = "gst_app_src_get_stream_type")]
578    #[doc(alias = "get_stream_type")]
579    #[doc(alias = "stream-type")]
580    pub fn stream_type(&self) -> AppStreamType {
581        unsafe { from_glib(ffi::gst_app_src_get_stream_type(self.to_glib_none().0)) }
582    }
583
584    /// Adds a buffer to the queue of buffers that the appsrc element will
585    /// push to its source pad. This function takes ownership of the buffer.
586    ///
587    /// When the block property is TRUE, this function can block until free
588    /// space becomes available in the queue.
589    /// ## `buffer`
590    /// a [`gst::Buffer`][crate::gst::Buffer] to push
591    ///
592    /// # Returns
593    ///
594    /// [`gst::FlowReturn::Ok`][crate::gst::FlowReturn::Ok] when the buffer was successfully queued.
595    /// [`gst::FlowReturn::Flushing`][crate::gst::FlowReturn::Flushing] when `self` is not PAUSED or PLAYING.
596    /// [`gst::FlowReturn::Eos`][crate::gst::FlowReturn::Eos] when EOS occurred.
597    #[doc(alias = "gst_app_src_push_buffer")]
598    pub fn push_buffer(&self, buffer: gst::Buffer) -> Result<gst::FlowSuccess, gst::FlowError> {
599        unsafe {
600            try_from_glib(ffi::gst_app_src_push_buffer(
601                self.to_glib_none().0,
602                buffer.into_glib_ptr(),
603            ))
604        }
605    }
606
607    /// Adds a buffer list to the queue of buffers and buffer lists that the
608    /// appsrc element will push to its source pad. This function takes ownership
609    /// of `buffer_list`.
610    ///
611    /// When the block property is TRUE, this function can block until free
612    /// space becomes available in the queue.
613    /// ## `buffer_list`
614    /// a [`gst::BufferList`][crate::gst::BufferList] to push
615    ///
616    /// # Returns
617    ///
618    /// [`gst::FlowReturn::Ok`][crate::gst::FlowReturn::Ok] when the buffer list was successfully queued.
619    /// [`gst::FlowReturn::Flushing`][crate::gst::FlowReturn::Flushing] when `self` is not PAUSED or PLAYING.
620    /// [`gst::FlowReturn::Eos`][crate::gst::FlowReturn::Eos] when EOS occurred.
621    #[doc(alias = "gst_app_src_push_buffer_list")]
622    pub fn push_buffer_list(
623        &self,
624        buffer_list: gst::BufferList,
625    ) -> Result<gst::FlowSuccess, gst::FlowError> {
626        unsafe {
627            try_from_glib(ffi::gst_app_src_push_buffer_list(
628                self.to_glib_none().0,
629                buffer_list.into_glib_ptr(),
630            ))
631        }
632    }
633
634    /// Extract a buffer from the provided sample and adds it to the queue of
635    /// buffers that the appsrc element will push to its source pad. Any
636    /// previous caps that were set on appsrc will be replaced by the caps
637    /// associated with the sample if not equal.
638    ///
639    /// This function does not take ownership of the
640    /// sample so the sample needs to be unreffed after calling this function.
641    ///
642    /// When the block property is TRUE, this function can block until free
643    /// space becomes available in the queue.
644    /// ## `sample`
645    /// a [`gst::Sample`][crate::gst::Sample] from which buffer and caps may be
646    /// extracted
647    ///
648    /// # Returns
649    ///
650    /// [`gst::FlowReturn::Ok`][crate::gst::FlowReturn::Ok] when the buffer was successfully queued.
651    /// [`gst::FlowReturn::Flushing`][crate::gst::FlowReturn::Flushing] when `self` is not PAUSED or PLAYING.
652    /// [`gst::FlowReturn::Eos`][crate::gst::FlowReturn::Eos] when EOS occurred.
653    #[doc(alias = "gst_app_src_push_sample")]
654    pub fn push_sample(&self, sample: &gst::Sample) -> Result<gst::FlowSuccess, gst::FlowError> {
655        unsafe {
656            try_from_glib(ffi::gst_app_src_push_sample(
657                self.to_glib_none().0,
658                sample.to_glib_none().0,
659            ))
660        }
661    }
662
663    //#[doc(alias = "gst_app_src_set_callbacks")]
664    //pub fn set_callbacks(&self, callbacks: /*Ignored*/&mut AppSrcCallbacks, user_data: /*Unimplemented*/Option<Basic: Pointer>) {
665    //    unsafe { TODO: call ffi:gst_app_src_set_callbacks() }
666    //}
667
668    /// Set the capabilities on the appsrc element. This function takes
669    /// a copy of the caps structure. After calling this method, the source will
670    /// only produce caps that match `caps`. `caps` must be fixed and the caps on the
671    /// buffers must match the caps or left NULL.
672    /// ## `caps`
673    /// caps to set
674    #[doc(alias = "gst_app_src_set_caps")]
675    #[doc(alias = "caps")]
676    pub fn set_caps(&self, caps: Option<&gst::Caps>) {
677        unsafe {
678            ffi::gst_app_src_set_caps(self.to_glib_none().0, caps.to_glib_none().0);
679        }
680    }
681
682    /// Set the duration of the stream in nanoseconds. A value of GST_CLOCK_TIME_NONE means that the duration is
683    /// not known.
684    /// ## `duration`
685    /// the duration to set
686    #[doc(alias = "gst_app_src_set_duration")]
687    #[doc(alias = "duration")]
688    pub fn set_duration(&self, duration: impl Into<Option<gst::ClockTime>>) {
689        unsafe {
690            ffi::gst_app_src_set_duration(self.to_glib_none().0, duration.into().into_glib());
691        }
692    }
693
694    /// When set to any other value than GST_APP_LEAKY_TYPE_NONE then the appsrc
695    /// will drop any buffers that are pushed into it once its internal queue is
696    /// full. The selected type defines whether to drop the oldest or new
697    /// buffers.
698    /// ## `leaky`
699    /// the [`AppLeakyType`][crate::AppLeakyType]
700    #[cfg(feature = "v1_20")]
701    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
702    #[doc(alias = "gst_app_src_set_leaky_type")]
703    #[doc(alias = "leaky-type")]
704    pub fn set_leaky_type(&self, leaky: AppLeakyType) {
705        unsafe {
706            ffi::gst_app_src_set_leaky_type(self.to_glib_none().0, leaky.into_glib());
707        }
708    }
709
710    /// Set the maximum amount of buffers that can be queued in `self`.
711    /// After the maximum amount of buffers are queued, `self` will emit the
712    /// "enough-data" signal.
713    /// ## `max`
714    /// the maximum number of buffers to queue
715    #[cfg(feature = "v1_20")]
716    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
717    #[doc(alias = "gst_app_src_set_max_buffers")]
718    #[doc(alias = "max-buffers")]
719    pub fn set_max_buffers(&self, max: u64) {
720        unsafe {
721            ffi::gst_app_src_set_max_buffers(self.to_glib_none().0, max);
722        }
723    }
724
725    /// Set the maximum amount of bytes that can be queued in `self`.
726    /// After the maximum amount of bytes are queued, `self` will emit the
727    /// "enough-data" signal.
728    /// ## `max`
729    /// the maximum number of bytes to queue
730    #[doc(alias = "gst_app_src_set_max_bytes")]
731    #[doc(alias = "max-bytes")]
732    pub fn set_max_bytes(&self, max: u64) {
733        unsafe {
734            ffi::gst_app_src_set_max_bytes(self.to_glib_none().0, max);
735        }
736    }
737
738    /// Set the maximum amount of time that can be queued in `self`.
739    /// After the maximum amount of time are queued, `self` will emit the
740    /// "enough-data" signal.
741    /// ## `max`
742    /// the maximum amonut of time to queue
743    #[cfg(feature = "v1_20")]
744    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
745    #[doc(alias = "gst_app_src_set_max_time")]
746    #[doc(alias = "max-time")]
747    pub fn set_max_time(&self, max: gst::ClockTime) {
748        unsafe {
749            ffi::gst_app_src_set_max_time(self.to_glib_none().0, max.into_glib());
750        }
751    }
752
753    /// Set the size of the stream in bytes. A value of -1 means that the size is
754    /// not known.
755    /// ## `size`
756    /// the size to set
757    #[doc(alias = "gst_app_src_set_size")]
758    #[doc(alias = "size")]
759    pub fn set_size(&self, size: i64) {
760        unsafe {
761            ffi::gst_app_src_set_size(self.to_glib_none().0, size);
762        }
763    }
764
765    /// Set the stream type on `self`. For seekable streams, the "seek" signal must
766    /// be connected to.
767    ///
768    /// A stream_type stream
769    /// ## `type_`
770    /// the new state
771    #[doc(alias = "gst_app_src_set_stream_type")]
772    #[doc(alias = "stream-type")]
773    pub fn set_stream_type(&self, type_: AppStreamType) {
774        unsafe {
775            ffi::gst_app_src_set_stream_type(self.to_glib_none().0, type_.into_glib());
776        }
777    }
778
779    /// When max-bytes are queued and after the enough-data signal has been emitted,
780    /// block any further push-buffer calls until the amount of queued bytes drops
781    /// below the max-bytes limit.
782    pub fn is_block(&self) -> bool {
783        ObjectExt::property(self, "block")
784    }
785
786    /// When max-bytes are queued and after the enough-data signal has been emitted,
787    /// block any further push-buffer calls until the amount of queued bytes drops
788    /// below the max-bytes limit.
789    pub fn set_block(&self, block: bool) {
790        ObjectExt::set_property(self, "block", block)
791    }
792
793    /// Number of buffers that were dropped.
794    #[cfg(feature = "v1_28")]
795    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
796    pub fn dropped(&self) -> u64 {
797        ObjectExt::property(self, "dropped")
798    }
799
800    /// The format to use for segment events. When the source is producing
801    /// timestamped buffers this property should be set to GST_FORMAT_TIME.
802    pub fn format(&self) -> gst::Format {
803        ObjectExt::property(self, "format")
804    }
805
806    /// The format to use for segment events. When the source is producing
807    /// timestamped buffers this property should be set to GST_FORMAT_TIME.
808    pub fn set_format(&self, format: gst::Format) {
809        ObjectExt::set_property(self, "format", format)
810    }
811
812    /// When enabled, appsrc will check GstSegment in GstSample which was
813    /// pushed via [`push_sample()`][Self::push_sample()] or "push-sample" signal action.
814    /// If a GstSegment is changed, corresponding segment event will be followed
815    /// by next data flow.
816    ///
817    /// FIXME: currently only GST_FORMAT_TIME format is supported and therefore
818    /// GstAppSrc::format should be time. However, possibly [`AppSrc`][crate::AppSrc] can support
819    /// other formats.
820    #[cfg(feature = "v1_18")]
821    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
822    #[doc(alias = "handle-segment-change")]
823    pub fn is_handle_segment_change(&self) -> bool {
824        ObjectExt::property(self, "handle-segment-change")
825    }
826
827    /// When enabled, appsrc will check GstSegment in GstSample which was
828    /// pushed via [`push_sample()`][Self::push_sample()] or "push-sample" signal action.
829    /// If a GstSegment is changed, corresponding segment event will be followed
830    /// by next data flow.
831    ///
832    /// FIXME: currently only GST_FORMAT_TIME format is supported and therefore
833    /// GstAppSrc::format should be time. However, possibly [`AppSrc`][crate::AppSrc] can support
834    /// other formats.
835    #[cfg(feature = "v1_18")]
836    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
837    #[doc(alias = "handle-segment-change")]
838    pub fn set_handle_segment_change(&self, handle_segment_change: bool) {
839        ObjectExt::set_property(self, "handle-segment-change", handle_segment_change)
840    }
841
842    /// Number of input buffers that were queued.
843    #[cfg(feature = "v1_28")]
844    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
845    #[doc(alias = "in")]
846    pub fn get_in(&self) -> u64 {
847        ObjectExt::property(self, "in")
848    }
849
850    /// Instruct the source to behave like a live source. This includes that it
851    /// will only push out buffers in the PLAYING state.
852    #[doc(alias = "is-live")]
853    pub fn is_live(&self) -> bool {
854        ObjectExt::property(self, "is-live")
855    }
856
857    /// Instruct the source to behave like a live source. This includes that it
858    /// will only push out buffers in the PLAYING state.
859    #[doc(alias = "is-live")]
860    pub fn set_is_live(&self, is_live: bool) {
861        ObjectExt::set_property(self, "is-live", is_live)
862    }
863
864    #[doc(alias = "max-latency")]
865    pub fn max_latency(&self) -> i64 {
866        ObjectExt::property(self, "max-latency")
867    }
868
869    #[doc(alias = "max-latency")]
870    pub fn set_max_latency(&self, max_latency: i64) {
871        ObjectExt::set_property(self, "max-latency", max_latency)
872    }
873
874    /// The minimum latency of the source. A value of -1 will use the default
875    /// latency calculations of `GstBaseSrc`.
876    #[doc(alias = "min-latency")]
877    pub fn min_latency(&self) -> i64 {
878        ObjectExt::property(self, "min-latency")
879    }
880
881    /// The minimum latency of the source. A value of -1 will use the default
882    /// latency calculations of `GstBaseSrc`.
883    #[doc(alias = "min-latency")]
884    pub fn set_min_latency(&self, min_latency: i64) {
885        ObjectExt::set_property(self, "min-latency", min_latency)
886    }
887
888    /// Make appsrc emit the "need-data" signal when the amount of bytes in the
889    /// queue drops below this percentage of max-bytes.
890    #[doc(alias = "min-percent")]
891    pub fn min_percent(&self) -> u32 {
892        ObjectExt::property(self, "min-percent")
893    }
894
895    /// Make appsrc emit the "need-data" signal when the amount of bytes in the
896    /// queue drops below this percentage of max-bytes.
897    #[doc(alias = "min-percent")]
898    pub fn set_min_percent(&self, min_percent: u32) {
899        ObjectExt::set_property(self, "min-percent", min_percent)
900    }
901
902    /// Number of output buffers that were dequeued.
903    #[cfg(feature = "v1_28")]
904    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
905    pub fn out(&self) -> u64 {
906        ObjectExt::property(self, "out")
907    }
908
909    /// Don't emit notify for input, output and dropped buffers.
910    #[cfg(feature = "v1_28")]
911    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
912    pub fn is_silent(&self) -> bool {
913        ObjectExt::property(self, "silent")
914    }
915
916    /// Don't emit notify for input, output and dropped buffers.
917    #[cfg(feature = "v1_28")]
918    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
919    pub fn set_silent(&self, silent: bool) {
920        ObjectExt::set_property(self, "silent", silent)
921    }
922
923    #[doc(alias = "block")]
924    pub fn connect_block_notify<F: Fn(&Self) + Send + Sync + 'static>(
925        &self,
926        f: F,
927    ) -> SignalHandlerId {
928        unsafe extern "C" fn notify_block_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
929            this: *mut ffi::GstAppSrc,
930            _param_spec: glib::ffi::gpointer,
931            f: glib::ffi::gpointer,
932        ) {
933            let f: &F = &*(f as *const F);
934            f(&from_glib_borrow(this))
935        }
936        unsafe {
937            let f: Box_<F> = Box_::new(f);
938            connect_raw(
939                self.as_ptr() as *mut _,
940                c"notify::block".as_ptr() as *const _,
941                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
942                    notify_block_trampoline::<F> as *const (),
943                )),
944                Box_::into_raw(f),
945            )
946        }
947    }
948
949    #[doc(alias = "caps")]
950    pub fn connect_caps_notify<F: Fn(&Self) + Send + Sync + 'static>(
951        &self,
952        f: F,
953    ) -> SignalHandlerId {
954        unsafe extern "C" fn notify_caps_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
955            this: *mut ffi::GstAppSrc,
956            _param_spec: glib::ffi::gpointer,
957            f: glib::ffi::gpointer,
958        ) {
959            let f: &F = &*(f as *const F);
960            f(&from_glib_borrow(this))
961        }
962        unsafe {
963            let f: Box_<F> = Box_::new(f);
964            connect_raw(
965                self.as_ptr() as *mut _,
966                c"notify::caps".as_ptr() as *const _,
967                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
968                    notify_caps_trampoline::<F> as *const (),
969                )),
970                Box_::into_raw(f),
971            )
972        }
973    }
974
975    #[cfg(feature = "v1_20")]
976    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
977    #[doc(alias = "current-level-buffers")]
978    pub fn connect_current_level_buffers_notify<F: Fn(&Self) + Send + Sync + 'static>(
979        &self,
980        f: F,
981    ) -> SignalHandlerId {
982        unsafe extern "C" fn notify_current_level_buffers_trampoline<
983            F: Fn(&AppSrc) + Send + Sync + 'static,
984        >(
985            this: *mut ffi::GstAppSrc,
986            _param_spec: glib::ffi::gpointer,
987            f: glib::ffi::gpointer,
988        ) {
989            let f: &F = &*(f as *const F);
990            f(&from_glib_borrow(this))
991        }
992        unsafe {
993            let f: Box_<F> = Box_::new(f);
994            connect_raw(
995                self.as_ptr() as *mut _,
996                c"notify::current-level-buffers".as_ptr() as *const _,
997                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
998                    notify_current_level_buffers_trampoline::<F> as *const (),
999                )),
1000                Box_::into_raw(f),
1001            )
1002        }
1003    }
1004
1005    #[doc(alias = "current-level-bytes")]
1006    pub fn connect_current_level_bytes_notify<F: Fn(&Self) + Send + Sync + 'static>(
1007        &self,
1008        f: F,
1009    ) -> SignalHandlerId {
1010        unsafe extern "C" fn notify_current_level_bytes_trampoline<
1011            F: Fn(&AppSrc) + Send + Sync + 'static,
1012        >(
1013            this: *mut ffi::GstAppSrc,
1014            _param_spec: glib::ffi::gpointer,
1015            f: glib::ffi::gpointer,
1016        ) {
1017            let f: &F = &*(f as *const F);
1018            f(&from_glib_borrow(this))
1019        }
1020        unsafe {
1021            let f: Box_<F> = Box_::new(f);
1022            connect_raw(
1023                self.as_ptr() as *mut _,
1024                c"notify::current-level-bytes".as_ptr() as *const _,
1025                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1026                    notify_current_level_bytes_trampoline::<F> as *const (),
1027                )),
1028                Box_::into_raw(f),
1029            )
1030        }
1031    }
1032
1033    #[cfg(feature = "v1_20")]
1034    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
1035    #[doc(alias = "current-level-time")]
1036    pub fn connect_current_level_time_notify<F: Fn(&Self) + Send + Sync + 'static>(
1037        &self,
1038        f: F,
1039    ) -> SignalHandlerId {
1040        unsafe extern "C" fn notify_current_level_time_trampoline<
1041            F: Fn(&AppSrc) + Send + Sync + 'static,
1042        >(
1043            this: *mut ffi::GstAppSrc,
1044            _param_spec: glib::ffi::gpointer,
1045            f: glib::ffi::gpointer,
1046        ) {
1047            let f: &F = &*(f as *const F);
1048            f(&from_glib_borrow(this))
1049        }
1050        unsafe {
1051            let f: Box_<F> = Box_::new(f);
1052            connect_raw(
1053                self.as_ptr() as *mut _,
1054                c"notify::current-level-time".as_ptr() as *const _,
1055                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1056                    notify_current_level_time_trampoline::<F> as *const (),
1057                )),
1058                Box_::into_raw(f),
1059            )
1060        }
1061    }
1062
1063    #[cfg(feature = "v1_28")]
1064    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
1065    #[doc(alias = "dropped")]
1066    pub fn connect_dropped_notify<F: Fn(&Self) + Send + Sync + 'static>(
1067        &self,
1068        f: F,
1069    ) -> SignalHandlerId {
1070        unsafe extern "C" fn notify_dropped_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
1071            this: *mut ffi::GstAppSrc,
1072            _param_spec: glib::ffi::gpointer,
1073            f: glib::ffi::gpointer,
1074        ) {
1075            let f: &F = &*(f as *const F);
1076            f(&from_glib_borrow(this))
1077        }
1078        unsafe {
1079            let f: Box_<F> = Box_::new(f);
1080            connect_raw(
1081                self.as_ptr() as *mut _,
1082                c"notify::dropped".as_ptr() as *const _,
1083                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1084                    notify_dropped_trampoline::<F> as *const (),
1085                )),
1086                Box_::into_raw(f),
1087            )
1088        }
1089    }
1090
1091    #[doc(alias = "duration")]
1092    pub fn connect_duration_notify<F: Fn(&Self) + Send + Sync + 'static>(
1093        &self,
1094        f: F,
1095    ) -> SignalHandlerId {
1096        unsafe extern "C" fn notify_duration_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
1097            this: *mut ffi::GstAppSrc,
1098            _param_spec: glib::ffi::gpointer,
1099            f: glib::ffi::gpointer,
1100        ) {
1101            let f: &F = &*(f as *const F);
1102            f(&from_glib_borrow(this))
1103        }
1104        unsafe {
1105            let f: Box_<F> = Box_::new(f);
1106            connect_raw(
1107                self.as_ptr() as *mut _,
1108                c"notify::duration".as_ptr() as *const _,
1109                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1110                    notify_duration_trampoline::<F> as *const (),
1111                )),
1112                Box_::into_raw(f),
1113            )
1114        }
1115    }
1116
1117    #[doc(alias = "format")]
1118    pub fn connect_format_notify<F: Fn(&Self) + Send + Sync + 'static>(
1119        &self,
1120        f: F,
1121    ) -> SignalHandlerId {
1122        unsafe extern "C" fn notify_format_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
1123            this: *mut ffi::GstAppSrc,
1124            _param_spec: glib::ffi::gpointer,
1125            f: glib::ffi::gpointer,
1126        ) {
1127            let f: &F = &*(f as *const F);
1128            f(&from_glib_borrow(this))
1129        }
1130        unsafe {
1131            let f: Box_<F> = Box_::new(f);
1132            connect_raw(
1133                self.as_ptr() as *mut _,
1134                c"notify::format".as_ptr() as *const _,
1135                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1136                    notify_format_trampoline::<F> as *const (),
1137                )),
1138                Box_::into_raw(f),
1139            )
1140        }
1141    }
1142
1143    #[cfg(feature = "v1_18")]
1144    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
1145    #[doc(alias = "handle-segment-change")]
1146    pub fn connect_handle_segment_change_notify<F: Fn(&Self) + Send + Sync + 'static>(
1147        &self,
1148        f: F,
1149    ) -> SignalHandlerId {
1150        unsafe extern "C" fn notify_handle_segment_change_trampoline<
1151            F: Fn(&AppSrc) + Send + Sync + 'static,
1152        >(
1153            this: *mut ffi::GstAppSrc,
1154            _param_spec: glib::ffi::gpointer,
1155            f: glib::ffi::gpointer,
1156        ) {
1157            let f: &F = &*(f as *const F);
1158            f(&from_glib_borrow(this))
1159        }
1160        unsafe {
1161            let f: Box_<F> = Box_::new(f);
1162            connect_raw(
1163                self.as_ptr() as *mut _,
1164                c"notify::handle-segment-change".as_ptr() as *const _,
1165                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1166                    notify_handle_segment_change_trampoline::<F> as *const (),
1167                )),
1168                Box_::into_raw(f),
1169            )
1170        }
1171    }
1172
1173    #[cfg(feature = "v1_28")]
1174    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
1175    #[doc(alias = "in")]
1176    pub fn connect_in_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
1177        unsafe extern "C" fn notify_in_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
1178            this: *mut ffi::GstAppSrc,
1179            _param_spec: glib::ffi::gpointer,
1180            f: glib::ffi::gpointer,
1181        ) {
1182            let f: &F = &*(f as *const F);
1183            f(&from_glib_borrow(this))
1184        }
1185        unsafe {
1186            let f: Box_<F> = Box_::new(f);
1187            connect_raw(
1188                self.as_ptr() as *mut _,
1189                c"notify::in".as_ptr() as *const _,
1190                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1191                    notify_in_trampoline::<F> as *const (),
1192                )),
1193                Box_::into_raw(f),
1194            )
1195        }
1196    }
1197
1198    #[doc(alias = "is-live")]
1199    pub fn connect_is_live_notify<F: Fn(&Self) + Send + Sync + 'static>(
1200        &self,
1201        f: F,
1202    ) -> SignalHandlerId {
1203        unsafe extern "C" fn notify_is_live_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
1204            this: *mut ffi::GstAppSrc,
1205            _param_spec: glib::ffi::gpointer,
1206            f: glib::ffi::gpointer,
1207        ) {
1208            let f: &F = &*(f as *const F);
1209            f(&from_glib_borrow(this))
1210        }
1211        unsafe {
1212            let f: Box_<F> = Box_::new(f);
1213            connect_raw(
1214                self.as_ptr() as *mut _,
1215                c"notify::is-live".as_ptr() as *const _,
1216                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1217                    notify_is_live_trampoline::<F> as *const (),
1218                )),
1219                Box_::into_raw(f),
1220            )
1221        }
1222    }
1223
1224    #[cfg(feature = "v1_20")]
1225    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
1226    #[doc(alias = "leaky-type")]
1227    pub fn connect_leaky_type_notify<F: Fn(&Self) + Send + Sync + 'static>(
1228        &self,
1229        f: F,
1230    ) -> SignalHandlerId {
1231        unsafe extern "C" fn notify_leaky_type_trampoline<
1232            F: Fn(&AppSrc) + Send + Sync + 'static,
1233        >(
1234            this: *mut ffi::GstAppSrc,
1235            _param_spec: glib::ffi::gpointer,
1236            f: glib::ffi::gpointer,
1237        ) {
1238            let f: &F = &*(f as *const F);
1239            f(&from_glib_borrow(this))
1240        }
1241        unsafe {
1242            let f: Box_<F> = Box_::new(f);
1243            connect_raw(
1244                self.as_ptr() as *mut _,
1245                c"notify::leaky-type".as_ptr() as *const _,
1246                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1247                    notify_leaky_type_trampoline::<F> as *const (),
1248                )),
1249                Box_::into_raw(f),
1250            )
1251        }
1252    }
1253
1254    #[cfg(feature = "v1_20")]
1255    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
1256    #[doc(alias = "max-buffers")]
1257    pub fn connect_max_buffers_notify<F: Fn(&Self) + Send + Sync + 'static>(
1258        &self,
1259        f: F,
1260    ) -> SignalHandlerId {
1261        unsafe extern "C" fn notify_max_buffers_trampoline<
1262            F: Fn(&AppSrc) + Send + Sync + 'static,
1263        >(
1264            this: *mut ffi::GstAppSrc,
1265            _param_spec: glib::ffi::gpointer,
1266            f: glib::ffi::gpointer,
1267        ) {
1268            let f: &F = &*(f as *const F);
1269            f(&from_glib_borrow(this))
1270        }
1271        unsafe {
1272            let f: Box_<F> = Box_::new(f);
1273            connect_raw(
1274                self.as_ptr() as *mut _,
1275                c"notify::max-buffers".as_ptr() as *const _,
1276                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1277                    notify_max_buffers_trampoline::<F> as *const (),
1278                )),
1279                Box_::into_raw(f),
1280            )
1281        }
1282    }
1283
1284    #[doc(alias = "max-bytes")]
1285    pub fn connect_max_bytes_notify<F: Fn(&Self) + Send + Sync + 'static>(
1286        &self,
1287        f: F,
1288    ) -> SignalHandlerId {
1289        unsafe extern "C" fn notify_max_bytes_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
1290            this: *mut ffi::GstAppSrc,
1291            _param_spec: glib::ffi::gpointer,
1292            f: glib::ffi::gpointer,
1293        ) {
1294            let f: &F = &*(f as *const F);
1295            f(&from_glib_borrow(this))
1296        }
1297        unsafe {
1298            let f: Box_<F> = Box_::new(f);
1299            connect_raw(
1300                self.as_ptr() as *mut _,
1301                c"notify::max-bytes".as_ptr() as *const _,
1302                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1303                    notify_max_bytes_trampoline::<F> as *const (),
1304                )),
1305                Box_::into_raw(f),
1306            )
1307        }
1308    }
1309
1310    #[doc(alias = "max-latency")]
1311    pub fn connect_max_latency_notify<F: Fn(&Self) + Send + Sync + 'static>(
1312        &self,
1313        f: F,
1314    ) -> SignalHandlerId {
1315        unsafe extern "C" fn notify_max_latency_trampoline<
1316            F: Fn(&AppSrc) + Send + Sync + 'static,
1317        >(
1318            this: *mut ffi::GstAppSrc,
1319            _param_spec: glib::ffi::gpointer,
1320            f: glib::ffi::gpointer,
1321        ) {
1322            let f: &F = &*(f as *const F);
1323            f(&from_glib_borrow(this))
1324        }
1325        unsafe {
1326            let f: Box_<F> = Box_::new(f);
1327            connect_raw(
1328                self.as_ptr() as *mut _,
1329                c"notify::max-latency".as_ptr() as *const _,
1330                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1331                    notify_max_latency_trampoline::<F> as *const (),
1332                )),
1333                Box_::into_raw(f),
1334            )
1335        }
1336    }
1337
1338    #[cfg(feature = "v1_20")]
1339    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
1340    #[doc(alias = "max-time")]
1341    pub fn connect_max_time_notify<F: Fn(&Self) + Send + Sync + 'static>(
1342        &self,
1343        f: F,
1344    ) -> SignalHandlerId {
1345        unsafe extern "C" fn notify_max_time_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
1346            this: *mut ffi::GstAppSrc,
1347            _param_spec: glib::ffi::gpointer,
1348            f: glib::ffi::gpointer,
1349        ) {
1350            let f: &F = &*(f as *const F);
1351            f(&from_glib_borrow(this))
1352        }
1353        unsafe {
1354            let f: Box_<F> = Box_::new(f);
1355            connect_raw(
1356                self.as_ptr() as *mut _,
1357                c"notify::max-time".as_ptr() as *const _,
1358                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1359                    notify_max_time_trampoline::<F> as *const (),
1360                )),
1361                Box_::into_raw(f),
1362            )
1363        }
1364    }
1365
1366    #[doc(alias = "min-latency")]
1367    pub fn connect_min_latency_notify<F: Fn(&Self) + Send + Sync + 'static>(
1368        &self,
1369        f: F,
1370    ) -> SignalHandlerId {
1371        unsafe extern "C" fn notify_min_latency_trampoline<
1372            F: Fn(&AppSrc) + Send + Sync + 'static,
1373        >(
1374            this: *mut ffi::GstAppSrc,
1375            _param_spec: glib::ffi::gpointer,
1376            f: glib::ffi::gpointer,
1377        ) {
1378            let f: &F = &*(f as *const F);
1379            f(&from_glib_borrow(this))
1380        }
1381        unsafe {
1382            let f: Box_<F> = Box_::new(f);
1383            connect_raw(
1384                self.as_ptr() as *mut _,
1385                c"notify::min-latency".as_ptr() as *const _,
1386                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1387                    notify_min_latency_trampoline::<F> as *const (),
1388                )),
1389                Box_::into_raw(f),
1390            )
1391        }
1392    }
1393
1394    #[doc(alias = "min-percent")]
1395    pub fn connect_min_percent_notify<F: Fn(&Self) + Send + Sync + 'static>(
1396        &self,
1397        f: F,
1398    ) -> SignalHandlerId {
1399        unsafe extern "C" fn notify_min_percent_trampoline<
1400            F: Fn(&AppSrc) + Send + Sync + 'static,
1401        >(
1402            this: *mut ffi::GstAppSrc,
1403            _param_spec: glib::ffi::gpointer,
1404            f: glib::ffi::gpointer,
1405        ) {
1406            let f: &F = &*(f as *const F);
1407            f(&from_glib_borrow(this))
1408        }
1409        unsafe {
1410            let f: Box_<F> = Box_::new(f);
1411            connect_raw(
1412                self.as_ptr() as *mut _,
1413                c"notify::min-percent".as_ptr() as *const _,
1414                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1415                    notify_min_percent_trampoline::<F> as *const (),
1416                )),
1417                Box_::into_raw(f),
1418            )
1419        }
1420    }
1421
1422    #[cfg(feature = "v1_28")]
1423    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
1424    #[doc(alias = "out")]
1425    pub fn connect_out_notify<F: Fn(&Self) + Send + Sync + 'static>(
1426        &self,
1427        f: F,
1428    ) -> SignalHandlerId {
1429        unsafe extern "C" fn notify_out_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
1430            this: *mut ffi::GstAppSrc,
1431            _param_spec: glib::ffi::gpointer,
1432            f: glib::ffi::gpointer,
1433        ) {
1434            let f: &F = &*(f as *const F);
1435            f(&from_glib_borrow(this))
1436        }
1437        unsafe {
1438            let f: Box_<F> = Box_::new(f);
1439            connect_raw(
1440                self.as_ptr() as *mut _,
1441                c"notify::out".as_ptr() as *const _,
1442                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1443                    notify_out_trampoline::<F> as *const (),
1444                )),
1445                Box_::into_raw(f),
1446            )
1447        }
1448    }
1449
1450    #[cfg(feature = "v1_28")]
1451    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
1452    #[doc(alias = "silent")]
1453    pub fn connect_silent_notify<F: Fn(&Self) + Send + Sync + 'static>(
1454        &self,
1455        f: F,
1456    ) -> SignalHandlerId {
1457        unsafe extern "C" fn notify_silent_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
1458            this: *mut ffi::GstAppSrc,
1459            _param_spec: glib::ffi::gpointer,
1460            f: glib::ffi::gpointer,
1461        ) {
1462            let f: &F = &*(f as *const F);
1463            f(&from_glib_borrow(this))
1464        }
1465        unsafe {
1466            let f: Box_<F> = Box_::new(f);
1467            connect_raw(
1468                self.as_ptr() as *mut _,
1469                c"notify::silent".as_ptr() as *const _,
1470                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1471                    notify_silent_trampoline::<F> as *const (),
1472                )),
1473                Box_::into_raw(f),
1474            )
1475        }
1476    }
1477
1478    #[doc(alias = "size")]
1479    pub fn connect_size_notify<F: Fn(&Self) + Send + Sync + 'static>(
1480        &self,
1481        f: F,
1482    ) -> SignalHandlerId {
1483        unsafe extern "C" fn notify_size_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
1484            this: *mut ffi::GstAppSrc,
1485            _param_spec: glib::ffi::gpointer,
1486            f: glib::ffi::gpointer,
1487        ) {
1488            let f: &F = &*(f as *const F);
1489            f(&from_glib_borrow(this))
1490        }
1491        unsafe {
1492            let f: Box_<F> = Box_::new(f);
1493            connect_raw(
1494                self.as_ptr() as *mut _,
1495                c"notify::size".as_ptr() as *const _,
1496                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1497                    notify_size_trampoline::<F> as *const (),
1498                )),
1499                Box_::into_raw(f),
1500            )
1501        }
1502    }
1503
1504    #[doc(alias = "stream-type")]
1505    pub fn connect_stream_type_notify<F: Fn(&Self) + Send + Sync + 'static>(
1506        &self,
1507        f: F,
1508    ) -> SignalHandlerId {
1509        unsafe extern "C" fn notify_stream_type_trampoline<
1510            F: Fn(&AppSrc) + Send + Sync + 'static,
1511        >(
1512            this: *mut ffi::GstAppSrc,
1513            _param_spec: glib::ffi::gpointer,
1514            f: glib::ffi::gpointer,
1515        ) {
1516            let f: &F = &*(f as *const F);
1517            f(&from_glib_borrow(this))
1518        }
1519        unsafe {
1520            let f: Box_<F> = Box_::new(f);
1521            connect_raw(
1522                self.as_ptr() as *mut _,
1523                c"notify::stream-type".as_ptr() as *const _,
1524                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1525                    notify_stream_type_trampoline::<F> as *const (),
1526                )),
1527                Box_::into_raw(f),
1528            )
1529        }
1530    }
1531}
1532
1533unsafe impl Send for AppSrc {}
1534unsafe impl Sync for AppSrc {}