gstreamer_editing_services/auto/
track.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, MetaContainer, Timeline, TrackElement, TrackType};
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    /// A [`Track`][crate::Track] acts an output source for a [`Timeline`][crate::Timeline]. Each one
17    /// essentially provides an additional [`gst::Pad`][crate::gst::Pad] for the timeline, with
18    /// [`restriction-caps`][struct@crate::Track#restriction-caps] capabilities. Internally, a track
19    /// wraps an `nlecomposition` filtered by a `capsfilter`.
20    ///
21    /// A track will contain a number of [`TrackElement`][crate::TrackElement]-s, and its role is
22    /// to select and activate these elements according to their timings when
23    /// the timeline in played. For example, a track would activate a
24    /// [`Source`][crate::Source] when its [`start`][struct@crate::TimelineElement#start] is reached by outputting
25    /// its data for its [`duration`][struct@crate::TimelineElement#duration]. Similarly, a
26    /// [`Operation`][crate::Operation] would be activated by applying its effect to the source
27    /// data, starting from its [`start`][struct@crate::TimelineElement#start] time and lasting for
28    /// its [`duration`][struct@crate::TimelineElement#duration].
29    ///
30    /// For most users, it will usually be sufficient to add newly created
31    /// tracks to a timeline, but never directly add an element to a track.
32    /// Whenever a [`Clip`][crate::Clip] is added to a timeline, the clip adds its
33    /// elements to the timeline's tracks and assumes responsibility for
34    /// updating them.
35    ///
36    /// ## Properties
37    ///
38    ///
39    /// #### `caps`
40    ///  The capabilities used to choose the output of the [`Track`][crate::Track]'s
41    /// elements. Internally, this is used to select output streams when
42    /// several may be available, by determining whether its [`gst::Pad`][crate::gst::Pad] is
43    /// compatible (see `NleObject:caps` for `nlecomposition`). As such,
44    /// this is used as a weaker indication of the desired output type of the
45    /// track, **before** the [`restriction-caps`][struct@crate::Track#restriction-caps] is applied.
46    /// Therefore, this should be set to a *generic* superset of the
47    /// [`restriction-caps`][struct@crate::Track#restriction-caps], such as "video/x-raw(ANY)". In addition,
48    /// it should match with the track's [`track-type`][struct@crate::Track#track-type].
49    ///
50    /// Note that when you set this property, the `GstCapsFeatures` of all its
51    /// [`gst::Structure`][crate::gst::Structure]-s will be automatically set to `GST_CAPS_FEATURES_ANY`.
52    ///
53    /// Once a track has been added to a [`Timeline`][crate::Timeline], you should not change
54    /// this.
55    ///
56    /// Default value: `GST_CAPS_ANY`.
57    ///
58    /// Readable | Writeable | Construct Only
59    ///
60    ///
61    /// #### `duration`
62    ///  Current duration of the track
63    ///
64    /// Default value: O
65    ///
66    /// Readable
67    ///
68    ///
69    /// #### `id`
70    ///  The `nlecomposition:id` of the underlying `nlecomposition`.
71    ///
72    /// Readable | Writeable
73    ///
74    ///
75    /// #### `mixing`
76    ///  Whether the track should support the mixing of [`Layer`][crate::Layer] data, such
77    /// as composing the video data of each layer (when part of the video
78    /// data is transparent, the next layer will become visible) or adding
79    /// together the audio data. As such, for audio and video tracks, you'll
80    /// likely want to keep this set to [`true`].
81    ///
82    /// Readable | Writeable | Construct
83    ///
84    ///
85    /// #### `restriction-caps`
86    ///  The capabilities that specifies the final output format of the
87    /// [`Track`][crate::Track]. For example, for a video track, it would specify the
88    /// height, width, framerate and other properties of the stream.
89    ///
90    /// You may change this property after the track has been added to a
91    /// [`Timeline`][crate::Timeline], but it must remain compatible with the track's
92    /// [`caps`][struct@crate::Track#caps].
93    ///
94    /// Default value: `GST_CAPS_ANY`.
95    ///
96    /// Readable | Writeable
97    ///
98    ///
99    /// #### `track-type`
100    ///  The track type of the track. This controls the type of
101    /// [`TrackElement`][crate::TrackElement]-s that can be added to the track. This should
102    /// match with the track's [`caps`][struct@crate::Track#caps].
103    ///
104    /// Once a track has been added to a [`Timeline`][crate::Timeline], you should not change
105    /// this.
106    ///
107    /// Readable | Writeable | Construct Only
108    /// <details><summary><h4>Bin</h4></summary>
109    ///
110    ///
111    /// #### `async-handling`
112    ///  If set to [`true`], the bin will handle asynchronous state changes.
113    /// This should be used only if the bin subclass is modifying the state
114    /// of its children on its own.
115    ///
116    /// Readable | Writeable
117    ///
118    ///
119    /// #### `message-forward`
120    ///  Forward all children messages, even those that would normally be filtered by
121    /// the bin. This can be interesting when one wants to be notified of the EOS
122    /// state of individual elements, for example.
123    ///
124    /// The messages are converted to an ELEMENT message with the bin as the
125    /// source. The structure of the message is named `GstBinForwarded` and contains
126    /// a field named `message` that contains the original forwarded `GstMessage`.
127    ///
128    /// Readable | Writeable
129    /// </details>
130    /// <details><summary><h4>Object</h4></summary>
131    ///
132    ///
133    /// #### `name`
134    ///  Readable | Writeable | Construct
135    ///
136    ///
137    /// #### `parent`
138    ///  The parent of the object. Please note, that when changing the 'parent'
139    /// property, we don't emit [`notify`][struct@crate::glib::Object#notify] and [`deep-notify`][struct@crate::gst::Object#deep-notify]
140    /// signals due to locking issues. In some cases one can use
141    /// [`element-added`][struct@crate::gst::Bin#element-added] or [`element-removed`][struct@crate::gst::Bin#element-removed] signals on the parent to
142    /// achieve a similar effect.
143    ///
144    /// Readable | Writeable
145    /// </details>
146    ///
147    /// ## Signals
148    ///
149    ///
150    /// #### `commited`
151    ///  This signal will be emitted once the changes initiated by
152    /// [`GESTrackExt::commit()`][crate::prelude::GESTrackExt::commit()] have been executed in the backend. In particular,
153    /// this will be emitted whenever the underlying `nlecomposition` has been
154    /// committed (see `nlecomposition::commited`).
155    ///
156    ///
157    ///
158    ///
159    /// #### `track-element-added`
160    ///  Will be emitted after a track element is added to the track.
161    ///
162    ///
163    ///
164    ///
165    /// #### `track-element-removed`
166    ///  Will be emitted after a track element is removed from the track.
167    ///
168    ///
169    /// <details><summary><h4>Bin</h4></summary>
170    ///
171    ///
172    /// #### `deep-element-added`
173    ///  Will be emitted after the element was added to `sub_bin`.
174    ///
175    ///
176    ///
177    ///
178    /// #### `deep-element-removed`
179    ///  Will be emitted after the element was removed from `sub_bin`.
180    ///
181    ///
182    ///
183    ///
184    /// #### `do-latency`
185    ///  Will be emitted when the bin needs to perform latency calculations. This
186    /// signal is only emitted for toplevel bins or when [`async-handling`][struct@crate::gst::Bin#async-handling] is
187    /// enabled.
188    ///
189    /// Only one signal handler is invoked. If no signals are connected, the
190    /// default handler is invoked, which will query and distribute the lowest
191    /// possible latency to all sinks.
192    ///
193    /// Connect to this signal if the default latency calculations are not
194    /// sufficient, like when you need different latencies for different sinks in
195    /// the same pipeline.
196    ///
197    ///
198    ///
199    ///
200    /// #### `element-added`
201    ///  Will be emitted after the element was added to the bin.
202    ///
203    ///
204    ///
205    ///
206    /// #### `element-removed`
207    ///  Will be emitted after the element was removed from the bin.
208    ///
209    ///
210    /// </details>
211    /// <details><summary><h4>Element</h4></summary>
212    ///
213    ///
214    /// #### `no-more-pads`
215    ///  This signals that the element will not generate more dynamic pads.
216    /// Note that this signal will usually be emitted from the context of
217    /// the streaming thread.
218    ///
219    ///
220    ///
221    ///
222    /// #### `pad-added`
223    ///  a new [`gst::Pad`][crate::gst::Pad] has been added to the element. Note that this signal will
224    /// usually be emitted from the context of the streaming thread. Also keep in
225    /// mind that if you add new elements to the pipeline in the signal handler
226    /// you will need to set them to the desired target state with
227    /// [`ElementExtManual::set_state()`][crate::gst::prelude::ElementExtManual::set_state()] or [`ElementExtManual::sync_state_with_parent()`][crate::gst::prelude::ElementExtManual::sync_state_with_parent()].
228    ///
229    ///
230    ///
231    ///
232    /// #### `pad-removed`
233    ///  a [`gst::Pad`][crate::gst::Pad] has been removed from the element
234    ///
235    ///
236    /// </details>
237    /// <details><summary><h4>Object</h4></summary>
238    ///
239    ///
240    /// #### `deep-notify`
241    ///  The deep notify signal is used to be notified of property changes. It is
242    /// typically attached to the toplevel bin to receive notifications from all
243    /// the elements contained in that bin.
244    ///
245    /// Detailed
246    /// </details>
247    /// <details><summary><h4>ChildProxy</h4></summary>
248    ///
249    ///
250    /// #### `child-added`
251    ///  Will be emitted after the `object` was added to the `child_proxy`.
252    ///
253    ///
254    ///
255    ///
256    /// #### `child-removed`
257    ///  Will be emitted after the `object` was removed from the `child_proxy`.
258    ///
259    ///
260    /// </details>
261    /// <details><summary><h4>MetaContainer</h4></summary>
262    ///
263    ///
264    /// #### `notify-meta`
265    ///  This is emitted for a meta container whenever the metadata under one
266    /// of its fields changes, is set for the first time, or is removed. In
267    /// the latter case, `value` will be [`None`].
268    ///
269    /// Detailed
270    /// </details>
271    ///
272    /// # Implements
273    ///
274    /// [`GESTrackExt`][trait@crate::prelude::GESTrackExt], [`trait@gst::prelude::BinExt`], [`trait@gst::prelude::ElementExt`], [`trait@gst::prelude::GstObjectExt`], [`trait@glib::ObjectExt`], [`trait@gst::prelude::ChildProxyExt`], [`MetaContainerExt`][trait@crate::prelude::MetaContainerExt]
275    #[doc(alias = "GESTrack")]
276    pub struct Track(Object<ffi::GESTrack, ffi::GESTrackClass>) @extends gst::Bin, gst::Element, gst::Object, @implements gst::ChildProxy, MetaContainer;
277
278    match fn {
279        type_ => || ffi::ges_track_get_type(),
280    }
281}
282
283impl Track {
284    pub const NONE: Option<&'static Track> = None;
285
286    /// Creates a new track with the given track-type and caps.
287    ///
288    /// If `type_` is [`TrackType::VIDEO`][crate::TrackType::VIDEO], and `caps` is a subset of
289    /// "video/x-raw(ANY)", then a [`VideoTrack`][crate::VideoTrack] is created. This will
290    /// automatically choose a gap creation method suitable for video data. You
291    /// will likely want to set [`restriction-caps`][struct@crate::Track#restriction-caps] separately. You may
292    /// prefer to use the [`VideoTrack::new()`][crate::VideoTrack::new()] method instead.
293    ///
294    /// If `type_` is [`TrackType::AUDIO`][crate::TrackType::AUDIO], and `caps` is a subset of
295    /// "audio/x-raw(ANY)", then a [`AudioTrack`][crate::AudioTrack] is created. This will
296    /// automatically choose a gap creation method suitable for audio data, and
297    /// will set the [`restriction-caps`][struct@crate::Track#restriction-caps] to the default for
298    /// [`AudioTrack`][crate::AudioTrack]. You may prefer to use the [`AudioTrack::new()`][crate::AudioTrack::new()] method
299    /// instead.
300    ///
301    /// Otherwise, a plain [`Track`][crate::Track] is returned. You will likely want to set
302    /// the [`restriction-caps`][struct@crate::Track#restriction-caps] and call
303    /// `ges_track_set_create_element_for_gap_func()` on the returned track.
304    /// ## `type_`
305    /// The [`track-type`][struct@crate::Track#track-type] for the track
306    /// ## `caps`
307    /// The [`caps`][struct@crate::Track#caps] for the track
308    ///
309    /// # Returns
310    ///
311    /// A new track.
312    #[doc(alias = "ges_track_new")]
313    pub fn new(type_: TrackType, caps: gst::Caps) -> Track {
314        assert_initialized_main_thread!();
315        unsafe { from_glib_none(ffi::ges_track_new(type_.into_glib(), caps.into_glib_ptr())) }
316    }
317}
318
319mod sealed {
320    pub trait Sealed {}
321    impl<T: super::IsA<super::Track>> Sealed for T {}
322}
323
324/// Trait containing all [`struct@Track`] methods.
325///
326/// # Implementors
327///
328/// [`AudioTrack`][struct@crate::AudioTrack], [`Track`][struct@crate::Track], [`VideoTrack`][struct@crate::VideoTrack]
329pub trait GESTrackExt: IsA<Track> + sealed::Sealed + 'static {
330    /// See [`add_element()`][Self::add_element()], which also gives an error.
331    /// ## `object`
332    /// The element to add
333    ///
334    /// # Returns
335    ///
336    /// [`true`] if `object` was successfully added to `self`.
337    #[doc(alias = "ges_track_add_element")]
338    fn add_element(&self, object: &impl IsA<TrackElement>) -> Result<(), glib::error::BoolError> {
339        unsafe {
340            glib::result_from_gboolean!(
341                ffi::ges_track_add_element(
342                    self.as_ref().to_glib_none().0,
343                    object.as_ref().to_glib_none().0
344                ),
345                "Failed to add element"
346            )
347        }
348    }
349
350    /// Adds the given track element to the track, which takes ownership of the
351    /// element.
352    ///
353    /// Note that this can fail if it would break a configuration rule of the
354    /// track's [`Timeline`][crate::Timeline].
355    ///
356    /// Note that a [`TrackElement`][crate::TrackElement] can only be added to one track.
357    /// ## `object`
358    /// The element to add
359    ///
360    /// # Returns
361    ///
362    /// [`true`] if `object` was successfully added to `self`.
363    #[cfg(feature = "v1_18")]
364    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
365    #[doc(alias = "ges_track_add_element_full")]
366    fn add_element_full(&self, object: &impl IsA<TrackElement>) -> Result<(), glib::Error> {
367        unsafe {
368            let mut error = std::ptr::null_mut();
369            let is_ok = ffi::ges_track_add_element_full(
370                self.as_ref().to_glib_none().0,
371                object.as_ref().to_glib_none().0,
372                &mut error,
373            );
374            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
375            if error.is_null() {
376                Ok(())
377            } else {
378                Err(from_glib_full(error))
379            }
380        }
381    }
382
383    /// Commits all the pending changes for the elements contained in the
384    /// track.
385    ///
386    /// When changes are made to the timing or priority of elements within a
387    /// track, they are not directly executed for the underlying
388    /// `nlecomposition` and its children. This method will finally execute
389    /// these changes so they are reflected in the data output of the track.
390    ///
391    /// Any pending changes will be executed in the backend. The
392    /// [`commited`][struct@crate::Timeline#commited] signal will be emitted once this has completed.
393    ///
394    /// Note that [`TimelineExt::commit()`][crate::prelude::TimelineExt::commit()] will call this method on all of its
395    /// tracks, so you are unlikely to need to use this directly.
396    ///
397    /// # Returns
398    ///
399    /// [`true`] if pending changes were committed, or [`false`] if nothing
400    /// needed to be committed.
401    #[doc(alias = "ges_track_commit")]
402    fn commit(&self) -> bool {
403        unsafe { from_glib(ffi::ges_track_commit(self.as_ref().to_glib_none().0)) }
404    }
405
406    /// Get the [`caps`][struct@crate::Track#caps] of the track.
407    ///
408    /// # Returns
409    ///
410    /// The caps of `self`.
411    #[doc(alias = "ges_track_get_caps")]
412    #[doc(alias = "get_caps")]
413    fn caps(&self) -> Option<gst::Caps> {
414        unsafe { from_glib_none(ffi::ges_track_get_caps(self.as_ref().to_glib_none().0)) }
415    }
416
417    /// Gets the track elements contained in the track. The returned list is
418    /// sorted by the element's [`priority`][struct@crate::TimelineElement#priority] and
419    /// [`start`][struct@crate::TimelineElement#start].
420    ///
421    /// # Returns
422    ///
423    /// A list of
424    /// all the [`TrackElement`][crate::TrackElement]-s in `self`.
425    #[doc(alias = "ges_track_get_elements")]
426    #[doc(alias = "get_elements")]
427    fn elements(&self) -> Vec<TrackElement> {
428        unsafe {
429            FromGlibPtrContainer::from_glib_full(ffi::ges_track_get_elements(
430                self.as_ref().to_glib_none().0,
431            ))
432        }
433    }
434
435    /// Gets the [`mixing`][struct@crate::Track#mixing] of the track.
436    ///
437    /// # Returns
438    ///
439    /// Whether `self` is mixing.
440    #[doc(alias = "ges_track_get_mixing")]
441    #[doc(alias = "get_mixing")]
442    #[doc(alias = "mixing")]
443    fn is_mixing(&self) -> bool {
444        unsafe { from_glib(ffi::ges_track_get_mixing(self.as_ref().to_glib_none().0)) }
445    }
446
447    /// Gets the [`restriction-caps`][struct@crate::Track#restriction-caps] of the track.
448    ///
449    /// # Returns
450    ///
451    /// The restriction-caps of `self`.
452    #[cfg(feature = "v1_18")]
453    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
454    #[doc(alias = "ges_track_get_restriction_caps")]
455    #[doc(alias = "get_restriction_caps")]
456    #[doc(alias = "restriction-caps")]
457    fn restriction_caps(&self) -> Option<gst::Caps> {
458        unsafe {
459            from_glib_full(ffi::ges_track_get_restriction_caps(
460                self.as_ref().to_glib_none().0,
461            ))
462        }
463    }
464
465    /// Get the timeline this track belongs to.
466    ///
467    /// # Returns
468    ///
469    /// The timeline that `self` belongs to, or [`None`] if
470    /// it does not belong to a timeline.
471    #[doc(alias = "ges_track_get_timeline")]
472    #[doc(alias = "get_timeline")]
473    fn timeline(&self) -> Option<Timeline> {
474        unsafe { from_glib_none(ffi::ges_track_get_timeline(self.as_ref().to_glib_none().0)) }
475    }
476
477    /// See [`remove_element_full()`][Self::remove_element_full()], which also returns an error.
478    /// ## `object`
479    /// The element to remove
480    ///
481    /// # Returns
482    ///
483    /// [`true`] if `object` was successfully removed from `self`.
484    #[doc(alias = "ges_track_remove_element")]
485    fn remove_element(
486        &self,
487        object: &impl IsA<TrackElement>,
488    ) -> Result<(), glib::error::BoolError> {
489        unsafe {
490            glib::result_from_gboolean!(
491                ffi::ges_track_remove_element(
492                    self.as_ref().to_glib_none().0,
493                    object.as_ref().to_glib_none().0
494                ),
495                "Failed to remove element"
496            )
497        }
498    }
499
500    /// Removes the given track element from the track, which revokes
501    /// ownership of the element.
502    /// ## `object`
503    /// The element to remove
504    ///
505    /// # Returns
506    ///
507    /// [`true`] if `object` was successfully removed from `self`.
508    #[cfg(feature = "v1_18")]
509    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
510    #[doc(alias = "ges_track_remove_element_full")]
511    fn remove_element_full(&self, object: &impl IsA<TrackElement>) -> Result<(), glib::Error> {
512        unsafe {
513            let mut error = std::ptr::null_mut();
514            let is_ok = ffi::ges_track_remove_element_full(
515                self.as_ref().to_glib_none().0,
516                object.as_ref().to_glib_none().0,
517                &mut error,
518            );
519            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
520            if error.is_null() {
521                Ok(())
522            } else {
523                Err(from_glib_full(error))
524            }
525        }
526    }
527
528    //#[doc(alias = "ges_track_set_create_element_for_gap_func")]
529    //fn set_create_element_for_gap_func<P: Fn() -> gst::Element + 'static>(&self, func: P) {
530    //    unsafe { TODO: call ffi:ges_track_set_create_element_for_gap_func() }
531    //}
532
533    /// Sets the [`mixing`][struct@crate::Track#mixing] for the track.
534    /// ## `mixing`
535    /// Whether `self` should be mixing
536    #[doc(alias = "ges_track_set_mixing")]
537    #[doc(alias = "mixing")]
538    fn set_mixing(&self, mixing: bool) {
539        unsafe {
540            ffi::ges_track_set_mixing(self.as_ref().to_glib_none().0, mixing.into_glib());
541        }
542    }
543
544    /// Sets the [`restriction-caps`][struct@crate::Track#restriction-caps] for the track.
545    ///
546    /// > **NOTE**: Restriction caps are **not** taken into account when
547    /// > using [`mode`][struct@crate::Pipeline#mode]=[`PipelineFlags::SMART_RENDER`][crate::PipelineFlags::SMART_RENDER].
548    /// ## `caps`
549    /// The new restriction-caps for `self`
550    #[doc(alias = "ges_track_set_restriction_caps")]
551    #[doc(alias = "restriction-caps")]
552    fn set_restriction_caps(&self, caps: &gst::Caps) {
553        unsafe {
554            ffi::ges_track_set_restriction_caps(
555                self.as_ref().to_glib_none().0,
556                caps.to_glib_none().0,
557            );
558        }
559    }
560
561    /// Informs the track that it belongs to the given timeline. Calling this
562    /// does not actually add the track to the timeline. For that, you should
563    /// use [`TimelineExt::add_track()`][crate::prelude::TimelineExt::add_track()], which will also take care of informing
564    /// the track that it belongs to the timeline. As such, there is no need
565    /// for you to call this method.
566    #[doc(alias = "ges_track_set_timeline")]
567    fn set_timeline(&self, timeline: &impl IsA<Timeline>) {
568        unsafe {
569            ffi::ges_track_set_timeline(
570                self.as_ref().to_glib_none().0,
571                timeline.as_ref().to_glib_none().0,
572            );
573        }
574    }
575
576    /// Updates the [`restriction-caps`][struct@crate::Track#restriction-caps] of the track using the fields
577    /// found in the given caps. Each of the [`gst::Structure`][crate::gst::Structure]-s in `caps` is
578    /// compared against the existing structure with the same index in the
579    /// current [`restriction-caps`][struct@crate::Track#restriction-caps]. If there is no corresponding
580    /// existing structure at that index, then the new structure is simply
581    /// copied to that index. Otherwise, any fields in the new structure are
582    /// copied into the existing structure. This will replace existing values,
583    /// and may introduce new ones, but any fields 'missing' in the new
584    /// structure are left unchanged in the existing structure.
585    ///
586    /// For example, if the existing [`restriction-caps`][struct@crate::Track#restriction-caps] are
587    /// "video/x-raw, width=480, height=360", and the updating caps is
588    /// "video/x-raw, format=I420, width=500; video/x-bayer, width=400", then
589    /// the new [`restriction-caps`][struct@crate::Track#restriction-caps] after calling this will be
590    /// "video/x-raw, width=500, height=360, format=I420; video/x-bayer,
591    /// width=400".
592    /// ## `caps`
593    /// The caps to update the restriction-caps with
594    #[doc(alias = "ges_track_update_restriction_caps")]
595    fn update_restriction_caps(&self, caps: &gst::Caps) {
596        unsafe {
597            ffi::ges_track_update_restriction_caps(
598                self.as_ref().to_glib_none().0,
599                caps.to_glib_none().0,
600            );
601        }
602    }
603
604    /// Current duration of the track
605    ///
606    /// Default value: O
607    fn duration(&self) -> u64 {
608        ObjectExt::property(self.as_ref(), "duration")
609    }
610
611    /// The `nlecomposition:id` of the underlying `nlecomposition`.
612    #[cfg(feature = "v1_18")]
613    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
614    fn id(&self) -> Option<glib::GString> {
615        ObjectExt::property(self.as_ref(), "id")
616    }
617
618    /// The `nlecomposition:id` of the underlying `nlecomposition`.
619    #[cfg(feature = "v1_18")]
620    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
621    fn set_id(&self, id: Option<&str>) {
622        ObjectExt::set_property(self.as_ref(), "id", id)
623    }
624
625    #[cfg(not(feature = "v1_18"))]
626    #[cfg_attr(docsrs, doc(cfg(not(feature = "v1_18"))))]
627    #[doc(alias = "restriction-caps")]
628    fn restriction_caps(&self) -> Option<gst::Caps> {
629        ObjectExt::property(self.as_ref(), "restriction-caps")
630    }
631
632    /// The track type of the track. This controls the type of
633    /// [`TrackElement`][crate::TrackElement]-s that can be added to the track. This should
634    /// match with the track's [`caps`][struct@crate::Track#caps].
635    ///
636    /// Once a track has been added to a [`Timeline`][crate::Timeline], you should not change
637    /// this.
638    #[doc(alias = "track-type")]
639    fn track_type(&self) -> TrackType {
640        ObjectExt::property(self.as_ref(), "track-type")
641    }
642
643    /// This signal will be emitted once the changes initiated by
644    /// [`commit()`][Self::commit()] have been executed in the backend. In particular,
645    /// this will be emitted whenever the underlying `nlecomposition` has been
646    /// committed (see `nlecomposition::commited`).
647    #[doc(alias = "commited")]
648    fn connect_commited<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
649        unsafe extern "C" fn commited_trampoline<P: IsA<Track>, F: Fn(&P) + 'static>(
650            this: *mut ffi::GESTrack,
651            f: glib::ffi::gpointer,
652        ) {
653            let f: &F = &*(f as *const F);
654            f(Track::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"commited\0".as_ptr() as *const _,
661                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
662                    commited_trampoline::<Self, F> as *const (),
663                )),
664                Box_::into_raw(f),
665            )
666        }
667    }
668
669    /// Will be emitted after a track element is added to the track.
670    /// ## `effect`
671    /// The element that was added
672    #[doc(alias = "track-element-added")]
673    fn connect_track_element_added<F: Fn(&Self, &TrackElement) + 'static>(
674        &self,
675        f: F,
676    ) -> SignalHandlerId {
677        unsafe extern "C" fn track_element_added_trampoline<
678            P: IsA<Track>,
679            F: Fn(&P, &TrackElement) + 'static,
680        >(
681            this: *mut ffi::GESTrack,
682            effect: *mut ffi::GESTrackElement,
683            f: glib::ffi::gpointer,
684        ) {
685            let f: &F = &*(f as *const F);
686            f(
687                Track::from_glib_borrow(this).unsafe_cast_ref(),
688                &from_glib_borrow(effect),
689            )
690        }
691        unsafe {
692            let f: Box_<F> = Box_::new(f);
693            connect_raw(
694                self.as_ptr() as *mut _,
695                b"track-element-added\0".as_ptr() as *const _,
696                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
697                    track_element_added_trampoline::<Self, F> as *const (),
698                )),
699                Box_::into_raw(f),
700            )
701        }
702    }
703
704    /// Will be emitted after a track element is removed from the track.
705    /// ## `effect`
706    /// The element that was removed
707    #[doc(alias = "track-element-removed")]
708    fn connect_track_element_removed<F: Fn(&Self, &TrackElement) + 'static>(
709        &self,
710        f: F,
711    ) -> SignalHandlerId {
712        unsafe extern "C" fn track_element_removed_trampoline<
713            P: IsA<Track>,
714            F: Fn(&P, &TrackElement) + 'static,
715        >(
716            this: *mut ffi::GESTrack,
717            effect: *mut ffi::GESTrackElement,
718            f: glib::ffi::gpointer,
719        ) {
720            let f: &F = &*(f as *const F);
721            f(
722                Track::from_glib_borrow(this).unsafe_cast_ref(),
723                &from_glib_borrow(effect),
724            )
725        }
726        unsafe {
727            let f: Box_<F> = Box_::new(f);
728            connect_raw(
729                self.as_ptr() as *mut _,
730                b"track-element-removed\0".as_ptr() as *const _,
731                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
732                    track_element_removed_trampoline::<Self, F> as *const (),
733                )),
734                Box_::into_raw(f),
735            )
736        }
737    }
738
739    #[doc(alias = "duration")]
740    fn connect_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
741        unsafe extern "C" fn notify_duration_trampoline<P: IsA<Track>, F: Fn(&P) + 'static>(
742            this: *mut ffi::GESTrack,
743            _param_spec: glib::ffi::gpointer,
744            f: glib::ffi::gpointer,
745        ) {
746            let f: &F = &*(f as *const F);
747            f(Track::from_glib_borrow(this).unsafe_cast_ref())
748        }
749        unsafe {
750            let f: Box_<F> = Box_::new(f);
751            connect_raw(
752                self.as_ptr() as *mut _,
753                b"notify::duration\0".as_ptr() as *const _,
754                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
755                    notify_duration_trampoline::<Self, F> as *const (),
756                )),
757                Box_::into_raw(f),
758            )
759        }
760    }
761
762    #[cfg(feature = "v1_18")]
763    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
764    #[doc(alias = "id")]
765    fn connect_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
766        unsafe extern "C" fn notify_id_trampoline<P: IsA<Track>, F: Fn(&P) + 'static>(
767            this: *mut ffi::GESTrack,
768            _param_spec: glib::ffi::gpointer,
769            f: glib::ffi::gpointer,
770        ) {
771            let f: &F = &*(f as *const F);
772            f(Track::from_glib_borrow(this).unsafe_cast_ref())
773        }
774        unsafe {
775            let f: Box_<F> = Box_::new(f);
776            connect_raw(
777                self.as_ptr() as *mut _,
778                b"notify::id\0".as_ptr() as *const _,
779                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
780                    notify_id_trampoline::<Self, F> as *const (),
781                )),
782                Box_::into_raw(f),
783            )
784        }
785    }
786
787    #[doc(alias = "mixing")]
788    fn connect_mixing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
789        unsafe extern "C" fn notify_mixing_trampoline<P: IsA<Track>, F: Fn(&P) + 'static>(
790            this: *mut ffi::GESTrack,
791            _param_spec: glib::ffi::gpointer,
792            f: glib::ffi::gpointer,
793        ) {
794            let f: &F = &*(f as *const F);
795            f(Track::from_glib_borrow(this).unsafe_cast_ref())
796        }
797        unsafe {
798            let f: Box_<F> = Box_::new(f);
799            connect_raw(
800                self.as_ptr() as *mut _,
801                b"notify::mixing\0".as_ptr() as *const _,
802                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
803                    notify_mixing_trampoline::<Self, F> as *const (),
804                )),
805                Box_::into_raw(f),
806            )
807        }
808    }
809
810    #[doc(alias = "restriction-caps")]
811    fn connect_restriction_caps_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
812        unsafe extern "C" fn notify_restriction_caps_trampoline<
813            P: IsA<Track>,
814            F: Fn(&P) + 'static,
815        >(
816            this: *mut ffi::GESTrack,
817            _param_spec: glib::ffi::gpointer,
818            f: glib::ffi::gpointer,
819        ) {
820            let f: &F = &*(f as *const F);
821            f(Track::from_glib_borrow(this).unsafe_cast_ref())
822        }
823        unsafe {
824            let f: Box_<F> = Box_::new(f);
825            connect_raw(
826                self.as_ptr() as *mut _,
827                b"notify::restriction-caps\0".as_ptr() as *const _,
828                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
829                    notify_restriction_caps_trampoline::<Self, F> as *const (),
830                )),
831                Box_::into_raw(f),
832            )
833        }
834    }
835}
836
837impl<O: IsA<Track>> GESTrackExt for O {}