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