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
319/// Trait containing all [`struct@Track`] methods.
320///
321/// # Implementors
322///
323/// [`AudioTrack`][struct@crate::AudioTrack], [`Track`][struct@crate::Track], [`VideoTrack`][struct@crate::VideoTrack]
324pub trait GESTrackExt: IsA<Track> + 'static {
325    /// See [`add_element()`][Self::add_element()], which also gives an error.
326    /// ## `object`
327    /// The element to add
328    ///
329    /// # Returns
330    ///
331    /// [`true`] if `object` was successfully added to `self`.
332    #[doc(alias = "ges_track_add_element")]
333    fn add_element(&self, object: &impl IsA<TrackElement>) -> Result<(), glib::error::BoolError> {
334        unsafe {
335            glib::result_from_gboolean!(
336                ffi::ges_track_add_element(
337                    self.as_ref().to_glib_none().0,
338                    object.as_ref().to_glib_none().0
339                ),
340                "Failed to add element"
341            )
342        }
343    }
344
345    /// Adds the given track element to the track, which takes ownership of the
346    /// element.
347    ///
348    /// Note that this can fail if it would break a configuration rule of the
349    /// track's [`Timeline`][crate::Timeline].
350    ///
351    /// Note that a [`TrackElement`][crate::TrackElement] can only be added to one track.
352    /// ## `object`
353    /// The element to add
354    ///
355    /// # Returns
356    ///
357    /// [`true`] if `object` was successfully added to `self`.
358    #[cfg(feature = "v1_18")]
359    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
360    #[doc(alias = "ges_track_add_element_full")]
361    fn add_element_full(&self, object: &impl IsA<TrackElement>) -> Result<(), glib::Error> {
362        unsafe {
363            let mut error = std::ptr::null_mut();
364            let is_ok = ffi::ges_track_add_element_full(
365                self.as_ref().to_glib_none().0,
366                object.as_ref().to_glib_none().0,
367                &mut error,
368            );
369            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
370            if error.is_null() {
371                Ok(())
372            } else {
373                Err(from_glib_full(error))
374            }
375        }
376    }
377
378    /// Commits all the pending changes for the elements contained in the
379    /// track.
380    ///
381    /// When changes are made to the timing or priority of elements within a
382    /// track, they are not directly executed for the underlying
383    /// `nlecomposition` and its children. This method will finally execute
384    /// these changes so they are reflected in the data output of the track.
385    ///
386    /// Any pending changes will be executed in the backend. The
387    /// [`commited`][struct@crate::Timeline#commited] signal will be emitted once this has completed.
388    ///
389    /// Note that [`TimelineExt::commit()`][crate::prelude::TimelineExt::commit()] will call this method on all of its
390    /// tracks, so you are unlikely to need to use this directly.
391    ///
392    /// # Returns
393    ///
394    /// [`true`] if pending changes were committed, or [`false`] if nothing
395    /// needed to be committed.
396    #[doc(alias = "ges_track_commit")]
397    fn commit(&self) -> bool {
398        unsafe { from_glib(ffi::ges_track_commit(self.as_ref().to_glib_none().0)) }
399    }
400
401    /// Get the [`caps`][struct@crate::Track#caps] of the track.
402    ///
403    /// # Returns
404    ///
405    /// The caps of `self`.
406    #[doc(alias = "ges_track_get_caps")]
407    #[doc(alias = "get_caps")]
408    fn caps(&self) -> Option<gst::Caps> {
409        unsafe { from_glib_none(ffi::ges_track_get_caps(self.as_ref().to_glib_none().0)) }
410    }
411
412    /// Gets the track elements contained in the track. The returned list is
413    /// sorted by the element's [`priority`][struct@crate::TimelineElement#priority] and
414    /// [`start`][struct@crate::TimelineElement#start].
415    ///
416    /// # Returns
417    ///
418    /// A list of
419    /// all the [`TrackElement`][crate::TrackElement]-s in `self`.
420    #[doc(alias = "ges_track_get_elements")]
421    #[doc(alias = "get_elements")]
422    fn elements(&self) -> Vec<TrackElement> {
423        unsafe {
424            FromGlibPtrContainer::from_glib_full(ffi::ges_track_get_elements(
425                self.as_ref().to_glib_none().0,
426            ))
427        }
428    }
429
430    /// Gets the [`mixing`][struct@crate::Track#mixing] of the track.
431    ///
432    /// # Returns
433    ///
434    /// Whether `self` is mixing.
435    #[doc(alias = "ges_track_get_mixing")]
436    #[doc(alias = "get_mixing")]
437    #[doc(alias = "mixing")]
438    fn is_mixing(&self) -> bool {
439        unsafe { from_glib(ffi::ges_track_get_mixing(self.as_ref().to_glib_none().0)) }
440    }
441
442    /// Gets the [`restriction-caps`][struct@crate::Track#restriction-caps] of the track.
443    ///
444    /// # Returns
445    ///
446    /// The restriction-caps of `self`.
447    #[cfg(feature = "v1_18")]
448    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
449    #[doc(alias = "ges_track_get_restriction_caps")]
450    #[doc(alias = "get_restriction_caps")]
451    #[doc(alias = "restriction-caps")]
452    fn restriction_caps(&self) -> Option<gst::Caps> {
453        unsafe {
454            from_glib_full(ffi::ges_track_get_restriction_caps(
455                self.as_ref().to_glib_none().0,
456            ))
457        }
458    }
459
460    /// Get the timeline this track belongs to.
461    ///
462    /// # Returns
463    ///
464    /// The timeline that `self` belongs to, or [`None`] if
465    /// it does not belong to a timeline.
466    #[doc(alias = "ges_track_get_timeline")]
467    #[doc(alias = "get_timeline")]
468    fn timeline(&self) -> Option<Timeline> {
469        unsafe { from_glib_none(ffi::ges_track_get_timeline(self.as_ref().to_glib_none().0)) }
470    }
471
472    /// See [`remove_element_full()`][Self::remove_element_full()], which also returns an error.
473    /// ## `object`
474    /// The element to remove
475    ///
476    /// # Returns
477    ///
478    /// [`true`] if `object` was successfully removed from `self`.
479    #[doc(alias = "ges_track_remove_element")]
480    fn remove_element(
481        &self,
482        object: &impl IsA<TrackElement>,
483    ) -> Result<(), glib::error::BoolError> {
484        unsafe {
485            glib::result_from_gboolean!(
486                ffi::ges_track_remove_element(
487                    self.as_ref().to_glib_none().0,
488                    object.as_ref().to_glib_none().0
489                ),
490                "Failed to remove element"
491            )
492        }
493    }
494
495    /// Removes the given track element from the track, which revokes
496    /// ownership of the element.
497    /// ## `object`
498    /// The element to remove
499    ///
500    /// # Returns
501    ///
502    /// [`true`] if `object` was successfully removed from `self`.
503    #[cfg(feature = "v1_18")]
504    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
505    #[doc(alias = "ges_track_remove_element_full")]
506    fn remove_element_full(&self, object: &impl IsA<TrackElement>) -> Result<(), glib::Error> {
507        unsafe {
508            let mut error = std::ptr::null_mut();
509            let is_ok = ffi::ges_track_remove_element_full(
510                self.as_ref().to_glib_none().0,
511                object.as_ref().to_glib_none().0,
512                &mut error,
513            );
514            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
515            if error.is_null() {
516                Ok(())
517            } else {
518                Err(from_glib_full(error))
519            }
520        }
521    }
522
523    //#[doc(alias = "ges_track_set_create_element_for_gap_func")]
524    //fn set_create_element_for_gap_func<P: Fn() -> gst::Element + 'static>(&self, func: P) {
525    //    unsafe { TODO: call ffi:ges_track_set_create_element_for_gap_func() }
526    //}
527
528    /// Sets the [`mixing`][struct@crate::Track#mixing] for the track.
529    /// ## `mixing`
530    /// Whether `self` should be mixing
531    #[doc(alias = "ges_track_set_mixing")]
532    #[doc(alias = "mixing")]
533    fn set_mixing(&self, mixing: bool) {
534        unsafe {
535            ffi::ges_track_set_mixing(self.as_ref().to_glib_none().0, mixing.into_glib());
536        }
537    }
538
539    /// Sets the [`restriction-caps`][struct@crate::Track#restriction-caps] for the track.
540    ///
541    /// > **NOTE**: Restriction caps are **not** taken into account when
542    /// > using [`mode`][struct@crate::Pipeline#mode]=[`PipelineFlags::SMART_RENDER`][crate::PipelineFlags::SMART_RENDER].
543    /// ## `caps`
544    /// The new restriction-caps for `self`
545    #[doc(alias = "ges_track_set_restriction_caps")]
546    #[doc(alias = "restriction-caps")]
547    fn set_restriction_caps(&self, caps: &gst::Caps) {
548        unsafe {
549            ffi::ges_track_set_restriction_caps(
550                self.as_ref().to_glib_none().0,
551                caps.to_glib_none().0,
552            );
553        }
554    }
555
556    /// Informs the track that it belongs to the given timeline. Calling this
557    /// does not actually add the track to the timeline. For that, you should
558    /// use [`TimelineExt::add_track()`][crate::prelude::TimelineExt::add_track()], which will also take care of informing
559    /// the track that it belongs to the timeline. As such, there is no need
560    /// for you to call this method.
561    #[doc(alias = "ges_track_set_timeline")]
562    fn set_timeline(&self, timeline: &impl IsA<Timeline>) {
563        unsafe {
564            ffi::ges_track_set_timeline(
565                self.as_ref().to_glib_none().0,
566                timeline.as_ref().to_glib_none().0,
567            );
568        }
569    }
570
571    /// Updates the [`restriction-caps`][struct@crate::Track#restriction-caps] of the track using the fields
572    /// found in the given caps. Each of the [`gst::Structure`][crate::gst::Structure]-s in `caps` is
573    /// compared against the existing structure with the same index in the
574    /// current [`restriction-caps`][struct@crate::Track#restriction-caps]. If there is no corresponding
575    /// existing structure at that index, then the new structure is simply
576    /// copied to that index. Otherwise, any fields in the new structure are
577    /// copied into the existing structure. This will replace existing values,
578    /// and may introduce new ones, but any fields 'missing' in the new
579    /// structure are left unchanged in the existing structure.
580    ///
581    /// For example, if the existing [`restriction-caps`][struct@crate::Track#restriction-caps] are
582    /// "video/x-raw, width=480, height=360", and the updating caps is
583    /// "video/x-raw, format=I420, width=500; video/x-bayer, width=400", then
584    /// the new [`restriction-caps`][struct@crate::Track#restriction-caps] after calling this will be
585    /// "video/x-raw, width=500, height=360, format=I420; video/x-bayer,
586    /// width=400".
587    /// ## `caps`
588    /// The caps to update the restriction-caps with
589    #[doc(alias = "ges_track_update_restriction_caps")]
590    fn update_restriction_caps(&self, caps: &gst::Caps) {
591        unsafe {
592            ffi::ges_track_update_restriction_caps(
593                self.as_ref().to_glib_none().0,
594                caps.to_glib_none().0,
595            );
596        }
597    }
598
599    /// Current duration of the track
600    ///
601    /// Default value: O
602    fn duration(&self) -> u64 {
603        ObjectExt::property(self.as_ref(), "duration")
604    }
605
606    /// The `nlecomposition:id` of the underlying `nlecomposition`.
607    #[cfg(feature = "v1_18")]
608    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
609    fn id(&self) -> Option<glib::GString> {
610        ObjectExt::property(self.as_ref(), "id")
611    }
612
613    /// The `nlecomposition:id` of the underlying `nlecomposition`.
614    #[cfg(feature = "v1_18")]
615    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
616    fn set_id(&self, id: Option<&str>) {
617        ObjectExt::set_property(self.as_ref(), "id", id)
618    }
619
620    #[cfg(not(feature = "v1_18"))]
621    #[cfg_attr(docsrs, doc(cfg(not(feature = "v1_18"))))]
622    #[doc(alias = "restriction-caps")]
623    fn restriction_caps(&self) -> Option<gst::Caps> {
624        ObjectExt::property(self.as_ref(), "restriction-caps")
625    }
626
627    /// The track type of the track. This controls the type of
628    /// [`TrackElement`][crate::TrackElement]-s that can be added to the track. This should
629    /// match with the track's [`caps`][struct@crate::Track#caps].
630    ///
631    /// Once a track has been added to a [`Timeline`][crate::Timeline], you should not change
632    /// this.
633    #[doc(alias = "track-type")]
634    fn track_type(&self) -> TrackType {
635        ObjectExt::property(self.as_ref(), "track-type")
636    }
637
638    /// This signal will be emitted once the changes initiated by
639    /// [`commit()`][Self::commit()] have been executed in the backend. In particular,
640    /// this will be emitted whenever the underlying `nlecomposition` has been
641    /// committed (see `nlecomposition::commited`).
642    #[doc(alias = "commited")]
643    fn connect_commited<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
644        unsafe extern "C" fn commited_trampoline<P: IsA<Track>, F: Fn(&P) + 'static>(
645            this: *mut ffi::GESTrack,
646            f: glib::ffi::gpointer,
647        ) {
648            let f: &F = &*(f as *const F);
649            f(Track::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"commited".as_ptr() as *const _,
656                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
657                    commited_trampoline::<Self, F> as *const (),
658                )),
659                Box_::into_raw(f),
660            )
661        }
662    }
663
664    /// Will be emitted after a track element is added to the track.
665    /// ## `effect`
666    /// The element that was added
667    #[doc(alias = "track-element-added")]
668    fn connect_track_element_added<F: Fn(&Self, &TrackElement) + 'static>(
669        &self,
670        f: F,
671    ) -> SignalHandlerId {
672        unsafe extern "C" fn track_element_added_trampoline<
673            P: IsA<Track>,
674            F: Fn(&P, &TrackElement) + 'static,
675        >(
676            this: *mut ffi::GESTrack,
677            effect: *mut ffi::GESTrackElement,
678            f: glib::ffi::gpointer,
679        ) {
680            let f: &F = &*(f as *const F);
681            f(
682                Track::from_glib_borrow(this).unsafe_cast_ref(),
683                &from_glib_borrow(effect),
684            )
685        }
686        unsafe {
687            let f: Box_<F> = Box_::new(f);
688            connect_raw(
689                self.as_ptr() as *mut _,
690                c"track-element-added".as_ptr() as *const _,
691                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
692                    track_element_added_trampoline::<Self, F> as *const (),
693                )),
694                Box_::into_raw(f),
695            )
696        }
697    }
698
699    /// Will be emitted after a track element is removed from the track.
700    /// ## `effect`
701    /// The element that was removed
702    #[doc(alias = "track-element-removed")]
703    fn connect_track_element_removed<F: Fn(&Self, &TrackElement) + 'static>(
704        &self,
705        f: F,
706    ) -> SignalHandlerId {
707        unsafe extern "C" fn track_element_removed_trampoline<
708            P: IsA<Track>,
709            F: Fn(&P, &TrackElement) + 'static,
710        >(
711            this: *mut ffi::GESTrack,
712            effect: *mut ffi::GESTrackElement,
713            f: glib::ffi::gpointer,
714        ) {
715            let f: &F = &*(f as *const F);
716            f(
717                Track::from_glib_borrow(this).unsafe_cast_ref(),
718                &from_glib_borrow(effect),
719            )
720        }
721        unsafe {
722            let f: Box_<F> = Box_::new(f);
723            connect_raw(
724                self.as_ptr() as *mut _,
725                c"track-element-removed".as_ptr() as *const _,
726                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
727                    track_element_removed_trampoline::<Self, F> as *const (),
728                )),
729                Box_::into_raw(f),
730            )
731        }
732    }
733
734    #[doc(alias = "duration")]
735    fn connect_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
736        unsafe extern "C" fn notify_duration_trampoline<P: IsA<Track>, F: Fn(&P) + 'static>(
737            this: *mut ffi::GESTrack,
738            _param_spec: glib::ffi::gpointer,
739            f: glib::ffi::gpointer,
740        ) {
741            let f: &F = &*(f as *const F);
742            f(Track::from_glib_borrow(this).unsafe_cast_ref())
743        }
744        unsafe {
745            let f: Box_<F> = Box_::new(f);
746            connect_raw(
747                self.as_ptr() as *mut _,
748                c"notify::duration".as_ptr() as *const _,
749                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
750                    notify_duration_trampoline::<Self, F> as *const (),
751                )),
752                Box_::into_raw(f),
753            )
754        }
755    }
756
757    #[cfg(feature = "v1_18")]
758    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
759    #[doc(alias = "id")]
760    fn connect_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
761        unsafe extern "C" fn notify_id_trampoline<P: IsA<Track>, F: Fn(&P) + 'static>(
762            this: *mut ffi::GESTrack,
763            _param_spec: glib::ffi::gpointer,
764            f: glib::ffi::gpointer,
765        ) {
766            let f: &F = &*(f as *const F);
767            f(Track::from_glib_borrow(this).unsafe_cast_ref())
768        }
769        unsafe {
770            let f: Box_<F> = Box_::new(f);
771            connect_raw(
772                self.as_ptr() as *mut _,
773                c"notify::id".as_ptr() as *const _,
774                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
775                    notify_id_trampoline::<Self, F> as *const (),
776                )),
777                Box_::into_raw(f),
778            )
779        }
780    }
781
782    #[doc(alias = "mixing")]
783    fn connect_mixing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
784        unsafe extern "C" fn notify_mixing_trampoline<P: IsA<Track>, F: Fn(&P) + 'static>(
785            this: *mut ffi::GESTrack,
786            _param_spec: glib::ffi::gpointer,
787            f: glib::ffi::gpointer,
788        ) {
789            let f: &F = &*(f as *const F);
790            f(Track::from_glib_borrow(this).unsafe_cast_ref())
791        }
792        unsafe {
793            let f: Box_<F> = Box_::new(f);
794            connect_raw(
795                self.as_ptr() as *mut _,
796                c"notify::mixing".as_ptr() as *const _,
797                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
798                    notify_mixing_trampoline::<Self, F> as *const (),
799                )),
800                Box_::into_raw(f),
801            )
802        }
803    }
804
805    #[doc(alias = "restriction-caps")]
806    fn connect_restriction_caps_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
807        unsafe extern "C" fn notify_restriction_caps_trampoline<
808            P: IsA<Track>,
809            F: Fn(&P) + 'static,
810        >(
811            this: *mut ffi::GESTrack,
812            _param_spec: glib::ffi::gpointer,
813            f: glib::ffi::gpointer,
814        ) {
815            let f: &F = &*(f as *const F);
816            f(Track::from_glib_borrow(this).unsafe_cast_ref())
817        }
818        unsafe {
819            let f: Box_<F> = Box_::new(f);
820            connect_raw(
821                self.as_ptr() as *mut _,
822                c"notify::restriction-caps".as_ptr() as *const _,
823                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
824                    notify_restriction_caps_trampoline::<Self, F> as *const (),
825                )),
826                Box_::into_raw(f),
827            )
828        }
829    }
830}
831
832impl<O: IsA<Track>> GESTrackExt for O {}