gstreamer/auto/
bin.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
6use crate::{ffi, ChildProxy, Element, ElementFlags, Object, Pad, PadDirection};
7use glib::{
8    object::ObjectType as _,
9    prelude::*,
10    signal::{connect_raw, SignalHandlerId},
11    translate::*,
12};
13use std::boxed::Box as Box_;
14
15glib::wrapper! {
16    /// [`Bin`][crate::Bin] is an element that can contain other [`Element`][crate::Element], allowing them to be
17    /// managed as a group.
18    /// Pads from the child elements can be ghosted to the bin, see [`GhostPad`][crate::GhostPad].
19    /// This makes the bin look like any other elements and enables creation of
20    /// higher-level abstraction elements.
21    ///
22    /// A new [`Bin`][crate::Bin] is created with [`new()`][Self::new()]. Use a [`Pipeline`][crate::Pipeline] instead if you
23    /// want to create a toplevel bin because a normal bin doesn't have a bus or
24    /// handle clock distribution of its own.
25    ///
26    /// After the bin has been created you will typically add elements to it with
27    /// [`GstBinExt::add()`][crate::prelude::GstBinExt::add()]. You can remove elements with [`GstBinExt::remove()`][crate::prelude::GstBinExt::remove()].
28    ///
29    /// An element can be retrieved from a bin with [`GstBinExt::by_name()`][crate::prelude::GstBinExt::by_name()], using the
30    /// elements name. [`GstBinExt::by_name_recurse_up()`][crate::prelude::GstBinExt::by_name_recurse_up()] is mainly used for internal
31    /// purposes and will query the parent bins when the element is not found in the
32    /// current bin.
33    ///
34    /// An iterator of elements in a bin can be retrieved with
35    /// [`GstBinExtManual::iterate_elements()`][crate::prelude::GstBinExtManual::iterate_elements()]. Various other iterators exist to retrieve the
36    /// elements in a bin.
37    ///
38    /// `gst_object_unref()` is used to drop your reference to the bin.
39    ///
40    /// The [`element-added`][struct@crate::Bin#element-added] signal is fired whenever a new element is added to
41    /// the bin. Likewise the [`element-removed`][struct@crate::Bin#element-removed] signal is fired whenever an
42    /// element is removed from the bin.
43    ///
44    /// A [`Bin`][crate::Bin] internally intercepts every [`Message`][crate::Message] posted by its children and
45    /// implements the following default behaviour for each of them:
46    ///
47    /// * `GST_MESSAGE_EOS`: This message is only posted by sinks in the PLAYING
48    /// state. If all sinks posted the EOS message, this bin will post and EOS
49    /// message upwards.
50    ///
51    /// * `GST_MESSAGE_SEGMENT_START`: Just collected and never forwarded upwards.
52    ///  The messages are used to decide when all elements have completed playback
53    ///  of their segment.
54    ///
55    /// * `GST_MESSAGE_SEGMENT_DONE`: Is posted by [`Bin`][crate::Bin] when all elements that posted
56    ///  a SEGMENT_START have posted a SEGMENT_DONE.
57    ///
58    /// * `GST_MESSAGE_DURATION_CHANGED`: Is posted by an element that detected a change
59    ///  in the stream duration. The duration change is posted to the
60    ///  application so that it can refetch the new duration with a duration
61    ///  query.
62    ///
63    ///  Note that these messages can be posted before the bin is prerolled, in which
64    ///  case the duration query might fail.
65    ///
66    ///  Note also that there might be a discrepancy (due to internal buffering/queueing)
67    ///  between the stream being currently displayed and the returned duration query.
68    ///
69    ///  Applications might want to also query for duration (and changes) by
70    ///  listening to the `GST_MESSAGE_STREAM_START` message, signaling the active start
71    ///  of a (new) stream.
72    ///
73    /// * `GST_MESSAGE_CLOCK_LOST`: This message is posted by an element when it
74    ///  can no longer provide a clock.
75    ///
76    ///  The default bin behaviour is to check if the lost clock was the one provided
77    ///  by the bin. If so and the bin is currently in the PLAYING state, the message
78    ///  is forwarded to the bin parent.
79    ///
80    ///  This message is also generated when a clock provider is removed from
81    ///  the bin. If this message is received by the application, it should
82    ///  PAUSE the pipeline and set it back to PLAYING to force a new clock
83    ///  distribution.
84    ///
85    /// * `GST_MESSAGE_CLOCK_PROVIDE`: This message is generated when an element
86    ///  can provide a clock. This mostly happens when a new clock
87    ///  provider is added to the bin.
88    ///
89    ///  The default behaviour of the bin is to mark the currently selected clock as
90    ///  dirty, which will perform a clock recalculation the next time the bin is
91    ///  asked to provide a clock.
92    ///
93    ///  This message is never sent to the application but is forwarded to
94    ///  the parent of the bin.
95    ///
96    /// * OTHERS: posted upwards.
97    ///
98    /// A [`Bin`][crate::Bin] implements the following default behaviour for answering to a
99    /// [`Query`][crate::Query]:
100    ///
101    /// * `GST_QUERY_DURATION`: The bin will forward the query to all sink
102    ///  elements contained within and will return the maximum value.
103    ///  If no sinks are available in the bin, the query fails.
104    ///
105    /// * `GST_QUERY_POSITION`: The query is sent to all sink elements in the bin and the
106    ///  MAXIMUM of all values is returned. If no sinks are available in the bin,
107    ///  the query fails.
108    ///
109    /// * OTHERS: the query is forwarded to all sink elements, the result
110    ///  of the first sink that answers the query successfully is returned. If no
111    ///  sink is in the bin, the query fails.
112    ///
113    /// A [`Bin`][crate::Bin] will by default forward any event sent to it to all sink
114    /// ( [`EventTypeFlags::UPSTREAM`][crate::EventTypeFlags::UPSTREAM] ) or source ( [`EventTypeFlags::DOWNSTREAM`][crate::EventTypeFlags::DOWNSTREAM] ) elements
115    /// depending on the event type.
116    ///
117    /// If all the elements return [`true`], the bin will also return [`true`], else [`false`]
118    /// is returned. If no elements of the required type are in the bin, the event
119    /// handler will return [`true`].
120    ///
121    /// ## Properties
122    ///
123    ///
124    /// #### `async-handling`
125    ///  If set to [`true`], the bin will handle asynchronous state changes.
126    /// This should be used only if the bin subclass is modifying the state
127    /// of its children on its own.
128    ///
129    /// Readable | Writeable
130    ///
131    ///
132    /// #### `message-forward`
133    ///  Forward all children messages, even those that would normally be filtered by
134    /// the bin. This can be interesting when one wants to be notified of the EOS
135    /// state of individual elements, for example.
136    ///
137    /// The messages are converted to an ELEMENT message with the bin as the
138    /// source. The structure of the message is named `GstBinForwarded` and contains
139    /// a field named `message` that contains the original forwarded [`Message`][crate::Message].
140    ///
141    /// Readable | Writeable
142    /// <details><summary><h4>Object</h4></summary>
143    ///
144    ///
145    /// #### `name`
146    ///  Readable | Writeable | Construct
147    ///
148    ///
149    /// #### `parent`
150    ///  The parent of the object. Please note, that when changing the 'parent'
151    /// property, we don't emit [`notify`][struct@crate::glib::Object#notify] and [`deep-notify`][struct@crate::Object#deep-notify]
152    /// signals due to locking issues. In some cases one can use
153    /// [`element-added`][struct@crate::Bin#element-added] or [`element-removed`][struct@crate::Bin#element-removed] signals on the parent to
154    /// achieve a similar effect.
155    ///
156    /// Readable | Writeable
157    /// </details>
158    ///
159    /// ## Signals
160    ///
161    ///
162    /// #### `deep-element-added`
163    ///  Will be emitted after the element was added to `sub_bin`.
164    ///
165    ///
166    ///
167    ///
168    /// #### `deep-element-removed`
169    ///  Will be emitted after the element was removed from `sub_bin`.
170    ///
171    ///
172    ///
173    ///
174    /// #### `do-latency`
175    ///  Will be emitted when the bin needs to perform latency calculations. This
176    /// signal is only emitted for toplevel bins or when [`async-handling`][struct@crate::Bin#async-handling] is
177    /// enabled.
178    ///
179    /// Only one signal handler is invoked. If no signals are connected, the
180    /// default handler is invoked, which will query and distribute the lowest
181    /// possible latency to all sinks.
182    ///
183    /// Connect to this signal if the default latency calculations are not
184    /// sufficient, like when you need different latencies for different sinks in
185    /// the same pipeline.
186    ///
187    ///
188    ///
189    ///
190    /// #### `element-added`
191    ///  Will be emitted after the element was added to the bin.
192    ///
193    ///
194    ///
195    ///
196    /// #### `element-removed`
197    ///  Will be emitted after the element was removed from the bin.
198    ///
199    ///
200    /// <details><summary><h4>Element</h4></summary>
201    ///
202    ///
203    /// #### `no-more-pads`
204    ///  This signals that the element will not generate more dynamic pads.
205    /// Note that this signal will usually be emitted from the context of
206    /// the streaming thread.
207    ///
208    ///
209    ///
210    ///
211    /// #### `pad-added`
212    ///  a new [`Pad`][crate::Pad] has been added to the element. Note that this signal will
213    /// usually be emitted from the context of the streaming thread. Also keep in
214    /// mind that if you add new elements to the pipeline in the signal handler
215    /// you will need to set them to the desired target state with
216    /// [`ElementExt::set_state()`][crate::prelude::ElementExt::set_state()] or [`ElementExt::sync_state_with_parent()`][crate::prelude::ElementExt::sync_state_with_parent()].
217    ///
218    ///
219    ///
220    ///
221    /// #### `pad-removed`
222    ///  a [`Pad`][crate::Pad] has been removed from the element
223    ///
224    ///
225    /// </details>
226    /// <details><summary><h4>Object</h4></summary>
227    ///
228    ///
229    /// #### `deep-notify`
230    ///  The deep notify signal is used to be notified of property changes. It is
231    /// typically attached to the toplevel bin to receive notifications from all
232    /// the elements contained in that bin.
233    ///
234    /// Detailed
235    /// </details>
236    /// <details><summary><h4>ChildProxy</h4></summary>
237    ///
238    ///
239    /// #### `child-added`
240    ///  Will be emitted after the `object` was added to the `child_proxy`.
241    ///
242    ///
243    ///
244    ///
245    /// #### `child-removed`
246    ///  Will be emitted after the `object` was removed from the `child_proxy`.
247    ///
248    ///
249    /// </details>
250    ///
251    /// # Implements
252    ///
253    /// [`GstBinExt`][trait@crate::prelude::GstBinExt], [`ElementExt`][trait@crate::prelude::ElementExt], [`GstObjectExt`][trait@crate::prelude::GstObjectExt], [`trait@glib::ObjectExt`], [`ChildProxyExt`][trait@crate::prelude::ChildProxyExt], [`ElementExtManual`][trait@crate::prelude::ElementExtManual], [`ChildProxyExtManual`][trait@crate::prelude::ChildProxyExtManual]
254    #[doc(alias = "GstBin")]
255    pub struct Bin(Object<ffi::GstBin, ffi::GstBinClass>) @extends Element, Object, @implements ChildProxy;
256
257    match fn {
258        type_ => || ffi::gst_bin_get_type(),
259    }
260}
261
262impl Bin {
263    pub const NONE: Option<&'static Bin> = None;
264}
265
266unsafe impl Send for Bin {}
267unsafe impl Sync for Bin {}
268
269mod sealed {
270    pub trait Sealed {}
271    impl<T: super::IsA<super::Bin>> Sealed for T {}
272}
273
274/// Trait containing all [`struct@Bin`] methods.
275///
276/// # Implementors
277///
278/// [`Bin`][struct@crate::Bin], [`Pipeline`][struct@crate::Pipeline]
279pub trait GstBinExt: IsA<Bin> + sealed::Sealed + 'static {
280    /// Adds the given element to the bin. Sets the element's parent, and thus
281    /// takes ownership of the element. An element can only be added to one bin.
282    ///
283    /// If the element's pads are linked to other pads, the pads will be unlinked
284    /// before the element is added to the bin.
285    ///
286    /// > When you add an element to an already-running pipeline, you will have to
287    /// > take care to set the state of the newly-added element to the desired
288    /// > state (usually PLAYING or PAUSED, same you set the pipeline to originally)
289    /// > with [`ElementExt::set_state()`][crate::prelude::ElementExt::set_state()], or use [`ElementExt::sync_state_with_parent()`][crate::prelude::ElementExt::sync_state_with_parent()].
290    /// > The bin or pipeline will not take care of this for you.
291    /// ## `element`
292    /// the [`Element`][crate::Element] to add
293    ///
294    /// # Returns
295    ///
296    /// [`true`] if the element could be added, [`false`] if
297    /// the bin does not want to accept the element.
298    #[doc(alias = "gst_bin_add")]
299    fn add(&self, element: &impl IsA<Element>) -> Result<(), glib::error::BoolError> {
300        unsafe {
301            glib::result_from_gboolean!(
302                ffi::gst_bin_add(
303                    self.as_ref().to_glib_none().0,
304                    element.as_ref().to_glib_none().0
305                ),
306                "Failed to add element"
307            )
308        }
309    }
310
311    /// Recursively looks for elements with an unlinked pad of the given
312    /// direction within the specified bin and returns an unlinked pad
313    /// if one is found, or [`None`] otherwise. If a pad is found, the caller
314    /// owns a reference to it and should use `gst_object_unref()` on the
315    /// pad when it is not needed any longer.
316    /// ## `direction`
317    /// whether to look for an unlinked source or sink pad
318    ///
319    /// # Returns
320    ///
321    /// unlinked pad of the given
322    /// direction.
323    #[doc(alias = "gst_bin_find_unlinked_pad")]
324    fn find_unlinked_pad(&self, direction: PadDirection) -> Option<Pad> {
325        unsafe {
326            from_glib_full(ffi::gst_bin_find_unlinked_pad(
327                self.as_ref().to_glib_none().0,
328                direction.into_glib(),
329            ))
330        }
331    }
332
333    /// Looks for an element inside the bin that implements the given
334    /// interface. If such an element is found, it returns the element.
335    /// You can cast this element to the given interface afterwards. If you want
336    /// all elements that implement the interface, use
337    /// [`GstBinExtManual::iterate_all_by_interface()`][crate::prelude::GstBinExtManual::iterate_all_by_interface()]. This function recurses into child bins.
338    /// ## `iface`
339    /// the `GType` of an interface
340    ///
341    /// # Returns
342    ///
343    /// A [`Element`][crate::Element] inside the bin
344    /// implementing the interface
345    #[doc(alias = "gst_bin_get_by_interface")]
346    #[doc(alias = "get_by_interface")]
347    fn by_interface(&self, iface: glib::types::Type) -> Option<Element> {
348        unsafe {
349            from_glib_full(ffi::gst_bin_get_by_interface(
350                self.as_ref().to_glib_none().0,
351                iface.into_glib(),
352            ))
353        }
354    }
355
356    /// Gets the element with the given name from a bin. This
357    /// function recurses into child bins.
358    /// ## `name`
359    /// the element name to search for
360    ///
361    /// # Returns
362    ///
363    /// the [`Element`][crate::Element] with the given
364    /// name
365    #[doc(alias = "gst_bin_get_by_name")]
366    #[doc(alias = "get_by_name")]
367    fn by_name(&self, name: &str) -> Option<Element> {
368        unsafe {
369            from_glib_full(ffi::gst_bin_get_by_name(
370                self.as_ref().to_glib_none().0,
371                name.to_glib_none().0,
372            ))
373        }
374    }
375
376    /// Gets the element with the given name from this bin. If the
377    /// element is not found, a recursion is performed on the parent bin.
378    /// ## `name`
379    /// the element name to search for
380    ///
381    /// # Returns
382    ///
383    /// the [`Element`][crate::Element] with the given
384    /// name
385    #[doc(alias = "gst_bin_get_by_name_recurse_up")]
386    #[doc(alias = "get_by_name_recurse_up")]
387    fn by_name_recurse_up(&self, name: &str) -> Option<Element> {
388        unsafe {
389            from_glib_full(ffi::gst_bin_get_by_name_recurse_up(
390                self.as_ref().to_glib_none().0,
391                name.to_glib_none().0,
392            ))
393        }
394    }
395
396    ///
397    /// # Returns
398    ///
399    /// the bin's suppressed [`ElementFlags`][crate::ElementFlags].
400    #[doc(alias = "gst_bin_get_suppressed_flags")]
401    #[doc(alias = "get_suppressed_flags")]
402    fn suppressed_flags(&self) -> ElementFlags {
403        unsafe {
404            from_glib(ffi::gst_bin_get_suppressed_flags(
405                self.as_ref().to_glib_none().0,
406            ))
407        }
408    }
409
410    /// Queries `self` for the current latency and reconfigures this latency on all the
411    /// elements using a LATENCY event.
412    ///
413    /// This method is typically called on the pipeline when a `GST_MESSAGE_LATENCY`
414    /// is posted on the bus.
415    ///
416    /// This function simply emits the [`do-latency`][struct@crate::Bin#do-latency] signal so any custom latency
417    /// calculations will be performed.
418    ///
419    /// # Returns
420    ///
421    /// [`true`] if the latency could be queried and reconfigured.
422    #[doc(alias = "gst_bin_recalculate_latency")]
423    fn recalculate_latency(&self) -> Result<(), glib::error::BoolError> {
424        unsafe {
425            glib::result_from_gboolean!(
426                ffi::gst_bin_recalculate_latency(self.as_ref().to_glib_none().0),
427                "Failed to recalculate latency"
428            )
429        }
430    }
431
432    /// Removes the element from the bin, unparenting it as well.
433    /// Unparenting the element means that the element will be dereferenced,
434    /// so if the bin holds the only reference to the element, the element
435    /// will be freed in the process of removing it from the bin. If you
436    /// want the element to still exist after removing, you need to call
437    /// `gst_object_ref()` before removing it from the bin.
438    ///
439    /// If the element's pads are linked to other pads, the pads will be unlinked
440    /// before the element is removed from the bin.
441    /// ## `element`
442    /// the [`Element`][crate::Element] to remove
443    ///
444    /// # Returns
445    ///
446    /// [`true`] if the element could be removed, [`false`] if
447    /// the bin does not want to remove the element.
448    #[doc(alias = "gst_bin_remove")]
449    fn remove(&self, element: &impl IsA<Element>) -> Result<(), glib::error::BoolError> {
450        unsafe {
451            glib::result_from_gboolean!(
452                ffi::gst_bin_remove(
453                    self.as_ref().to_glib_none().0,
454                    element.as_ref().to_glib_none().0
455                ),
456                "Failed to remove element"
457            )
458        }
459    }
460
461    /// Suppresses the given flags on the bin. [`ElementFlags`][crate::ElementFlags] of a
462    /// child element are propagated when it is added to the bin.
463    /// When suppressed flags are set, those specified flags will
464    /// not be propagated to the bin.
465    /// ## `flags`
466    /// the [`ElementFlags`][crate::ElementFlags] to suppress
467    #[doc(alias = "gst_bin_set_suppressed_flags")]
468    fn set_suppressed_flags(&self, flags: ElementFlags) {
469        unsafe {
470            ffi::gst_bin_set_suppressed_flags(self.as_ref().to_glib_none().0, flags.into_glib());
471        }
472    }
473
474    /// Synchronizes the state of every child of `self` with the state
475    /// of `self`. See also [`ElementExt::sync_state_with_parent()`][crate::prelude::ElementExt::sync_state_with_parent()].
476    ///
477    /// # Returns
478    ///
479    /// [`true`] if syncing the state was successful for all children,
480    ///  otherwise [`false`].
481    #[doc(alias = "gst_bin_sync_children_states")]
482    fn sync_children_states(&self) -> Result<(), glib::error::BoolError> {
483        unsafe {
484            glib::result_from_gboolean!(
485                ffi::gst_bin_sync_children_states(self.as_ref().to_glib_none().0),
486                "Failed to sync children states"
487            )
488        }
489    }
490
491    /// If set to [`true`], the bin will handle asynchronous state changes.
492    /// This should be used only if the bin subclass is modifying the state
493    /// of its children on its own.
494    #[doc(alias = "async-handling")]
495    fn is_async_handling(&self) -> bool {
496        ObjectExt::property(self.as_ref(), "async-handling")
497    }
498
499    /// If set to [`true`], the bin will handle asynchronous state changes.
500    /// This should be used only if the bin subclass is modifying the state
501    /// of its children on its own.
502    #[doc(alias = "async-handling")]
503    fn set_async_handling(&self, async_handling: bool) {
504        ObjectExt::set_property(self.as_ref(), "async-handling", async_handling)
505    }
506
507    /// Forward all children messages, even those that would normally be filtered by
508    /// the bin. This can be interesting when one wants to be notified of the EOS
509    /// state of individual elements, for example.
510    ///
511    /// The messages are converted to an ELEMENT message with the bin as the
512    /// source. The structure of the message is named `GstBinForwarded` and contains
513    /// a field named `message` that contains the original forwarded [`Message`][crate::Message].
514    #[doc(alias = "message-forward")]
515    fn is_message_forward(&self) -> bool {
516        ObjectExt::property(self.as_ref(), "message-forward")
517    }
518
519    /// Forward all children messages, even those that would normally be filtered by
520    /// the bin. This can be interesting when one wants to be notified of the EOS
521    /// state of individual elements, for example.
522    ///
523    /// The messages are converted to an ELEMENT message with the bin as the
524    /// source. The structure of the message is named `GstBinForwarded` and contains
525    /// a field named `message` that contains the original forwarded [`Message`][crate::Message].
526    #[doc(alias = "message-forward")]
527    fn set_message_forward(&self, message_forward: bool) {
528        ObjectExt::set_property(self.as_ref(), "message-forward", message_forward)
529    }
530
531    /// Will be emitted after the element was added to `sub_bin`.
532    /// ## `sub_bin`
533    /// the [`Bin`][crate::Bin] the element was added to
534    /// ## `element`
535    /// the [`Element`][crate::Element] that was added to `sub_bin`
536    #[doc(alias = "deep-element-added")]
537    fn connect_deep_element_added<F: Fn(&Self, &Bin, &Element) + Send + Sync + 'static>(
538        &self,
539        f: F,
540    ) -> SignalHandlerId {
541        unsafe extern "C" fn deep_element_added_trampoline<
542            P: IsA<Bin>,
543            F: Fn(&P, &Bin, &Element) + Send + Sync + 'static,
544        >(
545            this: *mut ffi::GstBin,
546            sub_bin: *mut ffi::GstBin,
547            element: *mut ffi::GstElement,
548            f: glib::ffi::gpointer,
549        ) {
550            let f: &F = &*(f as *const F);
551            f(
552                Bin::from_glib_borrow(this).unsafe_cast_ref(),
553                &from_glib_borrow(sub_bin),
554                &from_glib_borrow(element),
555            )
556        }
557        unsafe {
558            let f: Box_<F> = Box_::new(f);
559            connect_raw(
560                self.as_ptr() as *mut _,
561                b"deep-element-added\0".as_ptr() as *const _,
562                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
563                    deep_element_added_trampoline::<Self, F> as *const (),
564                )),
565                Box_::into_raw(f),
566            )
567        }
568    }
569
570    /// Will be emitted after the element was removed from `sub_bin`.
571    /// ## `sub_bin`
572    /// the [`Bin`][crate::Bin] the element was removed from
573    /// ## `element`
574    /// the [`Element`][crate::Element] that was removed from `sub_bin`
575    #[doc(alias = "deep-element-removed")]
576    fn connect_deep_element_removed<F: Fn(&Self, &Bin, &Element) + Send + Sync + 'static>(
577        &self,
578        f: F,
579    ) -> SignalHandlerId {
580        unsafe extern "C" fn deep_element_removed_trampoline<
581            P: IsA<Bin>,
582            F: Fn(&P, &Bin, &Element) + Send + Sync + 'static,
583        >(
584            this: *mut ffi::GstBin,
585            sub_bin: *mut ffi::GstBin,
586            element: *mut ffi::GstElement,
587            f: glib::ffi::gpointer,
588        ) {
589            let f: &F = &*(f as *const F);
590            f(
591                Bin::from_glib_borrow(this).unsafe_cast_ref(),
592                &from_glib_borrow(sub_bin),
593                &from_glib_borrow(element),
594            )
595        }
596        unsafe {
597            let f: Box_<F> = Box_::new(f);
598            connect_raw(
599                self.as_ptr() as *mut _,
600                b"deep-element-removed\0".as_ptr() as *const _,
601                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
602                    deep_element_removed_trampoline::<Self, F> as *const (),
603                )),
604                Box_::into_raw(f),
605            )
606        }
607    }
608
609    /// Will be emitted after the element was added to the bin.
610    /// ## `element`
611    /// the [`Element`][crate::Element] that was added to the bin
612    #[doc(alias = "element-added")]
613    fn connect_element_added<F: Fn(&Self, &Element) + Send + Sync + 'static>(
614        &self,
615        f: F,
616    ) -> SignalHandlerId {
617        unsafe extern "C" fn element_added_trampoline<
618            P: IsA<Bin>,
619            F: Fn(&P, &Element) + Send + Sync + 'static,
620        >(
621            this: *mut ffi::GstBin,
622            element: *mut ffi::GstElement,
623            f: glib::ffi::gpointer,
624        ) {
625            let f: &F = &*(f as *const F);
626            f(
627                Bin::from_glib_borrow(this).unsafe_cast_ref(),
628                &from_glib_borrow(element),
629            )
630        }
631        unsafe {
632            let f: Box_<F> = Box_::new(f);
633            connect_raw(
634                self.as_ptr() as *mut _,
635                b"element-added\0".as_ptr() as *const _,
636                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
637                    element_added_trampoline::<Self, F> as *const (),
638                )),
639                Box_::into_raw(f),
640            )
641        }
642    }
643
644    /// Will be emitted after the element was removed from the bin.
645    /// ## `element`
646    /// the [`Element`][crate::Element] that was removed from the bin
647    #[doc(alias = "element-removed")]
648    fn connect_element_removed<F: Fn(&Self, &Element) + Send + Sync + 'static>(
649        &self,
650        f: F,
651    ) -> SignalHandlerId {
652        unsafe extern "C" fn element_removed_trampoline<
653            P: IsA<Bin>,
654            F: Fn(&P, &Element) + Send + Sync + 'static,
655        >(
656            this: *mut ffi::GstBin,
657            element: *mut ffi::GstElement,
658            f: glib::ffi::gpointer,
659        ) {
660            let f: &F = &*(f as *const F);
661            f(
662                Bin::from_glib_borrow(this).unsafe_cast_ref(),
663                &from_glib_borrow(element),
664            )
665        }
666        unsafe {
667            let f: Box_<F> = Box_::new(f);
668            connect_raw(
669                self.as_ptr() as *mut _,
670                b"element-removed\0".as_ptr() as *const _,
671                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
672                    element_removed_trampoline::<Self, F> as *const (),
673                )),
674                Box_::into_raw(f),
675            )
676        }
677    }
678
679    #[doc(alias = "async-handling")]
680    fn connect_async_handling_notify<F: Fn(&Self) + Send + Sync + 'static>(
681        &self,
682        f: F,
683    ) -> SignalHandlerId {
684        unsafe extern "C" fn notify_async_handling_trampoline<
685            P: IsA<Bin>,
686            F: Fn(&P) + Send + Sync + 'static,
687        >(
688            this: *mut ffi::GstBin,
689            _param_spec: glib::ffi::gpointer,
690            f: glib::ffi::gpointer,
691        ) {
692            let f: &F = &*(f as *const F);
693            f(Bin::from_glib_borrow(this).unsafe_cast_ref())
694        }
695        unsafe {
696            let f: Box_<F> = Box_::new(f);
697            connect_raw(
698                self.as_ptr() as *mut _,
699                b"notify::async-handling\0".as_ptr() as *const _,
700                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
701                    notify_async_handling_trampoline::<Self, F> as *const (),
702                )),
703                Box_::into_raw(f),
704            )
705        }
706    }
707
708    #[doc(alias = "message-forward")]
709    fn connect_message_forward_notify<F: Fn(&Self) + Send + Sync + 'static>(
710        &self,
711        f: F,
712    ) -> SignalHandlerId {
713        unsafe extern "C" fn notify_message_forward_trampoline<
714            P: IsA<Bin>,
715            F: Fn(&P) + Send + Sync + 'static,
716        >(
717            this: *mut ffi::GstBin,
718            _param_spec: glib::ffi::gpointer,
719            f: glib::ffi::gpointer,
720        ) {
721            let f: &F = &*(f as *const F);
722            f(Bin::from_glib_borrow(this).unsafe_cast_ref())
723        }
724        unsafe {
725            let f: Box_<F> = Box_::new(f);
726            connect_raw(
727                self.as_ptr() as *mut _,
728                b"notify::message-forward\0".as_ptr() as *const _,
729                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
730                    notify_message_forward_trampoline::<Self, F> as *const (),
731                )),
732                Box_::into_raw(f),
733            )
734        }
735    }
736}
737
738impl<O: IsA<Bin>> GstBinExt for O {}