gstreamer_base/auto/
base_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#![allow(deprecated)]
6
7use crate::ffi;
8use glib::{
9    prelude::*,
10    signal::{connect_raw, SignalHandlerId},
11    translate::*,
12};
13use std::boxed::Box as Box_;
14
15glib::wrapper! {
16    /// This is a generic base class for source elements. The following
17    /// types of sources are supported:
18    ///
19    ///  * random access sources like files
20    ///  * seekable sources
21    ///  * live sources
22    ///
23    /// The source can be configured to operate in any [`gst::Format`][crate::gst::Format] with the
24    /// [`BaseSrcExt::set_format()`][crate::prelude::BaseSrcExt::set_format()] method. The currently set format determines
25    /// the format of the internal [`gst::Segment`][crate::gst::Segment] and any [`gst::EventType::Segment`][crate::gst::EventType::Segment]
26    /// events. The default format for [`BaseSrc`][crate::BaseSrc] is [`gst::Format::Bytes`][crate::gst::Format::Bytes].
27    ///
28    /// [`BaseSrc`][crate::BaseSrc] always supports push mode scheduling. If the following
29    /// conditions are met, it also supports pull mode scheduling:
30    ///
31    ///  * The format is set to [`gst::Format::Bytes`][crate::gst::Format::Bytes] (default).
32    ///  * `GstBaseSrcClass::is_seekable` returns [`true`].
33    ///
34    /// If all the conditions are met for operating in pull mode, [`BaseSrc`][crate::BaseSrc] is
35    /// automatically seekable in push mode as well. The following conditions must
36    /// be met to make the element seekable in push mode when the format is not
37    /// [`gst::Format::Bytes`][crate::gst::Format::Bytes]:
38    ///
39    /// * `GstBaseSrcClass::is_seekable` returns [`true`].
40    /// * `GstBaseSrcClass::query` can convert all supported seek formats to the
41    ///  internal format as set with [`BaseSrcExt::set_format()`][crate::prelude::BaseSrcExt::set_format()].
42    /// * `GstBaseSrcClass::do_seek` is implemented, performs the seek and returns
43    ///  [`true`].
44    ///
45    /// When the element does not meet the requirements to operate in pull mode, the
46    /// offset and length in the `GstBaseSrcClass::create` method should be ignored.
47    /// It is recommended to subclass [`PushSrc`][crate::PushSrc] instead, in this situation. If the
48    /// element can operate in pull mode but only with specific offsets and
49    /// lengths, it is allowed to generate an error when the wrong values are passed
50    /// to the `GstBaseSrcClass::create` function.
51    ///
52    /// [`BaseSrc`][crate::BaseSrc] has support for live sources. Live sources are sources that when
53    /// paused discard data, such as audio or video capture devices. A typical live
54    /// source also produces data at a fixed rate and thus provides a clock to publish
55    /// this rate.
56    /// Use [`BaseSrcExt::set_live()`][crate::prelude::BaseSrcExt::set_live()] to activate the live source mode.
57    ///
58    /// A live source does not produce data in the PAUSED state. This means that the
59    /// `GstBaseSrcClass::create` method will not be called in PAUSED but only in
60    /// PLAYING. To signal the pipeline that the element will not produce data, the
61    /// return value from the READY to PAUSED state will be
62    /// [`gst::StateChangeReturn::NoPreroll`][crate::gst::StateChangeReturn::NoPreroll].
63    ///
64    /// A typical live source will timestamp the buffers it creates with the
65    /// current running time of the pipeline. This is one reason why a live source
66    /// can only produce data in the PLAYING state, when the clock is actually
67    /// distributed and running.
68    ///
69    /// Live sources that synchronize and block on the clock (an audio source, for
70    /// example) can use [`BaseSrcExt::wait_playing()`][crate::prelude::BaseSrcExt::wait_playing()] when the
71    /// `GstBaseSrcClass::create` function was interrupted by a state change to
72    /// PAUSED.
73    ///
74    /// The `GstBaseSrcClass::get_times` method can be used to implement pseudo-live
75    /// sources. It only makes sense to implement the `GstBaseSrcClass::get_times`
76    /// function if the source is a live source. The `GstBaseSrcClass::get_times`
77    /// function should return timestamps starting from 0, as if it were a non-live
78    /// source. The base class will make sure that the timestamps are transformed
79    /// into the current running_time. The base source will then wait for the
80    /// calculated running_time before pushing out the buffer.
81    ///
82    /// For live sources, the base class will by default report a latency of 0.
83    /// For pseudo live sources, the base class will by default measure the difference
84    /// between the first buffer timestamp and the start time of get_times and will
85    /// report this value as the latency.
86    /// Subclasses should override the query function when this behaviour is not
87    /// acceptable.
88    ///
89    /// There is only support in [`BaseSrc`][crate::BaseSrc] for exactly one source pad, which
90    /// should be named "src". A source implementation (subclass of [`BaseSrc`][crate::BaseSrc])
91    /// should install a pad template in its class_init function, like so:
92    ///
93    ///
94    /// **⚠️ The following code is in C ⚠️**
95    ///
96    /// ```C
97    /// static void
98    /// my_element_class_init (GstMyElementClass *klass)
99    /// {
100    ///   GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
101    ///   // srctemplate should be a #GstStaticPadTemplate with direction
102    ///   // %GST_PAD_SRC and name "src"
103    ///   gst_element_class_add_static_pad_template (gstelement_class, &srctemplate);
104    ///
105    ///   gst_element_class_set_static_metadata (gstelement_class,
106    ///      "Source name",
107    ///      "Source",
108    ///      "My Source element",
109    ///      "The author <my.sink@my.email>");
110    /// }
111    /// ```
112    ///
113    /// ## Controlled shutdown of live sources in applications
114    ///
115    /// Applications that record from a live source may want to stop recording
116    /// in a controlled way, so that the recording is stopped, but the data
117    /// already in the pipeline is processed to the end (remember that many live
118    /// sources would go on recording forever otherwise). For that to happen the
119    /// application needs to make the source stop recording and send an EOS
120    /// event down the pipeline. The application would then wait for an
121    /// EOS message posted on the pipeline's bus to know when all data has
122    /// been processed and the pipeline can safely be stopped.
123    ///
124    /// An application may send an EOS event to a source element to make it
125    /// perform the EOS logic (send EOS event downstream or post a
126    /// `GST_MESSAGE_SEGMENT_DONE` on the bus). This can typically be done
127    /// with the [`ElementExtManual::send_event()`][crate::gst::prelude::ElementExtManual::send_event()] function on the element or its parent bin.
128    ///
129    /// After the EOS has been sent to the element, the application should wait for
130    /// an EOS message to be posted on the pipeline's bus. Once this EOS message is
131    /// received, it may safely shut down the entire pipeline.
132    ///
133    /// This is an Abstract Base Class, you cannot instantiate it.
134    ///
135    /// ## Properties
136    ///
137    ///
138    /// #### `automatic-eos`
139    ///  See [`BaseSrcExt::set_automatic_eos()`][crate::prelude::BaseSrcExt::set_automatic_eos()]
140    ///
141    /// Readable | Writeable
142    ///
143    ///
144    /// #### `blocksize`
145    ///  Readable | Writeable
146    ///
147    ///
148    /// #### `do-timestamp`
149    ///  Readable | Writeable
150    ///
151    ///
152    /// #### `num-buffers`
153    ///  Readable | Writeable
154    ///
155    ///
156    /// #### `typefind`
157    ///  Readable | Writeable
158    /// <details><summary><h4>Object</h4></summary>
159    ///
160    ///
161    /// #### `name`
162    ///  Readable | Writeable | Construct
163    ///
164    ///
165    /// #### `parent`
166    ///  The parent of the object. Please note, that when changing the 'parent'
167    /// property, we don't emit [`notify`][struct@crate::glib::Object#notify] and [`deep-notify`][struct@crate::gst::Object#deep-notify]
168    /// signals due to locking issues. In some cases one can use
169    /// `GstBin::element-added` or `GstBin::element-removed` signals on the parent to
170    /// achieve a similar effect.
171    ///
172    /// Readable | Writeable
173    /// </details>
174    ///
175    /// # Implements
176    ///
177    /// [`BaseSrcExt`][trait@crate::prelude::BaseSrcExt], [`trait@gst::prelude::ElementExt`], [`trait@gst::prelude::ObjectExt`], [`trait@glib::ObjectExt`], [`BaseSrcExtManual`][trait@crate::prelude::BaseSrcExtManual]
178    #[doc(alias = "GstBaseSrc")]
179    pub struct BaseSrc(Object<ffi::GstBaseSrc, ffi::GstBaseSrcClass>) @extends gst::Element, gst::Object;
180
181    match fn {
182        type_ => || ffi::gst_base_src_get_type(),
183    }
184}
185
186impl BaseSrc {
187    pub const NONE: Option<&'static BaseSrc> = None;
188}
189
190unsafe impl Send for BaseSrc {}
191unsafe impl Sync for BaseSrc {}
192
193mod sealed {
194    pub trait Sealed {}
195    impl<T: super::IsA<super::BaseSrc>> Sealed for T {}
196}
197
198/// Trait containing all [`struct@BaseSrc`] methods.
199///
200/// # Implementors
201///
202/// [`BaseSrc`][struct@crate::BaseSrc], [`PushSrc`][struct@crate::PushSrc]
203pub trait BaseSrcExt: IsA<BaseSrc> + sealed::Sealed + 'static {
204    /// Get the number of bytes that `self` will push out with each buffer.
205    ///
206    /// # Returns
207    ///
208    /// the number of bytes pushed with each buffer.
209    #[doc(alias = "gst_base_src_get_blocksize")]
210    #[doc(alias = "get_blocksize")]
211    fn blocksize(&self) -> u32 {
212        unsafe { ffi::gst_base_src_get_blocksize(self.as_ref().to_glib_none().0) }
213    }
214
215    ///
216    /// # Returns
217    ///
218    /// the instance of the [`gst::BufferPool`][crate::gst::BufferPool] used
219    /// by the src; unref it after usage.
220    #[doc(alias = "gst_base_src_get_buffer_pool")]
221    #[doc(alias = "get_buffer_pool")]
222    fn buffer_pool(&self) -> Option<gst::BufferPool> {
223        unsafe {
224            from_glib_full(ffi::gst_base_src_get_buffer_pool(
225                self.as_ref().to_glib_none().0,
226            ))
227        }
228    }
229
230    /// Query if `self` timestamps outgoing buffers based on the current running_time.
231    ///
232    /// # Returns
233    ///
234    /// [`true`] if the base class will automatically timestamp outgoing buffers.
235    #[doc(alias = "gst_base_src_get_do_timestamp")]
236    #[doc(alias = "get_do_timestamp")]
237    #[doc(alias = "do-timestamp")]
238    fn does_timestamp(&self) -> bool {
239        unsafe {
240            from_glib(ffi::gst_base_src_get_do_timestamp(
241                self.as_ref().to_glib_none().0,
242            ))
243        }
244    }
245
246    /// Get the current async behaviour of `self`. See also [`set_async()`][Self::set_async()].
247    ///
248    /// # Returns
249    ///
250    /// [`true`] if `self` is operating in async mode.
251    #[doc(alias = "gst_base_src_is_async")]
252    fn is_async(&self) -> bool {
253        unsafe { from_glib(ffi::gst_base_src_is_async(self.as_ref().to_glib_none().0)) }
254    }
255
256    /// Check if an element is in live mode.
257    ///
258    /// # Returns
259    ///
260    /// [`true`] if element is in live mode.
261    #[doc(alias = "gst_base_src_is_live")]
262    fn is_live(&self) -> bool {
263        unsafe { from_glib(ffi::gst_base_src_is_live(self.as_ref().to_glib_none().0)) }
264    }
265
266    /// Negotiates src pad caps with downstream elements.
267    /// Unmarks GST_PAD_FLAG_NEED_RECONFIGURE in any case. But marks it again
268    /// if `GstBaseSrcClass::negotiate` fails.
269    ///
270    /// Do not call this in the `GstBaseSrcClass::fill` vmethod. Call this in
271    /// `GstBaseSrcClass::create` or in `GstBaseSrcClass::alloc`, _before_ any
272    /// buffer is allocated.
273    ///
274    /// # Returns
275    ///
276    /// [`true`] if the negotiation succeeded, else [`false`].
277    #[cfg(feature = "v1_18")]
278    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
279    #[doc(alias = "gst_base_src_negotiate")]
280    fn negotiate(&self) -> bool {
281        unsafe { from_glib(ffi::gst_base_src_negotiate(self.as_ref().to_glib_none().0)) }
282    }
283
284    /// Prepare a new seamless segment for emission downstream. This function must
285    /// only be called by derived sub-classes, and only from the `GstBaseSrcClass::create` function,
286    /// as the stream-lock needs to be held.
287    ///
288    /// The format for the new segment will be the current format of the source, as
289    /// configured with [`set_format()`][Self::set_format()]
290    ///
291    /// # Deprecated since 1.18
292    ///
293    /// Use [`new_segment()`][Self::new_segment()]
294    /// ## `start`
295    /// The new start value for the segment
296    /// ## `stop`
297    /// Stop value for the new segment
298    /// ## `time`
299    /// The new time value for the start of the new segment
300    ///
301    /// # Returns
302    ///
303    /// [`true`] if preparation of the seamless segment succeeded.
304    #[cfg_attr(feature = "v1_18", deprecated = "Since 1.18")]
305    #[allow(deprecated)]
306    #[doc(alias = "gst_base_src_new_seamless_segment")]
307    fn new_seamless_segment(&self, start: i64, stop: i64, time: i64) -> bool {
308        unsafe {
309            from_glib(ffi::gst_base_src_new_seamless_segment(
310                self.as_ref().to_glib_none().0,
311                start,
312                stop,
313                time,
314            ))
315        }
316    }
317
318    /// Prepare a new segment for emission downstream. This function must
319    /// only be called by derived sub-classes, and only from the `GstBaseSrcClass::create` function,
320    /// as the stream-lock needs to be held.
321    ///
322    /// The format for the `segment` must be identical with the current format
323    /// of the source, as configured with [`set_format()`][Self::set_format()].
324    ///
325    /// The format of `self` must not be [`gst::Format::Undefined`][crate::gst::Format::Undefined] and the format
326    /// should be configured via [`set_format()`][Self::set_format()] before calling this method.
327    /// ## `segment`
328    /// a pointer to a [`gst::Segment`][crate::gst::Segment]
329    ///
330    /// # Returns
331    ///
332    /// [`true`] if preparation of new segment succeeded.
333    #[cfg(feature = "v1_18")]
334    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
335    #[doc(alias = "gst_base_src_new_segment")]
336    fn new_segment(&self, segment: &gst::Segment) -> Result<(), glib::error::BoolError> {
337        unsafe {
338            glib::result_from_gboolean!(
339                ffi::gst_base_src_new_segment(
340                    self.as_ref().to_glib_none().0,
341                    segment.to_glib_none().0
342                ),
343                "Failed to update segment"
344            )
345        }
346    }
347
348    /// Send a new segment downstream. This function must
349    /// only be called by derived sub-classes, and only from the `GstBaseSrcClass::create` function,
350    /// as the stream-lock needs to be held.
351    /// This method also requires that an out caps has been configured, so
352    /// [`set_caps()`][Self::set_caps()] needs to have been called before.
353    ///
354    /// The format for the `segment` must be identical with the current format
355    /// of the source, as configured with [`set_format()`][Self::set_format()].
356    ///
357    /// The format of `self` must not be [`gst::Format::Undefined`][crate::gst::Format::Undefined] and the format
358    /// should be configured via [`set_format()`][Self::set_format()] before calling this method.
359    ///
360    /// This is a variant of [`new_segment()`][Self::new_segment()] sending the segment right away,
361    /// which can be useful to ensure events ordering.
362    /// ## `segment`
363    /// a pointer to a [`gst::Segment`][crate::gst::Segment]
364    ///
365    /// # Returns
366    ///
367    /// [`true`] if sending of new segment succeeded.
368    #[cfg(feature = "v1_24")]
369    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
370    #[doc(alias = "gst_base_src_push_segment")]
371    fn push_segment(&self, segment: &gst::Segment) -> bool {
372        unsafe {
373            from_glib(ffi::gst_base_src_push_segment(
374                self.as_ref().to_glib_none().0,
375                segment.to_glib_none().0,
376            ))
377        }
378    }
379
380    /// Configure async behaviour in `self`, no state change will block. The open,
381    /// close, start, stop, play and pause virtual methods will be executed in a
382    /// different thread and are thus allowed to perform blocking operations. Any
383    /// blocking operation should be unblocked with the unlock vmethod.
384    /// ## `async_`
385    /// new async mode
386    #[doc(alias = "gst_base_src_set_async")]
387    fn set_async(&self, async_: bool) {
388        unsafe {
389            ffi::gst_base_src_set_async(self.as_ref().to_glib_none().0, async_.into_glib());
390        }
391    }
392
393    /// If `automatic_eos` is [`true`], `self` will automatically go EOS if a buffer
394    /// after the total size is returned. By default this is [`true`] but sources
395    /// that can't return an authoritative size and only know that they're EOS
396    /// when trying to read more should set this to [`false`].
397    ///
398    /// When `self` operates in [`gst::Format::Time`][crate::gst::Format::Time], [`BaseSrc`][crate::BaseSrc] will send an EOS
399    /// when a buffer outside of the currently configured segment is pushed if
400    /// `automatic_eos` is [`true`]. Since 1.16, if `automatic_eos` is [`false`] an
401    /// EOS will be pushed only when the `GstBaseSrcClass::create` implementation
402    /// returns [`gst::FlowReturn::Eos`][crate::gst::FlowReturn::Eos].
403    /// ## `automatic_eos`
404    /// automatic eos
405    #[doc(alias = "gst_base_src_set_automatic_eos")]
406    #[doc(alias = "automatic-eos")]
407    fn set_automatic_eos(&self, automatic_eos: bool) {
408        unsafe {
409            ffi::gst_base_src_set_automatic_eos(
410                self.as_ref().to_glib_none().0,
411                automatic_eos.into_glib(),
412            );
413        }
414    }
415
416    /// Set the number of bytes that `self` will push out with each buffer. When
417    /// `blocksize` is set to -1, a default length will be used.
418    /// ## `blocksize`
419    /// the new blocksize in bytes
420    #[doc(alias = "gst_base_src_set_blocksize")]
421    #[doc(alias = "blocksize")]
422    fn set_blocksize(&self, blocksize: u32) {
423        unsafe {
424            ffi::gst_base_src_set_blocksize(self.as_ref().to_glib_none().0, blocksize);
425        }
426    }
427
428    /// Set new caps on the basesrc source pad.
429    /// ## `caps`
430    /// a [`gst::Caps`][crate::gst::Caps]
431    ///
432    /// # Returns
433    ///
434    /// [`true`] if the caps could be set
435    #[doc(alias = "gst_base_src_set_caps")]
436    fn set_caps(&self, caps: &gst::Caps) -> Result<(), glib::error::BoolError> {
437        unsafe {
438            glib::result_from_gboolean!(
439                ffi::gst_base_src_set_caps(self.as_ref().to_glib_none().0, caps.to_glib_none().0),
440                "Failed to set caps"
441            )
442        }
443    }
444
445    /// Configure `self` to automatically timestamp outgoing buffers based on the
446    /// current running_time of the pipeline. This property is mostly useful for live
447    /// sources.
448    /// ## `timestamp`
449    /// enable or disable timestamping
450    #[doc(alias = "gst_base_src_set_do_timestamp")]
451    #[doc(alias = "do-timestamp")]
452    fn set_do_timestamp(&self, timestamp: bool) {
453        unsafe {
454            ffi::gst_base_src_set_do_timestamp(
455                self.as_ref().to_glib_none().0,
456                timestamp.into_glib(),
457            );
458        }
459    }
460
461    /// If not `dynamic`, size is only updated when needed, such as when trying to
462    /// read past current tracked size. Otherwise, size is checked for upon each
463    /// read.
464    /// ## `dynamic`
465    /// new dynamic size mode
466    #[doc(alias = "gst_base_src_set_dynamic_size")]
467    fn set_dynamic_size(&self, dynamic: bool) {
468        unsafe {
469            ffi::gst_base_src_set_dynamic_size(self.as_ref().to_glib_none().0, dynamic.into_glib());
470        }
471    }
472
473    /// Sets the default format of the source. This will be the format used
474    /// for sending SEGMENT events and for performing seeks.
475    ///
476    /// If a format of GST_FORMAT_BYTES is set, the element will be able to
477    /// operate in pull mode if the `GstBaseSrcClass::is_seekable` returns [`true`].
478    ///
479    /// This function must only be called in states < [`gst::State::Paused`][crate::gst::State::Paused].
480    /// ## `format`
481    /// the format to use
482    #[doc(alias = "gst_base_src_set_format")]
483    fn set_format(&self, format: gst::Format) {
484        unsafe {
485            ffi::gst_base_src_set_format(self.as_ref().to_glib_none().0, format.into_glib());
486        }
487    }
488
489    /// If the element listens to a live source, `live` should
490    /// be set to [`true`].
491    ///
492    /// A live source will not produce data in the PAUSED state and
493    /// will therefore not be able to participate in the PREROLL phase
494    /// of a pipeline. To signal this fact to the application and the
495    /// pipeline, the state change return value of the live source will
496    /// be GST_STATE_CHANGE_NO_PREROLL.
497    /// ## `live`
498    /// new live-mode
499    #[doc(alias = "gst_base_src_set_live")]
500    fn set_live(&self, live: bool) {
501        unsafe {
502            ffi::gst_base_src_set_live(self.as_ref().to_glib_none().0, live.into_glib());
503        }
504    }
505
506    /// Complete an asynchronous start operation. When the subclass overrides the
507    /// start method, it should call [`start_complete()`][Self::start_complete()] when the start
508    /// operation completes either from the same thread or from an asynchronous
509    /// helper thread.
510    /// ## `ret`
511    /// a [`gst::FlowReturn`][crate::gst::FlowReturn]
512    #[doc(alias = "gst_base_src_start_complete")]
513    fn start_complete(&self, ret: impl Into<gst::FlowReturn>) {
514        unsafe {
515            ffi::gst_base_src_start_complete(
516                self.as_ref().to_glib_none().0,
517                ret.into().into_glib(),
518            );
519        }
520    }
521
522    /// Wait until the start operation completes.
523    ///
524    /// # Returns
525    ///
526    /// a [`gst::FlowReturn`][crate::gst::FlowReturn].
527    #[doc(alias = "gst_base_src_start_wait")]
528    fn start_wait(&self) -> Result<gst::FlowSuccess, gst::FlowError> {
529        unsafe { try_from_glib(ffi::gst_base_src_start_wait(self.as_ref().to_glib_none().0)) }
530    }
531
532    /// If the `GstBaseSrcClass::create` method performs its own synchronisation
533    /// against the clock it must unblock when going from PLAYING to the PAUSED state
534    /// and call this method before continuing to produce the remaining data.
535    ///
536    /// This function will block until a state change to PLAYING happens (in which
537    /// case this function returns [`gst::FlowReturn::Ok`][crate::gst::FlowReturn::Ok]) or the processing must be stopped due
538    /// to a state change to READY or a FLUSH event (in which case this function
539    /// returns [`gst::FlowReturn::Flushing`][crate::gst::FlowReturn::Flushing]).
540    ///
541    /// # Returns
542    ///
543    /// [`gst::FlowReturn::Ok`][crate::gst::FlowReturn::Ok] if `self` is PLAYING and processing can
544    /// continue. Any other return value should be returned from the create vmethod.
545    #[doc(alias = "gst_base_src_wait_playing")]
546    fn wait_playing(&self) -> Result<gst::FlowSuccess, gst::FlowError> {
547        unsafe {
548            try_from_glib(ffi::gst_base_src_wait_playing(
549                self.as_ref().to_glib_none().0,
550            ))
551        }
552    }
553
554    /// See [`set_automatic_eos()`][Self::set_automatic_eos()]
555    #[cfg(feature = "v1_24")]
556    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
557    #[doc(alias = "automatic-eos")]
558    fn is_automatic_eos(&self) -> bool {
559        ObjectExt::property(self.as_ref(), "automatic-eos")
560    }
561
562    #[doc(alias = "num-buffers")]
563    fn num_buffers(&self) -> i32 {
564        ObjectExt::property(self.as_ref(), "num-buffers")
565    }
566
567    #[doc(alias = "num-buffers")]
568    fn set_num_buffers(&self, num_buffers: i32) {
569        ObjectExt::set_property(self.as_ref(), "num-buffers", num_buffers)
570    }
571
572    fn is_typefind(&self) -> bool {
573        ObjectExt::property(self.as_ref(), "typefind")
574    }
575
576    fn set_typefind(&self, typefind: bool) {
577        ObjectExt::set_property(self.as_ref(), "typefind", typefind)
578    }
579
580    #[cfg(feature = "v1_24")]
581    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
582    #[doc(alias = "automatic-eos")]
583    fn connect_automatic_eos_notify<F: Fn(&Self) + Send + Sync + 'static>(
584        &self,
585        f: F,
586    ) -> SignalHandlerId {
587        unsafe extern "C" fn notify_automatic_eos_trampoline<
588            P: IsA<BaseSrc>,
589            F: Fn(&P) + Send + Sync + 'static,
590        >(
591            this: *mut ffi::GstBaseSrc,
592            _param_spec: glib::ffi::gpointer,
593            f: glib::ffi::gpointer,
594        ) {
595            let f: &F = &*(f as *const F);
596            f(BaseSrc::from_glib_borrow(this).unsafe_cast_ref())
597        }
598        unsafe {
599            let f: Box_<F> = Box_::new(f);
600            connect_raw(
601                self.as_ptr() as *mut _,
602                b"notify::automatic-eos\0".as_ptr() as *const _,
603                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
604                    notify_automatic_eos_trampoline::<Self, F> as *const (),
605                )),
606                Box_::into_raw(f),
607            )
608        }
609    }
610
611    #[doc(alias = "blocksize")]
612    fn connect_blocksize_notify<F: Fn(&Self) + Send + Sync + 'static>(
613        &self,
614        f: F,
615    ) -> SignalHandlerId {
616        unsafe extern "C" fn notify_blocksize_trampoline<
617            P: IsA<BaseSrc>,
618            F: Fn(&P) + Send + Sync + 'static,
619        >(
620            this: *mut ffi::GstBaseSrc,
621            _param_spec: glib::ffi::gpointer,
622            f: glib::ffi::gpointer,
623        ) {
624            let f: &F = &*(f as *const F);
625            f(BaseSrc::from_glib_borrow(this).unsafe_cast_ref())
626        }
627        unsafe {
628            let f: Box_<F> = Box_::new(f);
629            connect_raw(
630                self.as_ptr() as *mut _,
631                b"notify::blocksize\0".as_ptr() as *const _,
632                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
633                    notify_blocksize_trampoline::<Self, F> as *const (),
634                )),
635                Box_::into_raw(f),
636            )
637        }
638    }
639
640    #[doc(alias = "do-timestamp")]
641    fn connect_do_timestamp_notify<F: Fn(&Self) + Send + Sync + 'static>(
642        &self,
643        f: F,
644    ) -> SignalHandlerId {
645        unsafe extern "C" fn notify_do_timestamp_trampoline<
646            P: IsA<BaseSrc>,
647            F: Fn(&P) + Send + Sync + 'static,
648        >(
649            this: *mut ffi::GstBaseSrc,
650            _param_spec: glib::ffi::gpointer,
651            f: glib::ffi::gpointer,
652        ) {
653            let f: &F = &*(f as *const F);
654            f(BaseSrc::from_glib_borrow(this).unsafe_cast_ref())
655        }
656        unsafe {
657            let f: Box_<F> = Box_::new(f);
658            connect_raw(
659                self.as_ptr() as *mut _,
660                b"notify::do-timestamp\0".as_ptr() as *const _,
661                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
662                    notify_do_timestamp_trampoline::<Self, F> as *const (),
663                )),
664                Box_::into_raw(f),
665            )
666        }
667    }
668
669    #[doc(alias = "num-buffers")]
670    fn connect_num_buffers_notify<F: Fn(&Self) + Send + Sync + 'static>(
671        &self,
672        f: F,
673    ) -> SignalHandlerId {
674        unsafe extern "C" fn notify_num_buffers_trampoline<
675            P: IsA<BaseSrc>,
676            F: Fn(&P) + Send + Sync + 'static,
677        >(
678            this: *mut ffi::GstBaseSrc,
679            _param_spec: glib::ffi::gpointer,
680            f: glib::ffi::gpointer,
681        ) {
682            let f: &F = &*(f as *const F);
683            f(BaseSrc::from_glib_borrow(this).unsafe_cast_ref())
684        }
685        unsafe {
686            let f: Box_<F> = Box_::new(f);
687            connect_raw(
688                self.as_ptr() as *mut _,
689                b"notify::num-buffers\0".as_ptr() as *const _,
690                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
691                    notify_num_buffers_trampoline::<Self, F> as *const (),
692                )),
693                Box_::into_raw(f),
694            )
695        }
696    }
697
698    #[doc(alias = "typefind")]
699    fn connect_typefind_notify<F: Fn(&Self) + Send + Sync + 'static>(
700        &self,
701        f: F,
702    ) -> SignalHandlerId {
703        unsafe extern "C" fn notify_typefind_trampoline<
704            P: IsA<BaseSrc>,
705            F: Fn(&P) + Send + Sync + 'static,
706        >(
707            this: *mut ffi::GstBaseSrc,
708            _param_spec: glib::ffi::gpointer,
709            f: glib::ffi::gpointer,
710        ) {
711            let f: &F = &*(f as *const F);
712            f(BaseSrc::from_glib_borrow(this).unsafe_cast_ref())
713        }
714        unsafe {
715            let f: Box_<F> = Box_::new(f);
716            connect_raw(
717                self.as_ptr() as *mut _,
718                b"notify::typefind\0".as_ptr() as *const _,
719                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
720                    notify_typefind_trampoline::<Self, F> as *const (),
721                )),
722                Box_::into_raw(f),
723            )
724        }
725    }
726}
727
728impl<O: IsA<BaseSrc>> BaseSrcExt for O {}