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
193/// Trait containing all [`struct@BaseSrc`] methods.
194///
195/// # Implementors
196///
197/// [`BaseSrc`][struct@crate::BaseSrc], [`PushSrc`][struct@crate::PushSrc]
198pub trait BaseSrcExt: IsA<BaseSrc> + 'static {
199 /// Get the number of bytes that `self` will push out with each buffer.
200 ///
201 /// # Returns
202 ///
203 /// the number of bytes pushed with each buffer.
204 #[doc(alias = "gst_base_src_get_blocksize")]
205 #[doc(alias = "get_blocksize")]
206 fn blocksize(&self) -> u32 {
207 unsafe { ffi::gst_base_src_get_blocksize(self.as_ref().to_glib_none().0) }
208 }
209
210 ///
211 /// # Returns
212 ///
213 /// the instance of the [`gst::BufferPool`][crate::gst::BufferPool] used
214 /// by the src; unref it after usage.
215 #[doc(alias = "gst_base_src_get_buffer_pool")]
216 #[doc(alias = "get_buffer_pool")]
217 fn buffer_pool(&self) -> Option<gst::BufferPool> {
218 unsafe {
219 from_glib_full(ffi::gst_base_src_get_buffer_pool(
220 self.as_ref().to_glib_none().0,
221 ))
222 }
223 }
224
225 /// Query if `self` timestamps outgoing buffers based on the current running_time.
226 ///
227 /// # Returns
228 ///
229 /// [`true`] if the base class will automatically timestamp outgoing buffers.
230 #[doc(alias = "gst_base_src_get_do_timestamp")]
231 #[doc(alias = "get_do_timestamp")]
232 #[doc(alias = "do-timestamp")]
233 fn does_timestamp(&self) -> bool {
234 unsafe {
235 from_glib(ffi::gst_base_src_get_do_timestamp(
236 self.as_ref().to_glib_none().0,
237 ))
238 }
239 }
240
241 /// Get the current async behaviour of `self`. See also [`set_async()`][Self::set_async()].
242 ///
243 /// # Returns
244 ///
245 /// [`true`] if `self` is operating in async mode.
246 #[doc(alias = "gst_base_src_is_async")]
247 fn is_async(&self) -> bool {
248 unsafe { from_glib(ffi::gst_base_src_is_async(self.as_ref().to_glib_none().0)) }
249 }
250
251 /// Check if an element is in live mode.
252 ///
253 /// # Returns
254 ///
255 /// [`true`] if element is in live mode.
256 #[doc(alias = "gst_base_src_is_live")]
257 fn is_live(&self) -> bool {
258 unsafe { from_glib(ffi::gst_base_src_is_live(self.as_ref().to_glib_none().0)) }
259 }
260
261 /// Negotiates src pad caps with downstream elements.
262 /// Unmarks GST_PAD_FLAG_NEED_RECONFIGURE in any case. But marks it again
263 /// if `GstBaseSrcClass::negotiate` fails.
264 ///
265 /// Do not call this in the `GstBaseSrcClass::fill` vmethod. Call this in
266 /// `GstBaseSrcClass::create` or in `GstBaseSrcClass::alloc`, _before_ any
267 /// buffer is allocated.
268 ///
269 /// # Returns
270 ///
271 /// [`true`] if the negotiation succeeded, else [`false`].
272 #[cfg(feature = "v1_18")]
273 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
274 #[doc(alias = "gst_base_src_negotiate")]
275 fn negotiate(&self) -> bool {
276 unsafe { from_glib(ffi::gst_base_src_negotiate(self.as_ref().to_glib_none().0)) }
277 }
278
279 /// Prepare a new seamless segment for emission downstream. This function must
280 /// only be called by derived sub-classes, and only from the `GstBaseSrcClass::create` function,
281 /// as the stream-lock needs to be held.
282 ///
283 /// The format for the new segment will be the current format of the source, as
284 /// configured with [`set_format()`][Self::set_format()]
285 ///
286 /// # Deprecated since 1.18
287 ///
288 /// Use [`new_segment()`][Self::new_segment()]
289 /// ## `start`
290 /// The new start value for the segment
291 /// ## `stop`
292 /// Stop value for the new segment
293 /// ## `time`
294 /// The new time value for the start of the new segment
295 ///
296 /// # Returns
297 ///
298 /// [`true`] if preparation of the seamless segment succeeded.
299 #[cfg_attr(feature = "v1_18", deprecated = "Since 1.18")]
300 #[allow(deprecated)]
301 #[doc(alias = "gst_base_src_new_seamless_segment")]
302 fn new_seamless_segment(&self, start: i64, stop: i64, time: i64) -> bool {
303 unsafe {
304 from_glib(ffi::gst_base_src_new_seamless_segment(
305 self.as_ref().to_glib_none().0,
306 start,
307 stop,
308 time,
309 ))
310 }
311 }
312
313 /// Prepare a new segment for emission downstream. This function must
314 /// only be called by derived sub-classes, and only from the `GstBaseSrcClass::create` function,
315 /// as the stream-lock needs to be held.
316 ///
317 /// The format for the `segment` must be identical with the current format
318 /// of the source, as configured with [`set_format()`][Self::set_format()].
319 ///
320 /// The format of `self` must not be [`gst::Format::Undefined`][crate::gst::Format::Undefined] and the format
321 /// should be configured via [`set_format()`][Self::set_format()] before calling this method.
322 /// ## `segment`
323 /// a pointer to a [`gst::Segment`][crate::gst::Segment]
324 ///
325 /// # Returns
326 ///
327 /// [`true`] if preparation of new segment succeeded.
328 #[cfg(feature = "v1_18")]
329 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
330 #[doc(alias = "gst_base_src_new_segment")]
331 fn new_segment(&self, segment: &gst::Segment) -> Result<(), glib::error::BoolError> {
332 unsafe {
333 glib::result_from_gboolean!(
334 ffi::gst_base_src_new_segment(
335 self.as_ref().to_glib_none().0,
336 segment.to_glib_none().0
337 ),
338 "Failed to update segment"
339 )
340 }
341 }
342
343 /// Send a new segment downstream. This function must
344 /// only be called by derived sub-classes, and only from the `GstBaseSrcClass::create` function,
345 /// as the stream-lock needs to be held.
346 /// This method also requires that an out caps has been configured, so
347 /// [`set_caps()`][Self::set_caps()] needs to have been called before.
348 ///
349 /// The format for the `segment` must be identical with the current format
350 /// of the source, as configured with [`set_format()`][Self::set_format()].
351 ///
352 /// The format of `self` must not be [`gst::Format::Undefined`][crate::gst::Format::Undefined] and the format
353 /// should be configured via [`set_format()`][Self::set_format()] before calling this method.
354 ///
355 /// This is a variant of [`new_segment()`][Self::new_segment()] sending the segment right away,
356 /// which can be useful to ensure events ordering.
357 /// ## `segment`
358 /// a pointer to a [`gst::Segment`][crate::gst::Segment]
359 ///
360 /// # Returns
361 ///
362 /// [`true`] if sending of new segment succeeded.
363 #[cfg(feature = "v1_24")]
364 #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
365 #[doc(alias = "gst_base_src_push_segment")]
366 fn push_segment(&self, segment: &gst::Segment) -> bool {
367 unsafe {
368 from_glib(ffi::gst_base_src_push_segment(
369 self.as_ref().to_glib_none().0,
370 segment.to_glib_none().0,
371 ))
372 }
373 }
374
375 /// Configure async behaviour in `self`, no state change will block. The open,
376 /// close, start, stop, play and pause virtual methods will be executed in a
377 /// different thread and are thus allowed to perform blocking operations. Any
378 /// blocking operation should be unblocked with the unlock vmethod.
379 /// ## `async_`
380 /// new async mode
381 #[doc(alias = "gst_base_src_set_async")]
382 fn set_async(&self, async_: bool) {
383 unsafe {
384 ffi::gst_base_src_set_async(self.as_ref().to_glib_none().0, async_.into_glib());
385 }
386 }
387
388 /// If `automatic_eos` is [`true`], `self` will automatically go EOS if a buffer
389 /// after the total size is returned. By default this is [`true`] but sources
390 /// that can't return an authoritative size and only know that they're EOS
391 /// when trying to read more should set this to [`false`].
392 ///
393 /// When `self` operates in [`gst::Format::Time`][crate::gst::Format::Time], [`BaseSrc`][crate::BaseSrc] will send an EOS
394 /// when a buffer outside of the currently configured segment is pushed if
395 /// `automatic_eos` is [`true`]. Since 1.16, if `automatic_eos` is [`false`] an
396 /// EOS will be pushed only when the `GstBaseSrcClass::create` implementation
397 /// returns [`gst::FlowReturn::Eos`][crate::gst::FlowReturn::Eos].
398 /// ## `automatic_eos`
399 /// automatic eos
400 #[doc(alias = "gst_base_src_set_automatic_eos")]
401 #[doc(alias = "automatic-eos")]
402 fn set_automatic_eos(&self, automatic_eos: bool) {
403 unsafe {
404 ffi::gst_base_src_set_automatic_eos(
405 self.as_ref().to_glib_none().0,
406 automatic_eos.into_glib(),
407 );
408 }
409 }
410
411 /// Set the number of bytes that `self` will push out with each buffer. When
412 /// `blocksize` is set to -1, a default length will be used.
413 /// ## `blocksize`
414 /// the new blocksize in bytes
415 #[doc(alias = "gst_base_src_set_blocksize")]
416 #[doc(alias = "blocksize")]
417 fn set_blocksize(&self, blocksize: u32) {
418 unsafe {
419 ffi::gst_base_src_set_blocksize(self.as_ref().to_glib_none().0, blocksize);
420 }
421 }
422
423 /// Set new caps on the basesrc source pad.
424 /// ## `caps`
425 /// a [`gst::Caps`][crate::gst::Caps]
426 ///
427 /// # Returns
428 ///
429 /// [`true`] if the caps could be set
430 #[doc(alias = "gst_base_src_set_caps")]
431 fn set_caps(&self, caps: &gst::Caps) -> Result<(), glib::error::BoolError> {
432 unsafe {
433 glib::result_from_gboolean!(
434 ffi::gst_base_src_set_caps(self.as_ref().to_glib_none().0, caps.to_glib_none().0),
435 "Failed to set caps"
436 )
437 }
438 }
439
440 /// Configure `self` to automatically timestamp outgoing buffers based on the
441 /// current running_time of the pipeline. This property is mostly useful for live
442 /// sources.
443 /// ## `timestamp`
444 /// enable or disable timestamping
445 #[doc(alias = "gst_base_src_set_do_timestamp")]
446 #[doc(alias = "do-timestamp")]
447 fn set_do_timestamp(&self, timestamp: bool) {
448 unsafe {
449 ffi::gst_base_src_set_do_timestamp(
450 self.as_ref().to_glib_none().0,
451 timestamp.into_glib(),
452 );
453 }
454 }
455
456 /// If not `dynamic`, size is only updated when needed, such as when trying to
457 /// read past current tracked size. Otherwise, size is checked for upon each
458 /// read.
459 /// ## `dynamic`
460 /// new dynamic size mode
461 #[doc(alias = "gst_base_src_set_dynamic_size")]
462 fn set_dynamic_size(&self, dynamic: bool) {
463 unsafe {
464 ffi::gst_base_src_set_dynamic_size(self.as_ref().to_glib_none().0, dynamic.into_glib());
465 }
466 }
467
468 /// Sets the default format of the source. This will be the format used
469 /// for sending SEGMENT events and for performing seeks.
470 ///
471 /// If a format of GST_FORMAT_BYTES is set, the element will be able to
472 /// operate in pull mode if the `GstBaseSrcClass::is_seekable` returns [`true`].
473 ///
474 /// This function must only be called in states < [`gst::State::Paused`][crate::gst::State::Paused].
475 /// ## `format`
476 /// the format to use
477 #[doc(alias = "gst_base_src_set_format")]
478 fn set_format(&self, format: gst::Format) {
479 unsafe {
480 ffi::gst_base_src_set_format(self.as_ref().to_glib_none().0, format.into_glib());
481 }
482 }
483
484 /// If the element listens to a live source, `live` should
485 /// be set to [`true`].
486 ///
487 /// A live source will not produce data in the PAUSED state and
488 /// will therefore not be able to participate in the PREROLL phase
489 /// of a pipeline. To signal this fact to the application and the
490 /// pipeline, the state change return value of the live source will
491 /// be GST_STATE_CHANGE_NO_PREROLL.
492 /// ## `live`
493 /// new live-mode
494 #[doc(alias = "gst_base_src_set_live")]
495 fn set_live(&self, live: bool) {
496 unsafe {
497 ffi::gst_base_src_set_live(self.as_ref().to_glib_none().0, live.into_glib());
498 }
499 }
500
501 /// Complete an asynchronous start operation. When the subclass overrides the
502 /// start method, it should call [`start_complete()`][Self::start_complete()] when the start
503 /// operation completes either from the same thread or from an asynchronous
504 /// helper thread.
505 /// ## `ret`
506 /// a [`gst::FlowReturn`][crate::gst::FlowReturn]
507 #[doc(alias = "gst_base_src_start_complete")]
508 fn start_complete(&self, ret: impl Into<gst::FlowReturn>) {
509 unsafe {
510 ffi::gst_base_src_start_complete(
511 self.as_ref().to_glib_none().0,
512 ret.into().into_glib(),
513 );
514 }
515 }
516
517 /// Wait until the start operation completes.
518 ///
519 /// # Returns
520 ///
521 /// a [`gst::FlowReturn`][crate::gst::FlowReturn].
522 #[doc(alias = "gst_base_src_start_wait")]
523 fn start_wait(&self) -> Result<gst::FlowSuccess, gst::FlowError> {
524 unsafe { try_from_glib(ffi::gst_base_src_start_wait(self.as_ref().to_glib_none().0)) }
525 }
526
527 /// If the `GstBaseSrcClass::create` method performs its own synchronisation
528 /// against the clock it must unblock when going from PLAYING to the PAUSED state
529 /// and call this method before continuing to produce the remaining data.
530 ///
531 /// This function will block until a state change to PLAYING happens (in which
532 /// case this function returns [`gst::FlowReturn::Ok`][crate::gst::FlowReturn::Ok]) or the processing must be stopped due
533 /// to a state change to READY or a FLUSH event (in which case this function
534 /// returns [`gst::FlowReturn::Flushing`][crate::gst::FlowReturn::Flushing]).
535 ///
536 /// # Returns
537 ///
538 /// [`gst::FlowReturn::Ok`][crate::gst::FlowReturn::Ok] if `self` is PLAYING and processing can
539 /// continue. Any other return value should be returned from the create vmethod.
540 #[doc(alias = "gst_base_src_wait_playing")]
541 fn wait_playing(&self) -> Result<gst::FlowSuccess, gst::FlowError> {
542 unsafe {
543 try_from_glib(ffi::gst_base_src_wait_playing(
544 self.as_ref().to_glib_none().0,
545 ))
546 }
547 }
548
549 /// See [`set_automatic_eos()`][Self::set_automatic_eos()]
550 #[cfg(feature = "v1_24")]
551 #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
552 #[doc(alias = "automatic-eos")]
553 fn is_automatic_eos(&self) -> bool {
554 ObjectExt::property(self.as_ref(), "automatic-eos")
555 }
556
557 #[doc(alias = "num-buffers")]
558 fn num_buffers(&self) -> i32 {
559 ObjectExt::property(self.as_ref(), "num-buffers")
560 }
561
562 #[doc(alias = "num-buffers")]
563 fn set_num_buffers(&self, num_buffers: i32) {
564 ObjectExt::set_property(self.as_ref(), "num-buffers", num_buffers)
565 }
566
567 fn is_typefind(&self) -> bool {
568 ObjectExt::property(self.as_ref(), "typefind")
569 }
570
571 fn set_typefind(&self, typefind: bool) {
572 ObjectExt::set_property(self.as_ref(), "typefind", typefind)
573 }
574
575 #[cfg(feature = "v1_24")]
576 #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
577 #[doc(alias = "automatic-eos")]
578 fn connect_automatic_eos_notify<F: Fn(&Self) + Send + Sync + 'static>(
579 &self,
580 f: F,
581 ) -> SignalHandlerId {
582 unsafe extern "C" fn notify_automatic_eos_trampoline<
583 P: IsA<BaseSrc>,
584 F: Fn(&P) + Send + Sync + 'static,
585 >(
586 this: *mut ffi::GstBaseSrc,
587 _param_spec: glib::ffi::gpointer,
588 f: glib::ffi::gpointer,
589 ) {
590 let f: &F = &*(f as *const F);
591 f(BaseSrc::from_glib_borrow(this).unsafe_cast_ref())
592 }
593 unsafe {
594 let f: Box_<F> = Box_::new(f);
595 connect_raw(
596 self.as_ptr() as *mut _,
597 c"notify::automatic-eos".as_ptr() as *const _,
598 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
599 notify_automatic_eos_trampoline::<Self, F> as *const (),
600 )),
601 Box_::into_raw(f),
602 )
603 }
604 }
605
606 #[doc(alias = "blocksize")]
607 fn connect_blocksize_notify<F: Fn(&Self) + Send + Sync + 'static>(
608 &self,
609 f: F,
610 ) -> SignalHandlerId {
611 unsafe extern "C" fn notify_blocksize_trampoline<
612 P: IsA<BaseSrc>,
613 F: Fn(&P) + Send + Sync + 'static,
614 >(
615 this: *mut ffi::GstBaseSrc,
616 _param_spec: glib::ffi::gpointer,
617 f: glib::ffi::gpointer,
618 ) {
619 let f: &F = &*(f as *const F);
620 f(BaseSrc::from_glib_borrow(this).unsafe_cast_ref())
621 }
622 unsafe {
623 let f: Box_<F> = Box_::new(f);
624 connect_raw(
625 self.as_ptr() as *mut _,
626 c"notify::blocksize".as_ptr() as *const _,
627 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
628 notify_blocksize_trampoline::<Self, F> as *const (),
629 )),
630 Box_::into_raw(f),
631 )
632 }
633 }
634
635 #[doc(alias = "do-timestamp")]
636 fn connect_do_timestamp_notify<F: Fn(&Self) + Send + Sync + 'static>(
637 &self,
638 f: F,
639 ) -> SignalHandlerId {
640 unsafe extern "C" fn notify_do_timestamp_trampoline<
641 P: IsA<BaseSrc>,
642 F: Fn(&P) + Send + Sync + 'static,
643 >(
644 this: *mut ffi::GstBaseSrc,
645 _param_spec: glib::ffi::gpointer,
646 f: glib::ffi::gpointer,
647 ) {
648 let f: &F = &*(f as *const F);
649 f(BaseSrc::from_glib_borrow(this).unsafe_cast_ref())
650 }
651 unsafe {
652 let f: Box_<F> = Box_::new(f);
653 connect_raw(
654 self.as_ptr() as *mut _,
655 c"notify::do-timestamp".as_ptr() as *const _,
656 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
657 notify_do_timestamp_trampoline::<Self, F> as *const (),
658 )),
659 Box_::into_raw(f),
660 )
661 }
662 }
663
664 #[doc(alias = "num-buffers")]
665 fn connect_num_buffers_notify<F: Fn(&Self) + Send + Sync + 'static>(
666 &self,
667 f: F,
668 ) -> SignalHandlerId {
669 unsafe extern "C" fn notify_num_buffers_trampoline<
670 P: IsA<BaseSrc>,
671 F: Fn(&P) + Send + Sync + 'static,
672 >(
673 this: *mut ffi::GstBaseSrc,
674 _param_spec: glib::ffi::gpointer,
675 f: glib::ffi::gpointer,
676 ) {
677 let f: &F = &*(f as *const F);
678 f(BaseSrc::from_glib_borrow(this).unsafe_cast_ref())
679 }
680 unsafe {
681 let f: Box_<F> = Box_::new(f);
682 connect_raw(
683 self.as_ptr() as *mut _,
684 c"notify::num-buffers".as_ptr() as *const _,
685 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
686 notify_num_buffers_trampoline::<Self, F> as *const (),
687 )),
688 Box_::into_raw(f),
689 )
690 }
691 }
692
693 #[doc(alias = "typefind")]
694 fn connect_typefind_notify<F: Fn(&Self) + Send + Sync + 'static>(
695 &self,
696 f: F,
697 ) -> SignalHandlerId {
698 unsafe extern "C" fn notify_typefind_trampoline<
699 P: IsA<BaseSrc>,
700 F: Fn(&P) + Send + Sync + 'static,
701 >(
702 this: *mut ffi::GstBaseSrc,
703 _param_spec: glib::ffi::gpointer,
704 f: glib::ffi::gpointer,
705 ) {
706 let f: &F = &*(f as *const F);
707 f(BaseSrc::from_glib_borrow(this).unsafe_cast_ref())
708 }
709 unsafe {
710 let f: Box_<F> = Box_::new(f);
711 connect_raw(
712 self.as_ptr() as *mut _,
713 c"notify::typefind".as_ptr() as *const _,
714 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
715 notify_typefind_trampoline::<Self, F> as *const (),
716 )),
717 Box_::into_raw(f),
718 )
719 }
720 }
721}
722
723impl<O: IsA<BaseSrc>> BaseSrcExt for O {}