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) -> Option<gst::ClockTime> {
481        unsafe {
482            from_glib(ffi::gst_app_src_get_current_level_time(
483                self.to_glib_none().0,
484            ))
485        }
486    }
487
488    /// Get the duration of the stream in nanoseconds. A value of GST_CLOCK_TIME_NONE means that the duration is
489    /// not known.
490    ///
491    /// # Returns
492    ///
493    /// the duration of the stream previously set with [`set_duration()`][Self::set_duration()];
494    #[doc(alias = "gst_app_src_get_duration")]
495    #[doc(alias = "get_duration")]
496    pub fn duration(&self) -> Option<gst::ClockTime> {
497        unsafe { from_glib(ffi::gst_app_src_get_duration(self.to_glib_none().0)) }
498    }
499
500    /// Returns the currently set [`AppLeakyType`][crate::AppLeakyType]. See [`set_leaky_type()`][Self::set_leaky_type()]
501    /// for more details.
502    ///
503    /// # Returns
504    ///
505    /// The currently set [`AppLeakyType`][crate::AppLeakyType].
506    #[cfg(feature = "v1_20")]
507    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
508    #[doc(alias = "gst_app_src_get_leaky_type")]
509    #[doc(alias = "get_leaky_type")]
510    #[doc(alias = "leaky-type")]
511    pub fn leaky_type(&self) -> AppLeakyType {
512        unsafe { from_glib(ffi::gst_app_src_get_leaky_type(self.to_glib_none().0)) }
513    }
514
515    /// Get the maximum amount of buffers that can be queued in `self`.
516    ///
517    /// # Returns
518    ///
519    /// The maximum amount of buffers that can be queued.
520    #[cfg(feature = "v1_20")]
521    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
522    #[doc(alias = "gst_app_src_get_max_buffers")]
523    #[doc(alias = "get_max_buffers")]
524    #[doc(alias = "max-buffers")]
525    pub fn max_buffers(&self) -> u64 {
526        unsafe { ffi::gst_app_src_get_max_buffers(self.to_glib_none().0) }
527    }
528
529    /// Get the maximum amount of bytes that can be queued in `self`.
530    ///
531    /// # Returns
532    ///
533    /// The maximum amount of bytes that can be queued.
534    #[doc(alias = "gst_app_src_get_max_bytes")]
535    #[doc(alias = "get_max_bytes")]
536    #[doc(alias = "max-bytes")]
537    pub fn max_bytes(&self) -> u64 {
538        unsafe { ffi::gst_app_src_get_max_bytes(self.to_glib_none().0) }
539    }
540
541    /// Get the maximum amount of time that can be queued in `self`.
542    ///
543    /// # Returns
544    ///
545    /// The maximum amount of time that can be queued.
546    #[cfg(feature = "v1_20")]
547    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
548    #[doc(alias = "gst_app_src_get_max_time")]
549    #[doc(alias = "get_max_time")]
550    #[doc(alias = "max-time")]
551    pub fn max_time(&self) -> Option<gst::ClockTime> {
552        unsafe { from_glib(ffi::gst_app_src_get_max_time(self.to_glib_none().0)) }
553    }
554
555    /// Get the size of the stream in bytes. A value of -1 means that the size is
556    /// not known.
557    ///
558    /// # Returns
559    ///
560    /// the size of the stream previously set with [`set_size()`][Self::set_size()];
561    #[doc(alias = "gst_app_src_get_size")]
562    #[doc(alias = "get_size")]
563    pub fn size(&self) -> i64 {
564        unsafe { ffi::gst_app_src_get_size(self.to_glib_none().0) }
565    }
566
567    /// Get the stream type. Control the stream type of `self`
568    /// with [`set_stream_type()`][Self::set_stream_type()].
569    ///
570    /// # Returns
571    ///
572    /// the stream type.
573    #[doc(alias = "gst_app_src_get_stream_type")]
574    #[doc(alias = "get_stream_type")]
575    #[doc(alias = "stream-type")]
576    pub fn stream_type(&self) -> AppStreamType {
577        unsafe { from_glib(ffi::gst_app_src_get_stream_type(self.to_glib_none().0)) }
578    }
579
580    /// Adds a buffer to the queue of buffers that the appsrc element will
581    /// push to its source pad. This function takes ownership of the buffer.
582    ///
583    /// When the block property is TRUE, this function can block until free
584    /// space becomes available in the queue.
585    /// ## `buffer`
586    /// a [`gst::Buffer`][crate::gst::Buffer] to push
587    ///
588    /// # Returns
589    ///
590    /// [`gst::FlowReturn::Ok`][crate::gst::FlowReturn::Ok] when the buffer was successfully queued.
591    /// [`gst::FlowReturn::Flushing`][crate::gst::FlowReturn::Flushing] when `self` is not PAUSED or PLAYING.
592    /// [`gst::FlowReturn::Eos`][crate::gst::FlowReturn::Eos] when EOS occurred.
593    #[doc(alias = "gst_app_src_push_buffer")]
594    pub fn push_buffer(&self, buffer: gst::Buffer) -> Result<gst::FlowSuccess, gst::FlowError> {
595        unsafe {
596            try_from_glib(ffi::gst_app_src_push_buffer(
597                self.to_glib_none().0,
598                buffer.into_glib_ptr(),
599            ))
600        }
601    }
602
603    /// Adds a buffer list to the queue of buffers and buffer lists that the
604    /// appsrc element will push to its source pad. This function takes ownership
605    /// of `buffer_list`.
606    ///
607    /// When the block property is TRUE, this function can block until free
608    /// space becomes available in the queue.
609    /// ## `buffer_list`
610    /// a [`gst::BufferList`][crate::gst::BufferList] to push
611    ///
612    /// # Returns
613    ///
614    /// [`gst::FlowReturn::Ok`][crate::gst::FlowReturn::Ok] when the buffer list was successfully queued.
615    /// [`gst::FlowReturn::Flushing`][crate::gst::FlowReturn::Flushing] when `self` is not PAUSED or PLAYING.
616    /// [`gst::FlowReturn::Eos`][crate::gst::FlowReturn::Eos] when EOS occurred.
617    #[doc(alias = "gst_app_src_push_buffer_list")]
618    pub fn push_buffer_list(
619        &self,
620        buffer_list: gst::BufferList,
621    ) -> Result<gst::FlowSuccess, gst::FlowError> {
622        unsafe {
623            try_from_glib(ffi::gst_app_src_push_buffer_list(
624                self.to_glib_none().0,
625                buffer_list.into_glib_ptr(),
626            ))
627        }
628    }
629
630    /// Extract a buffer from the provided sample and adds it to the queue of
631    /// buffers that the appsrc element will push to its source pad. Any
632    /// previous caps that were set on appsrc will be replaced by the caps
633    /// associated with the sample if not equal.
634    ///
635    /// This function does not take ownership of the
636    /// sample so the sample needs to be unreffed after calling this function.
637    ///
638    /// When the block property is TRUE, this function can block until free
639    /// space becomes available in the queue.
640    /// ## `sample`
641    /// a [`gst::Sample`][crate::gst::Sample] from which buffer and caps may be
642    /// extracted
643    ///
644    /// # Returns
645    ///
646    /// [`gst::FlowReturn::Ok`][crate::gst::FlowReturn::Ok] when the buffer was successfully queued.
647    /// [`gst::FlowReturn::Flushing`][crate::gst::FlowReturn::Flushing] when `self` is not PAUSED or PLAYING.
648    /// [`gst::FlowReturn::Eos`][crate::gst::FlowReturn::Eos] when EOS occurred.
649    #[doc(alias = "gst_app_src_push_sample")]
650    pub fn push_sample(&self, sample: &gst::Sample) -> Result<gst::FlowSuccess, gst::FlowError> {
651        unsafe {
652            try_from_glib(ffi::gst_app_src_push_sample(
653                self.to_glib_none().0,
654                sample.to_glib_none().0,
655            ))
656        }
657    }
658
659    //#[doc(alias = "gst_app_src_set_callbacks")]
660    //pub fn set_callbacks(&self, callbacks: /*Ignored*/&mut AppSrcCallbacks, user_data: /*Unimplemented*/Option<Basic: Pointer>) {
661    //    unsafe { TODO: call ffi:gst_app_src_set_callbacks() }
662    //}
663
664    /// Set the capabilities on the appsrc element. This function takes
665    /// a copy of the caps structure. After calling this method, the source will
666    /// only produce caps that match `caps`. `caps` must be fixed and the caps on the
667    /// buffers must match the caps or left NULL.
668    /// ## `caps`
669    /// caps to set
670    #[doc(alias = "gst_app_src_set_caps")]
671    #[doc(alias = "caps")]
672    pub fn set_caps(&self, caps: Option<&gst::Caps>) {
673        unsafe {
674            ffi::gst_app_src_set_caps(self.to_glib_none().0, caps.to_glib_none().0);
675        }
676    }
677
678    /// Set the duration of the stream in nanoseconds. A value of GST_CLOCK_TIME_NONE means that the duration is
679    /// not known.
680    /// ## `duration`
681    /// the duration to set
682    #[doc(alias = "gst_app_src_set_duration")]
683    #[doc(alias = "duration")]
684    pub fn set_duration(&self, duration: impl Into<Option<gst::ClockTime>>) {
685        unsafe {
686            ffi::gst_app_src_set_duration(self.to_glib_none().0, duration.into().into_glib());
687        }
688    }
689
690    /// When set to any other value than GST_APP_LEAKY_TYPE_NONE then the appsrc
691    /// will drop any buffers that are pushed into it once its internal queue is
692    /// full. The selected type defines whether to drop the oldest or new
693    /// buffers.
694    /// ## `leaky`
695    /// the [`AppLeakyType`][crate::AppLeakyType]
696    #[cfg(feature = "v1_20")]
697    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
698    #[doc(alias = "gst_app_src_set_leaky_type")]
699    #[doc(alias = "leaky-type")]
700    pub fn set_leaky_type(&self, leaky: AppLeakyType) {
701        unsafe {
702            ffi::gst_app_src_set_leaky_type(self.to_glib_none().0, leaky.into_glib());
703        }
704    }
705
706    /// Set the maximum amount of buffers that can be queued in `self`.
707    /// After the maximum amount of buffers are queued, `self` will emit the
708    /// "enough-data" signal.
709    /// ## `max`
710    /// the maximum number of buffers to queue
711    #[cfg(feature = "v1_20")]
712    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
713    #[doc(alias = "gst_app_src_set_max_buffers")]
714    #[doc(alias = "max-buffers")]
715    pub fn set_max_buffers(&self, max: u64) {
716        unsafe {
717            ffi::gst_app_src_set_max_buffers(self.to_glib_none().0, max);
718        }
719    }
720
721    /// Set the maximum amount of bytes that can be queued in `self`.
722    /// After the maximum amount of bytes are queued, `self` will emit the
723    /// "enough-data" signal.
724    /// ## `max`
725    /// the maximum number of bytes to queue
726    #[doc(alias = "gst_app_src_set_max_bytes")]
727    #[doc(alias = "max-bytes")]
728    pub fn set_max_bytes(&self, max: u64) {
729        unsafe {
730            ffi::gst_app_src_set_max_bytes(self.to_glib_none().0, max);
731        }
732    }
733
734    /// Set the maximum amount of time that can be queued in `self`.
735    /// After the maximum amount of time are queued, `self` will emit the
736    /// "enough-data" signal.
737    /// ## `max`
738    /// the maximum amonut of time to queue
739    #[cfg(feature = "v1_20")]
740    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
741    #[doc(alias = "gst_app_src_set_max_time")]
742    #[doc(alias = "max-time")]
743    pub fn set_max_time(&self, max: impl Into<Option<gst::ClockTime>>) {
744        unsafe {
745            ffi::gst_app_src_set_max_time(self.to_glib_none().0, max.into().into_glib());
746        }
747    }
748
749    /// Set the size of the stream in bytes. A value of -1 means that the size is
750    /// not known.
751    /// ## `size`
752    /// the size to set
753    #[doc(alias = "gst_app_src_set_size")]
754    #[doc(alias = "size")]
755    pub fn set_size(&self, size: i64) {
756        unsafe {
757            ffi::gst_app_src_set_size(self.to_glib_none().0, size);
758        }
759    }
760
761    /// Set the stream type on `self`. For seekable streams, the "seek" signal must
762    /// be connected to.
763    ///
764    /// A stream_type stream
765    /// ## `type_`
766    /// the new state
767    #[doc(alias = "gst_app_src_set_stream_type")]
768    #[doc(alias = "stream-type")]
769    pub fn set_stream_type(&self, type_: AppStreamType) {
770        unsafe {
771            ffi::gst_app_src_set_stream_type(self.to_glib_none().0, type_.into_glib());
772        }
773    }
774
775    /// When max-bytes are queued and after the enough-data signal has been emitted,
776    /// block any further push-buffer calls until the amount of queued bytes drops
777    /// below the max-bytes limit.
778    pub fn is_block(&self) -> bool {
779        ObjectExt::property(self, "block")
780    }
781
782    /// When max-bytes are queued and after the enough-data signal has been emitted,
783    /// block any further push-buffer calls until the amount of queued bytes drops
784    /// below the max-bytes limit.
785    pub fn set_block(&self, block: bool) {
786        ObjectExt::set_property(self, "block", block)
787    }
788
789    /// Number of buffers that were dropped.
790    #[cfg(feature = "v1_28")]
791    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
792    pub fn dropped(&self) -> u64 {
793        ObjectExt::property(self, "dropped")
794    }
795
796    /// The format to use for segment events. When the source is producing
797    /// timestamped buffers this property should be set to GST_FORMAT_TIME.
798    pub fn format(&self) -> gst::Format {
799        ObjectExt::property(self, "format")
800    }
801
802    /// The format to use for segment events. When the source is producing
803    /// timestamped buffers this property should be set to GST_FORMAT_TIME.
804    pub fn set_format(&self, format: gst::Format) {
805        ObjectExt::set_property(self, "format", format)
806    }
807
808    /// When enabled, appsrc will check GstSegment in GstSample which was
809    /// pushed via [`push_sample()`][Self::push_sample()] or "push-sample" signal action.
810    /// If a GstSegment is changed, corresponding segment event will be followed
811    /// by next data flow.
812    ///
813    /// FIXME: currently only GST_FORMAT_TIME format is supported and therefore
814    /// GstAppSrc::format should be time. However, possibly [`AppSrc`][crate::AppSrc] can support
815    /// other formats.
816    #[cfg(feature = "v1_18")]
817    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
818    #[doc(alias = "handle-segment-change")]
819    pub fn is_handle_segment_change(&self) -> bool {
820        ObjectExt::property(self, "handle-segment-change")
821    }
822
823    /// When enabled, appsrc will check GstSegment in GstSample which was
824    /// pushed via [`push_sample()`][Self::push_sample()] or "push-sample" signal action.
825    /// If a GstSegment is changed, corresponding segment event will be followed
826    /// by next data flow.
827    ///
828    /// FIXME: currently only GST_FORMAT_TIME format is supported and therefore
829    /// GstAppSrc::format should be time. However, possibly [`AppSrc`][crate::AppSrc] can support
830    /// other formats.
831    #[cfg(feature = "v1_18")]
832    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
833    #[doc(alias = "handle-segment-change")]
834    pub fn set_handle_segment_change(&self, handle_segment_change: bool) {
835        ObjectExt::set_property(self, "handle-segment-change", handle_segment_change)
836    }
837
838    /// Number of input buffers that were queued.
839    #[cfg(feature = "v1_28")]
840    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
841    #[doc(alias = "in")]
842    pub fn get_in(&self) -> u64 {
843        ObjectExt::property(self, "in")
844    }
845
846    /// Instruct the source to behave like a live source. This includes that it
847    /// will only push out buffers in the PLAYING state.
848    #[doc(alias = "is-live")]
849    pub fn is_live(&self) -> bool {
850        ObjectExt::property(self, "is-live")
851    }
852
853    /// Instruct the source to behave like a live source. This includes that it
854    /// will only push out buffers in the PLAYING state.
855    #[doc(alias = "is-live")]
856    pub fn set_is_live(&self, is_live: bool) {
857        ObjectExt::set_property(self, "is-live", is_live)
858    }
859
860    #[doc(alias = "max-latency")]
861    pub fn max_latency(&self) -> i64 {
862        ObjectExt::property(self, "max-latency")
863    }
864
865    #[doc(alias = "max-latency")]
866    pub fn set_max_latency(&self, max_latency: i64) {
867        ObjectExt::set_property(self, "max-latency", max_latency)
868    }
869
870    /// The minimum latency of the source. A value of -1 will use the default
871    /// latency calculations of `GstBaseSrc`.
872    #[doc(alias = "min-latency")]
873    pub fn min_latency(&self) -> i64 {
874        ObjectExt::property(self, "min-latency")
875    }
876
877    /// The minimum latency of the source. A value of -1 will use the default
878    /// latency calculations of `GstBaseSrc`.
879    #[doc(alias = "min-latency")]
880    pub fn set_min_latency(&self, min_latency: i64) {
881        ObjectExt::set_property(self, "min-latency", min_latency)
882    }
883
884    /// Make appsrc emit the "need-data" signal when the amount of bytes in the
885    /// queue drops below this percentage of max-bytes.
886    #[doc(alias = "min-percent")]
887    pub fn min_percent(&self) -> u32 {
888        ObjectExt::property(self, "min-percent")
889    }
890
891    /// Make appsrc emit the "need-data" signal when the amount of bytes in the
892    /// queue drops below this percentage of max-bytes.
893    #[doc(alias = "min-percent")]
894    pub fn set_min_percent(&self, min_percent: u32) {
895        ObjectExt::set_property(self, "min-percent", min_percent)
896    }
897
898    /// Number of output buffers that were dequeued.
899    #[cfg(feature = "v1_28")]
900    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
901    pub fn out(&self) -> u64 {
902        ObjectExt::property(self, "out")
903    }
904
905    /// Don't emit notify for input, output and dropped buffers.
906    #[cfg(feature = "v1_28")]
907    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
908    pub fn is_silent(&self) -> bool {
909        ObjectExt::property(self, "silent")
910    }
911
912    /// Don't emit notify for input, output and dropped buffers.
913    #[cfg(feature = "v1_28")]
914    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
915    pub fn set_silent(&self, silent: bool) {
916        ObjectExt::set_property(self, "silent", silent)
917    }
918
919    #[doc(alias = "block")]
920    pub fn connect_block_notify<F: Fn(&Self) + Send + Sync + 'static>(
921        &self,
922        f: F,
923    ) -> SignalHandlerId {
924        unsafe extern "C" fn notify_block_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
925            this: *mut ffi::GstAppSrc,
926            _param_spec: glib::ffi::gpointer,
927            f: glib::ffi::gpointer,
928        ) {
929            let f: &F = &*(f as *const F);
930            f(&from_glib_borrow(this))
931        }
932        unsafe {
933            let f: Box_<F> = Box_::new(f);
934            connect_raw(
935                self.as_ptr() as *mut _,
936                c"notify::block".as_ptr() as *const _,
937                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
938                    notify_block_trampoline::<F> as *const (),
939                )),
940                Box_::into_raw(f),
941            )
942        }
943    }
944
945    #[doc(alias = "caps")]
946    pub fn connect_caps_notify<F: Fn(&Self) + Send + Sync + 'static>(
947        &self,
948        f: F,
949    ) -> SignalHandlerId {
950        unsafe extern "C" fn notify_caps_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
951            this: *mut ffi::GstAppSrc,
952            _param_spec: glib::ffi::gpointer,
953            f: glib::ffi::gpointer,
954        ) {
955            let f: &F = &*(f as *const F);
956            f(&from_glib_borrow(this))
957        }
958        unsafe {
959            let f: Box_<F> = Box_::new(f);
960            connect_raw(
961                self.as_ptr() as *mut _,
962                c"notify::caps".as_ptr() as *const _,
963                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
964                    notify_caps_trampoline::<F> as *const (),
965                )),
966                Box_::into_raw(f),
967            )
968        }
969    }
970
971    #[cfg(feature = "v1_20")]
972    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
973    #[doc(alias = "current-level-buffers")]
974    pub fn connect_current_level_buffers_notify<F: Fn(&Self) + Send + Sync + 'static>(
975        &self,
976        f: F,
977    ) -> SignalHandlerId {
978        unsafe extern "C" fn notify_current_level_buffers_trampoline<
979            F: Fn(&AppSrc) + Send + Sync + 'static,
980        >(
981            this: *mut ffi::GstAppSrc,
982            _param_spec: glib::ffi::gpointer,
983            f: glib::ffi::gpointer,
984        ) {
985            let f: &F = &*(f as *const F);
986            f(&from_glib_borrow(this))
987        }
988        unsafe {
989            let f: Box_<F> = Box_::new(f);
990            connect_raw(
991                self.as_ptr() as *mut _,
992                c"notify::current-level-buffers".as_ptr() as *const _,
993                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
994                    notify_current_level_buffers_trampoline::<F> as *const (),
995                )),
996                Box_::into_raw(f),
997            )
998        }
999    }
1000
1001    #[doc(alias = "current-level-bytes")]
1002    pub fn connect_current_level_bytes_notify<F: Fn(&Self) + Send + Sync + 'static>(
1003        &self,
1004        f: F,
1005    ) -> SignalHandlerId {
1006        unsafe extern "C" fn notify_current_level_bytes_trampoline<
1007            F: Fn(&AppSrc) + Send + Sync + 'static,
1008        >(
1009            this: *mut ffi::GstAppSrc,
1010            _param_spec: glib::ffi::gpointer,
1011            f: glib::ffi::gpointer,
1012        ) {
1013            let f: &F = &*(f as *const F);
1014            f(&from_glib_borrow(this))
1015        }
1016        unsafe {
1017            let f: Box_<F> = Box_::new(f);
1018            connect_raw(
1019                self.as_ptr() as *mut _,
1020                c"notify::current-level-bytes".as_ptr() as *const _,
1021                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1022                    notify_current_level_bytes_trampoline::<F> as *const (),
1023                )),
1024                Box_::into_raw(f),
1025            )
1026        }
1027    }
1028
1029    #[cfg(feature = "v1_20")]
1030    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
1031    #[doc(alias = "current-level-time")]
1032    pub fn connect_current_level_time_notify<F: Fn(&Self) + Send + Sync + 'static>(
1033        &self,
1034        f: F,
1035    ) -> SignalHandlerId {
1036        unsafe extern "C" fn notify_current_level_time_trampoline<
1037            F: Fn(&AppSrc) + Send + Sync + 'static,
1038        >(
1039            this: *mut ffi::GstAppSrc,
1040            _param_spec: glib::ffi::gpointer,
1041            f: glib::ffi::gpointer,
1042        ) {
1043            let f: &F = &*(f as *const F);
1044            f(&from_glib_borrow(this))
1045        }
1046        unsafe {
1047            let f: Box_<F> = Box_::new(f);
1048            connect_raw(
1049                self.as_ptr() as *mut _,
1050                c"notify::current-level-time".as_ptr() as *const _,
1051                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1052                    notify_current_level_time_trampoline::<F> as *const (),
1053                )),
1054                Box_::into_raw(f),
1055            )
1056        }
1057    }
1058
1059    #[cfg(feature = "v1_28")]
1060    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
1061    #[doc(alias = "dropped")]
1062    pub fn connect_dropped_notify<F: Fn(&Self) + Send + Sync + 'static>(
1063        &self,
1064        f: F,
1065    ) -> SignalHandlerId {
1066        unsafe extern "C" fn notify_dropped_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
1067            this: *mut ffi::GstAppSrc,
1068            _param_spec: glib::ffi::gpointer,
1069            f: glib::ffi::gpointer,
1070        ) {
1071            let f: &F = &*(f as *const F);
1072            f(&from_glib_borrow(this))
1073        }
1074        unsafe {
1075            let f: Box_<F> = Box_::new(f);
1076            connect_raw(
1077                self.as_ptr() as *mut _,
1078                c"notify::dropped".as_ptr() as *const _,
1079                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1080                    notify_dropped_trampoline::<F> as *const (),
1081                )),
1082                Box_::into_raw(f),
1083            )
1084        }
1085    }
1086
1087    #[doc(alias = "duration")]
1088    pub fn connect_duration_notify<F: Fn(&Self) + Send + Sync + 'static>(
1089        &self,
1090        f: F,
1091    ) -> SignalHandlerId {
1092        unsafe extern "C" fn notify_duration_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
1093            this: *mut ffi::GstAppSrc,
1094            _param_spec: glib::ffi::gpointer,
1095            f: glib::ffi::gpointer,
1096        ) {
1097            let f: &F = &*(f as *const F);
1098            f(&from_glib_borrow(this))
1099        }
1100        unsafe {
1101            let f: Box_<F> = Box_::new(f);
1102            connect_raw(
1103                self.as_ptr() as *mut _,
1104                c"notify::duration".as_ptr() as *const _,
1105                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1106                    notify_duration_trampoline::<F> as *const (),
1107                )),
1108                Box_::into_raw(f),
1109            )
1110        }
1111    }
1112
1113    #[doc(alias = "format")]
1114    pub fn connect_format_notify<F: Fn(&Self) + Send + Sync + 'static>(
1115        &self,
1116        f: F,
1117    ) -> SignalHandlerId {
1118        unsafe extern "C" fn notify_format_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
1119            this: *mut ffi::GstAppSrc,
1120            _param_spec: glib::ffi::gpointer,
1121            f: glib::ffi::gpointer,
1122        ) {
1123            let f: &F = &*(f as *const F);
1124            f(&from_glib_borrow(this))
1125        }
1126        unsafe {
1127            let f: Box_<F> = Box_::new(f);
1128            connect_raw(
1129                self.as_ptr() as *mut _,
1130                c"notify::format".as_ptr() as *const _,
1131                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1132                    notify_format_trampoline::<F> as *const (),
1133                )),
1134                Box_::into_raw(f),
1135            )
1136        }
1137    }
1138
1139    #[cfg(feature = "v1_18")]
1140    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
1141    #[doc(alias = "handle-segment-change")]
1142    pub fn connect_handle_segment_change_notify<F: Fn(&Self) + Send + Sync + 'static>(
1143        &self,
1144        f: F,
1145    ) -> SignalHandlerId {
1146        unsafe extern "C" fn notify_handle_segment_change_trampoline<
1147            F: Fn(&AppSrc) + Send + Sync + 'static,
1148        >(
1149            this: *mut ffi::GstAppSrc,
1150            _param_spec: glib::ffi::gpointer,
1151            f: glib::ffi::gpointer,
1152        ) {
1153            let f: &F = &*(f as *const F);
1154            f(&from_glib_borrow(this))
1155        }
1156        unsafe {
1157            let f: Box_<F> = Box_::new(f);
1158            connect_raw(
1159                self.as_ptr() as *mut _,
1160                c"notify::handle-segment-change".as_ptr() as *const _,
1161                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1162                    notify_handle_segment_change_trampoline::<F> as *const (),
1163                )),
1164                Box_::into_raw(f),
1165            )
1166        }
1167    }
1168
1169    #[cfg(feature = "v1_28")]
1170    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
1171    #[doc(alias = "in")]
1172    pub fn connect_in_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
1173        unsafe extern "C" fn notify_in_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
1174            this: *mut ffi::GstAppSrc,
1175            _param_spec: glib::ffi::gpointer,
1176            f: glib::ffi::gpointer,
1177        ) {
1178            let f: &F = &*(f as *const F);
1179            f(&from_glib_borrow(this))
1180        }
1181        unsafe {
1182            let f: Box_<F> = Box_::new(f);
1183            connect_raw(
1184                self.as_ptr() as *mut _,
1185                c"notify::in".as_ptr() as *const _,
1186                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1187                    notify_in_trampoline::<F> as *const (),
1188                )),
1189                Box_::into_raw(f),
1190            )
1191        }
1192    }
1193
1194    #[doc(alias = "is-live")]
1195    pub fn connect_is_live_notify<F: Fn(&Self) + Send + Sync + 'static>(
1196        &self,
1197        f: F,
1198    ) -> SignalHandlerId {
1199        unsafe extern "C" fn notify_is_live_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
1200            this: *mut ffi::GstAppSrc,
1201            _param_spec: glib::ffi::gpointer,
1202            f: glib::ffi::gpointer,
1203        ) {
1204            let f: &F = &*(f as *const F);
1205            f(&from_glib_borrow(this))
1206        }
1207        unsafe {
1208            let f: Box_<F> = Box_::new(f);
1209            connect_raw(
1210                self.as_ptr() as *mut _,
1211                c"notify::is-live".as_ptr() as *const _,
1212                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1213                    notify_is_live_trampoline::<F> as *const (),
1214                )),
1215                Box_::into_raw(f),
1216            )
1217        }
1218    }
1219
1220    #[cfg(feature = "v1_20")]
1221    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
1222    #[doc(alias = "leaky-type")]
1223    pub fn connect_leaky_type_notify<F: Fn(&Self) + Send + Sync + 'static>(
1224        &self,
1225        f: F,
1226    ) -> SignalHandlerId {
1227        unsafe extern "C" fn notify_leaky_type_trampoline<
1228            F: Fn(&AppSrc) + Send + Sync + 'static,
1229        >(
1230            this: *mut ffi::GstAppSrc,
1231            _param_spec: glib::ffi::gpointer,
1232            f: glib::ffi::gpointer,
1233        ) {
1234            let f: &F = &*(f as *const F);
1235            f(&from_glib_borrow(this))
1236        }
1237        unsafe {
1238            let f: Box_<F> = Box_::new(f);
1239            connect_raw(
1240                self.as_ptr() as *mut _,
1241                c"notify::leaky-type".as_ptr() as *const _,
1242                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1243                    notify_leaky_type_trampoline::<F> as *const (),
1244                )),
1245                Box_::into_raw(f),
1246            )
1247        }
1248    }
1249
1250    #[cfg(feature = "v1_20")]
1251    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
1252    #[doc(alias = "max-buffers")]
1253    pub fn connect_max_buffers_notify<F: Fn(&Self) + Send + Sync + 'static>(
1254        &self,
1255        f: F,
1256    ) -> SignalHandlerId {
1257        unsafe extern "C" fn notify_max_buffers_trampoline<
1258            F: Fn(&AppSrc) + Send + Sync + 'static,
1259        >(
1260            this: *mut ffi::GstAppSrc,
1261            _param_spec: glib::ffi::gpointer,
1262            f: glib::ffi::gpointer,
1263        ) {
1264            let f: &F = &*(f as *const F);
1265            f(&from_glib_borrow(this))
1266        }
1267        unsafe {
1268            let f: Box_<F> = Box_::new(f);
1269            connect_raw(
1270                self.as_ptr() as *mut _,
1271                c"notify::max-buffers".as_ptr() as *const _,
1272                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1273                    notify_max_buffers_trampoline::<F> as *const (),
1274                )),
1275                Box_::into_raw(f),
1276            )
1277        }
1278    }
1279
1280    #[doc(alias = "max-bytes")]
1281    pub fn connect_max_bytes_notify<F: Fn(&Self) + Send + Sync + 'static>(
1282        &self,
1283        f: F,
1284    ) -> SignalHandlerId {
1285        unsafe extern "C" fn notify_max_bytes_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
1286            this: *mut ffi::GstAppSrc,
1287            _param_spec: glib::ffi::gpointer,
1288            f: glib::ffi::gpointer,
1289        ) {
1290            let f: &F = &*(f as *const F);
1291            f(&from_glib_borrow(this))
1292        }
1293        unsafe {
1294            let f: Box_<F> = Box_::new(f);
1295            connect_raw(
1296                self.as_ptr() as *mut _,
1297                c"notify::max-bytes".as_ptr() as *const _,
1298                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1299                    notify_max_bytes_trampoline::<F> as *const (),
1300                )),
1301                Box_::into_raw(f),
1302            )
1303        }
1304    }
1305
1306    #[doc(alias = "max-latency")]
1307    pub fn connect_max_latency_notify<F: Fn(&Self) + Send + Sync + 'static>(
1308        &self,
1309        f: F,
1310    ) -> SignalHandlerId {
1311        unsafe extern "C" fn notify_max_latency_trampoline<
1312            F: Fn(&AppSrc) + Send + Sync + 'static,
1313        >(
1314            this: *mut ffi::GstAppSrc,
1315            _param_spec: glib::ffi::gpointer,
1316            f: glib::ffi::gpointer,
1317        ) {
1318            let f: &F = &*(f as *const F);
1319            f(&from_glib_borrow(this))
1320        }
1321        unsafe {
1322            let f: Box_<F> = Box_::new(f);
1323            connect_raw(
1324                self.as_ptr() as *mut _,
1325                c"notify::max-latency".as_ptr() as *const _,
1326                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1327                    notify_max_latency_trampoline::<F> as *const (),
1328                )),
1329                Box_::into_raw(f),
1330            )
1331        }
1332    }
1333
1334    #[cfg(feature = "v1_20")]
1335    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
1336    #[doc(alias = "max-time")]
1337    pub fn connect_max_time_notify<F: Fn(&Self) + Send + Sync + 'static>(
1338        &self,
1339        f: F,
1340    ) -> SignalHandlerId {
1341        unsafe extern "C" fn notify_max_time_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
1342            this: *mut ffi::GstAppSrc,
1343            _param_spec: glib::ffi::gpointer,
1344            f: glib::ffi::gpointer,
1345        ) {
1346            let f: &F = &*(f as *const F);
1347            f(&from_glib_borrow(this))
1348        }
1349        unsafe {
1350            let f: Box_<F> = Box_::new(f);
1351            connect_raw(
1352                self.as_ptr() as *mut _,
1353                c"notify::max-time".as_ptr() as *const _,
1354                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1355                    notify_max_time_trampoline::<F> as *const (),
1356                )),
1357                Box_::into_raw(f),
1358            )
1359        }
1360    }
1361
1362    #[doc(alias = "min-latency")]
1363    pub fn connect_min_latency_notify<F: Fn(&Self) + Send + Sync + 'static>(
1364        &self,
1365        f: F,
1366    ) -> SignalHandlerId {
1367        unsafe extern "C" fn notify_min_latency_trampoline<
1368            F: Fn(&AppSrc) + Send + Sync + 'static,
1369        >(
1370            this: *mut ffi::GstAppSrc,
1371            _param_spec: glib::ffi::gpointer,
1372            f: glib::ffi::gpointer,
1373        ) {
1374            let f: &F = &*(f as *const F);
1375            f(&from_glib_borrow(this))
1376        }
1377        unsafe {
1378            let f: Box_<F> = Box_::new(f);
1379            connect_raw(
1380                self.as_ptr() as *mut _,
1381                c"notify::min-latency".as_ptr() as *const _,
1382                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1383                    notify_min_latency_trampoline::<F> as *const (),
1384                )),
1385                Box_::into_raw(f),
1386            )
1387        }
1388    }
1389
1390    #[doc(alias = "min-percent")]
1391    pub fn connect_min_percent_notify<F: Fn(&Self) + Send + Sync + 'static>(
1392        &self,
1393        f: F,
1394    ) -> SignalHandlerId {
1395        unsafe extern "C" fn notify_min_percent_trampoline<
1396            F: Fn(&AppSrc) + Send + Sync + 'static,
1397        >(
1398            this: *mut ffi::GstAppSrc,
1399            _param_spec: glib::ffi::gpointer,
1400            f: glib::ffi::gpointer,
1401        ) {
1402            let f: &F = &*(f as *const F);
1403            f(&from_glib_borrow(this))
1404        }
1405        unsafe {
1406            let f: Box_<F> = Box_::new(f);
1407            connect_raw(
1408                self.as_ptr() as *mut _,
1409                c"notify::min-percent".as_ptr() as *const _,
1410                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1411                    notify_min_percent_trampoline::<F> as *const (),
1412                )),
1413                Box_::into_raw(f),
1414            )
1415        }
1416    }
1417
1418    #[cfg(feature = "v1_28")]
1419    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
1420    #[doc(alias = "out")]
1421    pub fn connect_out_notify<F: Fn(&Self) + Send + Sync + 'static>(
1422        &self,
1423        f: F,
1424    ) -> SignalHandlerId {
1425        unsafe extern "C" fn notify_out_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
1426            this: *mut ffi::GstAppSrc,
1427            _param_spec: glib::ffi::gpointer,
1428            f: glib::ffi::gpointer,
1429        ) {
1430            let f: &F = &*(f as *const F);
1431            f(&from_glib_borrow(this))
1432        }
1433        unsafe {
1434            let f: Box_<F> = Box_::new(f);
1435            connect_raw(
1436                self.as_ptr() as *mut _,
1437                c"notify::out".as_ptr() as *const _,
1438                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1439                    notify_out_trampoline::<F> as *const (),
1440                )),
1441                Box_::into_raw(f),
1442            )
1443        }
1444    }
1445
1446    #[cfg(feature = "v1_28")]
1447    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
1448    #[doc(alias = "silent")]
1449    pub fn connect_silent_notify<F: Fn(&Self) + Send + Sync + 'static>(
1450        &self,
1451        f: F,
1452    ) -> SignalHandlerId {
1453        unsafe extern "C" fn notify_silent_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
1454            this: *mut ffi::GstAppSrc,
1455            _param_spec: glib::ffi::gpointer,
1456            f: glib::ffi::gpointer,
1457        ) {
1458            let f: &F = &*(f as *const F);
1459            f(&from_glib_borrow(this))
1460        }
1461        unsafe {
1462            let f: Box_<F> = Box_::new(f);
1463            connect_raw(
1464                self.as_ptr() as *mut _,
1465                c"notify::silent".as_ptr() as *const _,
1466                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1467                    notify_silent_trampoline::<F> as *const (),
1468                )),
1469                Box_::into_raw(f),
1470            )
1471        }
1472    }
1473
1474    #[doc(alias = "size")]
1475    pub fn connect_size_notify<F: Fn(&Self) + Send + Sync + 'static>(
1476        &self,
1477        f: F,
1478    ) -> SignalHandlerId {
1479        unsafe extern "C" fn notify_size_trampoline<F: Fn(&AppSrc) + Send + Sync + 'static>(
1480            this: *mut ffi::GstAppSrc,
1481            _param_spec: glib::ffi::gpointer,
1482            f: glib::ffi::gpointer,
1483        ) {
1484            let f: &F = &*(f as *const F);
1485            f(&from_glib_borrow(this))
1486        }
1487        unsafe {
1488            let f: Box_<F> = Box_::new(f);
1489            connect_raw(
1490                self.as_ptr() as *mut _,
1491                c"notify::size".as_ptr() as *const _,
1492                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1493                    notify_size_trampoline::<F> as *const (),
1494                )),
1495                Box_::into_raw(f),
1496            )
1497        }
1498    }
1499
1500    #[doc(alias = "stream-type")]
1501    pub fn connect_stream_type_notify<F: Fn(&Self) + Send + Sync + 'static>(
1502        &self,
1503        f: F,
1504    ) -> SignalHandlerId {
1505        unsafe extern "C" fn notify_stream_type_trampoline<
1506            F: Fn(&AppSrc) + Send + Sync + 'static,
1507        >(
1508            this: *mut ffi::GstAppSrc,
1509            _param_spec: glib::ffi::gpointer,
1510            f: glib::ffi::gpointer,
1511        ) {
1512            let f: &F = &*(f as *const F);
1513            f(&from_glib_borrow(this))
1514        }
1515        unsafe {
1516            let f: Box_<F> = Box_::new(f);
1517            connect_raw(
1518                self.as_ptr() as *mut _,
1519                c"notify::stream-type".as_ptr() as *const _,
1520                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1521                    notify_stream_type_trampoline::<F> as *const (),
1522                )),
1523                Box_::into_raw(f),
1524            )
1525        }
1526    }
1527}
1528
1529unsafe impl Send for AppSrc {}
1530unsafe impl Sync for AppSrc {}