gstreamer_editing_services/auto/
timeline_element.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
4// DO NOT EDIT
5#![allow(deprecated)]
6
7use crate::{ffi, Extractable, MetaContainer, Timeline, TrackType};
8#[cfg(feature = "v1_18")]
9#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
10use crate::{Edge, EditMode, Layer};
11use glib::{
12    object::ObjectType as _,
13    prelude::*,
14    signal::{connect_raw, SignalHandlerId},
15    translate::*,
16};
17use std::boxed::Box as Box_;
18
19glib::wrapper! {
20    /// A [`TimelineElement`][crate::TimelineElement] will have some temporal extent in its
21    /// corresponding [`timeline`][struct@crate::TimelineElement#timeline], controlled by its
22    /// [`start`][struct@crate::TimelineElement#start] and [`duration`][struct@crate::TimelineElement#duration]. This
23    /// determines when its content will be displayed, or its effect applied,
24    /// in the timeline. Several objects may overlap within a given
25    /// [`Timeline`][crate::Timeline], in which case their [`priority`][struct@crate::TimelineElement#priority] is used
26    /// to determine their ordering in the timeline. Priority is mostly handled
27    /// internally by [`Layer`][crate::Layer]-s and [`Clip`][crate::Clip]-s.
28    ///
29    /// A timeline element can have a [`parent`][struct@crate::TimelineElement#parent],
30    /// such as a [`Clip`][crate::Clip], which is responsible for controlling its timing.
31    ///
32    /// ## Editing
33    ///
34    /// Elements can be moved around in their [`timeline`][struct@crate::TimelineElement#timeline] by
35    /// setting their [`start`][struct@crate::TimelineElement#start] and
36    /// [`duration`][struct@crate::TimelineElement#duration] using [`TimelineElementExt::set_start()`][crate::prelude::TimelineElementExt::set_start()]
37    /// and [`TimelineElementExt::set_duration()`][crate::prelude::TimelineElementExt::set_duration()]. Additionally, which parts of
38    /// the underlying content are played in the timeline can be adjusted by
39    /// setting the [`in-point`][struct@crate::TimelineElement#in-point] using
40    /// [`TimelineElementExt::set_inpoint()`][crate::prelude::TimelineElementExt::set_inpoint()]. The library also provides
41    /// [`TimelineElementExt::edit()`][crate::prelude::TimelineElementExt::edit()], with various [`EditMode`][crate::EditMode]-s, which can
42    /// adjust these properties in a convenient way, as well as introduce
43    /// similar changes in neighbouring or later elements in the timeline.
44    ///
45    /// However, a timeline may refuse a change in these properties if they
46    /// would place the timeline in an unsupported configuration. See
47    /// [`Timeline`][crate::Timeline] for its overlap rules.
48    ///
49    /// Additionally, an edit may be refused if it would place one of the
50    /// timing properties out of bounds (such as a negative time value for
51    /// [`start`][struct@crate::TimelineElement#start], or having insufficient internal
52    /// content to last for the desired [`duration`][struct@crate::TimelineElement#duration]).
53    ///
54    /// ## Time Coordinates
55    ///
56    /// There are three main sets of time coordinates to consider when using
57    /// timeline elements:
58    ///
59    /// + Timeline coordinates: these are the time coordinates used in the
60    ///  output of the timeline in its [`Track`][crate::Track]-s. Each track share the same
61    ///  coordinates, so there is only one set of coordinates for the
62    ///  timeline. These extend indefinitely from 0. The times used for
63    ///  editing (including setting [`start`][struct@crate::TimelineElement#start] and
64    ///  [`duration`][struct@crate::TimelineElement#duration]) use these coordinates, since these
65    ///  define when an element is present and for how long the element lasts
66    ///  for in the timeline.
67    /// + Internal source coordinates: these are the time coordinates used
68    ///  internally at the element's output. This is only really defined for
69    ///  [`TrackElement`][crate::TrackElement]-s, where it refers to time coordinates used at the
70    ///  final source pad of the wrapped [`gst::Element`][crate::gst::Element]-s. However, these
71    ///  coordinates may also be used in a [`Clip`][crate::Clip] in reference to its
72    ///  children. In particular, these are the coordinates used for
73    ///  [`in-point`][struct@crate::TimelineElement#in-point] and [`max-duration`][struct@crate::TimelineElement#max-duration].
74    /// + Internal sink coordinates: these are the time coordinates used
75    ///  internally at the element's input. A [`Source`][crate::Source] has no input, so
76    ///  these would be undefined. Otherwise, for most [`TrackElement`][crate::TrackElement]-s
77    ///  these will be the same set of coordinates as the internal source
78    ///  coordinates because the element does not change the timing
79    ///  internally. Only [`BaseEffect`][crate::BaseEffect] can support elements where these
80    ///  are different. See [`BaseEffect`][crate::BaseEffect] for more information.
81    ///
82    /// You can determine the timeline time for a given internal source time
83    /// in a [`Track`][crate::Track] in a [`Clip`][crate::Clip] using
84    /// [`ClipExt::timeline_time_from_internal_time()`][crate::prelude::ClipExt::timeline_time_from_internal_time()], and vice versa using
85    /// [`ClipExt::internal_time_from_timeline_time()`][crate::prelude::ClipExt::internal_time_from_timeline_time()], for the purposes of
86    /// editing and setting timings properties.
87    ///
88    /// ## Children Properties
89    ///
90    /// If a timeline element owns another [`gst::Object`][crate::gst::Object] and wishes to expose
91    /// some of its properties, it can do so by registering the property as one
92    /// of the timeline element's children properties using
93    /// [`TimelineElementExt::add_child_property()`][crate::prelude::TimelineElementExt::add_child_property()]. The registered property of
94    /// the child can then be read and set using the
95    /// [`TimelineElementExt::child_property()`][crate::prelude::TimelineElementExt::child_property()] and
96    /// [`TimelineElementExt::set_child_property()`][crate::prelude::TimelineElementExt::set_child_property()] methods, respectively. Some
97    /// sub-classed objects will be created with pre-registered children
98    /// properties; for example, to expose part of an underlying [`gst::Element`][crate::gst::Element]
99    /// that is used internally. The registered properties can be listed with
100    /// [`TimelineElementExt::list_children_properties()`][crate::prelude::TimelineElementExt::list_children_properties()].
101    ///
102    /// This is an Abstract Base Class, you cannot instantiate it.
103    ///
104    /// ## Properties
105    ///
106    ///
107    /// #### `duration`
108    ///  The duration that the element is in effect for in the timeline (a
109    /// time difference in nanoseconds using the time coordinates of the
110    /// timeline). For example, for a source element, this would determine
111    /// for how long it should output its internal content for. For an
112    /// operation element, this would determine for how long its effect
113    /// should be applied to any source content.
114    ///
115    /// Readable | Writeable
116    ///
117    ///
118    /// #### `in-point`
119    ///  The initial offset to use internally when outputting content (in
120    /// nanoseconds, but in the time coordinates of the internal content).
121    ///
122    /// For example, for a [`VideoUriSource`][crate::VideoUriSource] that references some media
123    /// file, the "internal content" is the media file data, and the
124    /// in-point would correspond to some timestamp in the media file.
125    /// When playing the timeline, and when the element is first reached at
126    /// timeline-time [`start`][struct@crate::TimelineElement#start], it will begin outputting the
127    /// data from the timestamp in-point **onwards**, until it reaches the
128    /// end of its [`duration`][struct@crate::TimelineElement#duration] in the timeline.
129    ///
130    /// For elements that have no internal content, this should be kept
131    /// as 0.
132    ///
133    /// Readable | Writeable
134    ///
135    ///
136    /// #### `max-duration`
137    ///  The full duration of internal content that is available (a time
138    /// difference in nanoseconds using the time coordinates of the internal
139    /// content).
140    ///
141    /// This will act as a cap on the [`in-point`][struct@crate::TimelineElement#in-point] of the
142    /// element (which is in the same time coordinates), and will sometimes
143    /// be used to limit the [`duration`][struct@crate::TimelineElement#duration] of the element in
144    /// the timeline.
145    ///
146    /// For example, for a [`VideoUriSource`][crate::VideoUriSource] that references some media
147    /// file, this would be the length of the media file.
148    ///
149    /// For elements that have no internal content, or whose content is
150    /// indefinite, this should be kept as `GST_CLOCK_TIME_NONE`.
151    ///
152    /// Readable | Writeable | Construct
153    ///
154    ///
155    /// #### `name`
156    ///  The name of the element. This should be unique within its timeline.
157    ///
158    /// Readable | Writeable | Construct
159    ///
160    ///
161    /// #### `parent`
162    ///  The parent container of the element.
163    ///
164    /// Readable | Writeable
165    ///
166    ///
167    /// #### `priority`
168    ///  The priority of the element.
169    ///
170    /// Readable | Writeable
171    ///
172    ///
173    /// #### `serialize`
174    ///  Whether the element should be serialized.
175    ///
176    /// Readable | Writeable
177    ///
178    ///
179    /// #### `start`
180    ///  The starting position of the element in the timeline (in nanoseconds
181    /// and in the time coordinates of the timeline). For example, for a
182    /// source element, this would determine the time at which it should
183    /// start outputting its internal content. For an operation element, this
184    /// would determine the time at which it should start applying its effect
185    /// to any source content.
186    ///
187    /// Readable | Writeable
188    ///
189    ///
190    /// #### `timeline`
191    ///  The timeline that the element lies within.
192    ///
193    /// Readable | Writeable
194    ///
195    /// ## Signals
196    ///
197    ///
198    /// #### `child-property-added`
199    ///  Emitted when the element has a new child property registered. See
200    /// [`TimelineElementExt::add_child_property()`][crate::prelude::TimelineElementExt::add_child_property()].
201    ///
202    /// Note that some GES elements will be automatically created with
203    /// pre-registered children properties. You can use
204    /// [`TimelineElementExt::list_children_properties()`][crate::prelude::TimelineElementExt::list_children_properties()] to list these.
205    ///
206    ///
207    ///
208    ///
209    /// #### `child-property-removed`
210    ///  Emitted when the element has a child property unregistered. See
211    /// [`TimelineElementExt::remove_child_property()`][crate::prelude::TimelineElementExt::remove_child_property()].
212    ///
213    ///
214    ///
215    ///
216    /// #### `deep-notify`
217    ///  Emitted when a child of the element has one of its registered
218    /// properties set. See [`TimelineElementExt::add_child_property()`][crate::prelude::TimelineElementExt::add_child_property()].
219    /// Note that unlike [`notify`][struct@crate::glib::Object#notify], a child property name can not be
220    /// used as a signal detail.
221    ///
222    /// Detailed
223    /// <details><summary><h4>MetaContainer</h4></summary>
224    ///
225    ///
226    /// #### `notify-meta`
227    ///  This is emitted for a meta container whenever the metadata under one
228    /// of its fields changes, is set for the first time, or is removed. In
229    /// the latter case, `value` will be [`None`].
230    ///
231    /// Detailed
232    /// </details>
233    ///
234    /// # Implements
235    ///
236    /// [`TimelineElementExt`][trait@crate::prelude::TimelineElementExt], [`trait@glib::ObjectExt`], [`ExtractableExt`][trait@crate::prelude::ExtractableExt], [`MetaContainerExt`][trait@crate::prelude::MetaContainerExt], [`TimelineElementExtManual`][trait@crate::prelude::TimelineElementExtManual]
237    #[doc(alias = "GESTimelineElement")]
238    pub struct TimelineElement(Object<ffi::GESTimelineElement, ffi::GESTimelineElementClass>) @implements Extractable, MetaContainer;
239
240    match fn {
241        type_ => || ffi::ges_timeline_element_get_type(),
242    }
243}
244
245impl TimelineElement {
246    pub const NONE: Option<&'static TimelineElement> = None;
247}
248
249/// Trait containing all [`struct@TimelineElement`] methods.
250///
251/// # Implementors
252///
253/// [`Container`][struct@crate::Container], [`TimelineElement`][struct@crate::TimelineElement], [`TrackElement`][struct@crate::TrackElement]
254pub trait TimelineElementExt: IsA<TimelineElement> + 'static {
255    /// Register a property of a child of the element to allow it to be
256    /// written with [`set_child_property()`][Self::set_child_property()] and read with
257    /// [`child_property()`][Self::child_property()]. A change in the property
258    /// will also appear in the [`deep-notify`][struct@crate::TimelineElement#deep-notify] signal.
259    ///
260    /// `pspec` should be unique from other children properties that have been
261    /// registered on `self`.
262    /// ## `pspec`
263    /// The specification for the property to add
264    /// ## `child`
265    /// The [`gst::Object`][crate::gst::Object] who the property belongs to
266    ///
267    /// # Returns
268    ///
269    /// [`true`] if the property was successfully registered.
270    #[doc(alias = "ges_timeline_element_add_child_property")]
271    fn add_child_property(
272        &self,
273        pspec: impl AsRef<glib::ParamSpec>,
274        child: &impl IsA<glib::Object>,
275    ) -> Result<(), glib::error::BoolError> {
276        unsafe {
277            glib::result_from_gboolean!(
278                ffi::ges_timeline_element_add_child_property(
279                    self.as_ref().to_glib_none().0,
280                    pspec.as_ref().to_glib_none().0,
281                    child.as_ref().to_glib_none().0
282                ),
283                "Failed to add child property"
284            )
285        }
286    }
287
288    #[doc(alias = "ges_timeline_element_copy")]
289    #[must_use]
290    fn copy(&self, deep: bool) -> TimelineElement {
291        unsafe {
292            from_glib_none(ffi::ges_timeline_element_copy(
293                self.as_ref().to_glib_none().0,
294                deep.into_glib(),
295            ))
296        }
297    }
298
299    /// See [`edit_full()`][Self::edit_full()], which also gives an error.
300    ///
301    /// Note that the `layers` argument is currently ignored, so you should
302    /// just pass [`None`].
303    /// ## `layers`
304    /// A whitelist of layers
305    /// where the edit can be performed, [`None`] allows all layers in the
306    /// timeline.
307    /// ## `new_layer_priority`
308    /// The priority/index of the layer `self` should be
309    /// moved to. -1 means no move
310    /// ## `mode`
311    /// The edit mode
312    /// ## `edge`
313    /// The edge of `self` where the edit should occur
314    /// ## `position`
315    /// The edit position: a new location for the edge of `self`
316    /// (in nanoseconds) in the timeline coordinates
317    ///
318    /// # Returns
319    ///
320    /// [`true`] if the edit of `self` completed, [`false`] on failure.
321    #[cfg(feature = "v1_18")]
322    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
323    #[doc(alias = "ges_timeline_element_edit")]
324    fn edit(
325        &self,
326        layers: &[Layer],
327        new_layer_priority: i64,
328        mode: EditMode,
329        edge: Edge,
330        position: u64,
331    ) -> bool {
332        unsafe {
333            from_glib(ffi::ges_timeline_element_edit(
334                self.as_ref().to_glib_none().0,
335                layers.to_glib_none().0,
336                new_layer_priority,
337                mode.into_glib(),
338                edge.into_glib(),
339                position,
340            ))
341        }
342    }
343
344    /// Edits the element within its timeline by adjusting its
345    /// [`start`][struct@crate::TimelineElement#start], [`duration`][struct@crate::TimelineElement#duration] or
346    /// [`in-point`][struct@crate::TimelineElement#in-point], and potentially doing the same for
347    /// other elements in the timeline. See [`EditMode`][crate::EditMode] for details about each
348    /// edit mode. An edit may fail if it would place one of these properties
349    /// out of bounds, or if it would place the timeline in an unsupported
350    /// configuration.
351    ///
352    /// Note that if you act on a [`TrackElement`][crate::TrackElement], this will edit its parent
353    /// [`Clip`][crate::Clip] instead. Moreover, for any [`TimelineElement`][crate::TimelineElement], if you select
354    /// [`Edge::None`][crate::Edge::None] for [`EditMode::Normal`][crate::EditMode::Normal] or [`EditMode::Ripple`][crate::EditMode::Ripple], this
355    /// will edit the toplevel instead, but still in such a way as to make the
356    /// [`start`][struct@crate::TimelineElement#start] of `self` reach the edit `position`.
357    ///
358    /// Note that if the element's timeline has a
359    /// [`snapping-distance`][struct@crate::Timeline#snapping-distance] set, then the edit position may be
360    /// snapped to the edge of some element under the edited element.
361    ///
362    /// `new_layer_priority` can be used to switch `self`, and other elements
363    /// moved by the edit, to a new layer. New layers may be be created if the
364    /// the corresponding layer priority/index does not yet exist for the
365    /// timeline.
366    /// ## `new_layer_priority`
367    /// The priority/index of the layer `self` should be
368    /// moved to. -1 means no move
369    /// ## `mode`
370    /// The edit mode
371    /// ## `edge`
372    /// The edge of `self` where the edit should occur
373    /// ## `position`
374    /// The edit position: a new location for the edge of `self`
375    /// (in nanoseconds) in the timeline coordinates
376    ///
377    /// # Returns
378    ///
379    /// [`true`] if the edit of `self` completed, [`false`] on failure.
380    #[cfg(feature = "v1_18")]
381    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
382    #[doc(alias = "ges_timeline_element_edit_full")]
383    fn edit_full(
384        &self,
385        new_layer_priority: i64,
386        mode: EditMode,
387        edge: Edge,
388        position: u64,
389    ) -> Result<(), glib::Error> {
390        unsafe {
391            let mut error = std::ptr::null_mut();
392            let is_ok = ffi::ges_timeline_element_edit_full(
393                self.as_ref().to_glib_none().0,
394                new_layer_priority,
395                mode.into_glib(),
396                edge.into_glib(),
397                position,
398                &mut error,
399            );
400            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
401            if error.is_null() {
402                Ok(())
403            } else {
404                Err(from_glib_full(error))
405            }
406        }
407    }
408
409    //#[doc(alias = "ges_timeline_element_get_child_properties")]
410    //#[doc(alias = "get_child_properties")]
411    //fn child_properties(&self, first_property_name: &str, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) {
412    //    unsafe { TODO: call ffi:ges_timeline_element_get_child_properties() }
413    //}
414
415    /// Gets the property of a child of the element.
416    ///
417    /// `property_name` can either be in the format "prop-name" or
418    /// "TypeName::prop-name", where "prop-name" is the name of the property
419    /// to get (as used in [`ObjectExt::get()`][crate::glib::prelude::ObjectExt::get()]), and "TypeName" is the type name of
420    /// the child (as returned by G_OBJECT_TYPE_NAME()). The latter format is
421    /// useful when two children of different types share the same property
422    /// name.
423    ///
424    /// The first child found with the given "prop-name" property that was
425    /// registered with [`add_child_property()`][Self::add_child_property()] (and of the
426    /// type "TypeName", if it was given) will have the corresponding
427    /// property copied into `value`.
428    ///
429    /// Note that `ges_timeline_element_get_child_properties()` may be more
430    /// convenient for C programming.
431    /// ## `property_name`
432    /// The name of the child property to get
433    ///
434    /// # Returns
435    ///
436    /// [`true`] if the property was found and copied to `value`.
437    ///
438    /// ## `value`
439    /// The return location for the value
440    #[doc(alias = "ges_timeline_element_get_child_property")]
441    #[doc(alias = "get_child_property")]
442    fn child_property(&self, property_name: &str) -> Option<glib::Value> {
443        unsafe {
444            let mut value = glib::Value::uninitialized();
445            let ret = from_glib(ffi::ges_timeline_element_get_child_property(
446                self.as_ref().to_glib_none().0,
447                property_name.to_glib_none().0,
448                value.to_glib_none_mut().0,
449            ));
450            if ret {
451                Some(value)
452            } else {
453                None
454            }
455        }
456    }
457
458    /// Gets the property of a child of the element. Specifically, the property
459    /// corresponding to the `pspec` used in
460    /// [`add_child_property()`][Self::add_child_property()] is copied into `value`.
461    /// ## `pspec`
462    /// The specification of a registered child property to get
463    ///
464    /// # Returns
465    ///
466    ///
467    /// ## `value`
468    /// The return location for the value
469    #[doc(alias = "ges_timeline_element_get_child_property_by_pspec")]
470    #[doc(alias = "get_child_property_by_pspec")]
471    fn child_property_by_pspec(&self, pspec: impl AsRef<glib::ParamSpec>) -> glib::Value {
472        unsafe {
473            let mut value = glib::Value::uninitialized();
474            ffi::ges_timeline_element_get_child_property_by_pspec(
475                self.as_ref().to_glib_none().0,
476                pspec.as_ref().to_glib_none().0,
477                value.to_glib_none_mut().0,
478            );
479            value
480        }
481    }
482
483    //#[doc(alias = "ges_timeline_element_get_child_property_valist")]
484    //#[doc(alias = "get_child_property_valist")]
485    //fn child_property_valist(&self, first_property_name: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported) {
486    //    unsafe { TODO: call ffi:ges_timeline_element_get_child_property_valist() }
487    //}
488
489    /// Gets the [`duration`][struct@crate::TimelineElement#duration] for the element.
490    ///
491    /// # Returns
492    ///
493    /// The duration of `self` (in nanoseconds).
494    #[doc(alias = "ges_timeline_element_get_duration")]
495    #[doc(alias = "get_duration")]
496    fn duration(&self) -> gst::ClockTime {
497        unsafe {
498            try_from_glib(ffi::ges_timeline_element_get_duration(
499                self.as_ref().to_glib_none().0,
500            ))
501            .expect("mandatory glib value is None")
502        }
503    }
504
505    /// Gets the [`in-point`][struct@crate::TimelineElement#in-point] for the element.
506    ///
507    /// # Returns
508    ///
509    /// The in-point of `self` (in nanoseconds).
510    #[doc(alias = "ges_timeline_element_get_inpoint")]
511    #[doc(alias = "get_inpoint")]
512    #[doc(alias = "in-point")]
513    fn inpoint(&self) -> gst::ClockTime {
514        unsafe {
515            try_from_glib(ffi::ges_timeline_element_get_inpoint(
516                self.as_ref().to_glib_none().0,
517            ))
518            .expect("mandatory glib value is None")
519        }
520    }
521
522    /// Gets the priority of the layer the element is in. A [`Group`][crate::Group] may span
523    /// several layers, so this would return the highest priority (numerically,
524    /// the smallest) amongst them.
525    ///
526    /// # Returns
527    ///
528    /// The priority of the layer `self` is in, or
529    /// `GES_TIMELINE_ELEMENT_NO_LAYER_PRIORITY` if `self` does not exist in a
530    /// layer.
531    #[cfg(feature = "v1_16")]
532    #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
533    #[doc(alias = "ges_timeline_element_get_layer_priority")]
534    #[doc(alias = "get_layer_priority")]
535    fn layer_priority(&self) -> u32 {
536        unsafe { ffi::ges_timeline_element_get_layer_priority(self.as_ref().to_glib_none().0) }
537    }
538
539    /// Gets the [`max-duration`][struct@crate::TimelineElement#max-duration] for the element.
540    ///
541    /// # Returns
542    ///
543    /// The max-duration of `self` (in nanoseconds).
544    #[doc(alias = "ges_timeline_element_get_max_duration")]
545    #[doc(alias = "get_max_duration")]
546    #[doc(alias = "max-duration")]
547    fn max_duration(&self) -> Option<gst::ClockTime> {
548        unsafe {
549            from_glib(ffi::ges_timeline_element_get_max_duration(
550                self.as_ref().to_glib_none().0,
551            ))
552        }
553    }
554
555    /// Gets the [`name`][struct@crate::TimelineElement#name] for the element.
556    ///
557    /// # Returns
558    ///
559    /// The name of `self`.
560    #[doc(alias = "ges_timeline_element_get_name")]
561    #[doc(alias = "get_name")]
562    fn name(&self) -> Option<glib::GString> {
563        unsafe {
564            from_glib_full(ffi::ges_timeline_element_get_name(
565                self.as_ref().to_glib_none().0,
566            ))
567        }
568    }
569
570    /// Get the "natural" framerate of `self`. This is to say, for example
571    /// for a [`VideoUriSource`][crate::VideoUriSource] the framerate of the source.
572    ///
573    /// Note that a [`AudioSource`][crate::AudioSource] may also have a natural framerate if it derives
574    /// from the same [`SourceClip`][crate::SourceClip] asset as a [`VideoSource`][crate::VideoSource], and its value will
575    /// be that of the video source. For example, if the uri of a [`UriClip`][crate::UriClip] points
576    /// to a file that contains both a video and audio stream, then the corresponding
577    /// [`AudioUriSource`][crate::AudioUriSource] will share the natural framerate of the corresponding
578    /// [`VideoUriSource`][crate::VideoUriSource].
579    ///
580    /// # Returns
581    ///
582    /// Whether `self` has a natural framerate or not, `framerate_n`
583    /// and `framerate_d` will be set to, respectively, 0 and -1 if it is
584    /// not the case.
585    ///
586    /// ## `framerate_n`
587    /// The framerate numerator
588    ///
589    /// ## `framerate_d`
590    /// The framerate denominator
591    #[cfg(feature = "v1_18")]
592    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
593    #[doc(alias = "ges_timeline_element_get_natural_framerate")]
594    #[doc(alias = "get_natural_framerate")]
595    fn natural_framerate(&self) -> Option<(i32, i32)> {
596        unsafe {
597            let mut framerate_n = std::mem::MaybeUninit::uninit();
598            let mut framerate_d = std::mem::MaybeUninit::uninit();
599            let ret = from_glib(ffi::ges_timeline_element_get_natural_framerate(
600                self.as_ref().to_glib_none().0,
601                framerate_n.as_mut_ptr(),
602                framerate_d.as_mut_ptr(),
603            ));
604            if ret {
605                Some((framerate_n.assume_init(), framerate_d.assume_init()))
606            } else {
607                None
608            }
609        }
610    }
611
612    /// Gets the [`parent`][struct@crate::TimelineElement#parent] for the element.
613    ///
614    /// # Returns
615    ///
616    /// The parent of `self`, or [`None`] if
617    /// `self` has no parent.
618    #[doc(alias = "ges_timeline_element_get_parent")]
619    #[doc(alias = "get_parent")]
620    #[must_use]
621    fn parent(&self) -> Option<TimelineElement> {
622        unsafe {
623            from_glib_full(ffi::ges_timeline_element_get_parent(
624                self.as_ref().to_glib_none().0,
625            ))
626        }
627    }
628
629    /// Gets the [`priority`][struct@crate::TimelineElement#priority] for the element.
630    ///
631    /// # Returns
632    ///
633    /// The priority of `self`.
634    #[doc(alias = "ges_timeline_element_get_priority")]
635    #[doc(alias = "get_priority")]
636    fn priority(&self) -> u32 {
637        unsafe { ffi::ges_timeline_element_get_priority(self.as_ref().to_glib_none().0) }
638    }
639
640    /// Gets the [`start`][struct@crate::TimelineElement#start] for the element.
641    ///
642    /// # Returns
643    ///
644    /// The start of `self` (in nanoseconds).
645    #[doc(alias = "ges_timeline_element_get_start")]
646    #[doc(alias = "get_start")]
647    fn start(&self) -> gst::ClockTime {
648        unsafe {
649            try_from_glib(ffi::ges_timeline_element_get_start(
650                self.as_ref().to_glib_none().0,
651            ))
652            .expect("mandatory glib value is None")
653        }
654    }
655
656    /// Gets the [`timeline`][struct@crate::TimelineElement#timeline] for the element.
657    ///
658    /// # Returns
659    ///
660    /// The timeline of `self`, or [`None`]
661    /// if `self` has no timeline.
662    #[doc(alias = "ges_timeline_element_get_timeline")]
663    #[doc(alias = "get_timeline")]
664    fn timeline(&self) -> Option<Timeline> {
665        unsafe {
666            from_glib_full(ffi::ges_timeline_element_get_timeline(
667                self.as_ref().to_glib_none().0,
668            ))
669        }
670    }
671
672    /// Gets the toplevel [`parent`][struct@crate::TimelineElement#parent] of the element.
673    ///
674    /// # Returns
675    ///
676    /// The toplevel parent of `self`.
677    #[doc(alias = "ges_timeline_element_get_toplevel_parent")]
678    #[doc(alias = "get_toplevel_parent")]
679    #[must_use]
680    fn toplevel_parent(&self) -> TimelineElement {
681        unsafe {
682            from_glib_full(ffi::ges_timeline_element_get_toplevel_parent(
683                self.as_ref().to_glib_none().0,
684            ))
685        }
686    }
687
688    /// Gets the track types that the element can interact with, i.e. the type
689    /// of [`Track`][crate::Track] it can exist in, or will create [`TrackElement`][crate::TrackElement]-s for.
690    ///
691    /// # Returns
692    ///
693    /// The track types that `self` supports.
694    #[doc(alias = "ges_timeline_element_get_track_types")]
695    #[doc(alias = "get_track_types")]
696    fn track_types(&self) -> TrackType {
697        unsafe {
698            from_glib(ffi::ges_timeline_element_get_track_types(
699                self.as_ref().to_glib_none().0,
700            ))
701        }
702    }
703
704    /// Get a list of children properties of the element, which is a list of
705    /// all the specifications passed to
706    /// [`add_child_property()`][Self::add_child_property()].
707    ///
708    /// # Returns
709    ///
710    /// An array of
711    /// [`glib::ParamSpec`][crate::glib::ParamSpec] corresponding to the child properties of `self`, or [`None`] if
712    /// something went wrong.
713    #[doc(alias = "ges_timeline_element_list_children_properties")]
714    fn list_children_properties(&self) -> Vec<glib::ParamSpec> {
715        unsafe {
716            let mut n_properties = std::mem::MaybeUninit::uninit();
717            let ret = FromGlibContainer::from_glib_full_num(
718                ffi::ges_timeline_element_list_children_properties(
719                    self.as_ref().to_glib_none().0,
720                    n_properties.as_mut_ptr(),
721                ),
722                n_properties.assume_init() as _,
723            );
724            ret
725        }
726    }
727
728    /// Looks up a child property of the element.
729    ///
730    /// `prop_name` can either be in the format "prop-name" or
731    /// "TypeName::prop-name", where "prop-name" is the name of the property
732    /// to look up (as used in [`ObjectExt::get()`][crate::glib::prelude::ObjectExt::get()]), and "TypeName" is the type name
733    /// of the child (as returned by G_OBJECT_TYPE_NAME()). The latter format is
734    /// useful when two children of different types share the same property
735    /// name.
736    ///
737    /// The first child found with the given "prop-name" property that was
738    /// registered with [`add_child_property()`][Self::add_child_property()] (and of the
739    /// type "TypeName", if it was given) will be passed to `child`, and the
740    /// registered specification of this property will be passed to `pspec`.
741    /// ## `prop_name`
742    /// The name of a child property
743    ///
744    /// # Returns
745    ///
746    /// [`true`] if a child corresponding to the property was found, in
747    /// which case `child` and `pspec` are set.
748    ///
749    /// ## `child`
750    /// The return location for the
751    /// found child
752    ///
753    /// ## `pspec`
754    /// The return location for the
755    /// specification of the child property
756    #[doc(alias = "ges_timeline_element_lookup_child")]
757    fn lookup_child(&self, prop_name: &str) -> Option<(glib::Object, glib::ParamSpec)> {
758        unsafe {
759            let mut child = std::ptr::null_mut();
760            let mut pspec = std::ptr::null_mut();
761            let ret = from_glib(ffi::ges_timeline_element_lookup_child(
762                self.as_ref().to_glib_none().0,
763                prop_name.to_glib_none().0,
764                &mut child,
765                &mut pspec,
766            ));
767            if ret {
768                Some((from_glib_full(child), from_glib_full(pspec)))
769            } else {
770                None
771            }
772        }
773    }
774
775    /// Paste an element inside the same timeline and layer as `self`. `self`
776    /// **must** be the return of `ges_timeline_element_copy()` with `deep=TRUE`,
777    /// and it should not be changed before pasting.
778    /// `self` is not placed in the timeline, instead a new element is created,
779    /// alike to the originally copied element. Note that the originally
780    /// copied element must stay within the same timeline and layer, at both
781    /// the point of copying and pasting.
782    ///
783    /// Pasting may fail if it would place the timeline in an unsupported
784    /// configuration.
785    ///
786    /// After calling this function `element` should not be used. In particular,
787    /// `element` can **not** be pasted again. Instead, you can copy the
788    /// returned element and paste that copy (although, this is only possible
789    /// if the paste was successful).
790    ///
791    /// See also [`TimelineExt::paste_element()`][crate::prelude::TimelineExt::paste_element()].
792    /// ## `paste_position`
793    /// The position in the timeline `element` should be pasted
794    /// to, i.e. the [`start`][struct@crate::TimelineElement#start] value for the pasted element.
795    ///
796    /// # Returns
797    ///
798    /// The newly created element, or
799    /// [`None`] if pasting fails.
800    #[doc(alias = "ges_timeline_element_paste")]
801    fn paste(&self, paste_position: gst::ClockTime) -> Result<TimelineElement, glib::BoolError> {
802        unsafe {
803            Option::<_>::from_glib_full(ffi::ges_timeline_element_paste(
804                self.as_ref().to_glib_none().0,
805                paste_position.into_glib(),
806            ))
807            .ok_or_else(|| glib::bool_error!("Failed to paste timeline element"))
808        }
809    }
810
811    /// Remove a child property from the element. `pspec` should be a
812    /// specification that was passed to
813    /// [`add_child_property()`][Self::add_child_property()]. The corresponding property
814    /// will no longer be registered as a child property for the element.
815    /// ## `pspec`
816    /// The specification for the property to remove
817    ///
818    /// # Returns
819    ///
820    /// [`true`] if the property was successfully un-registered for `self`.
821    #[doc(alias = "ges_timeline_element_remove_child_property")]
822    fn remove_child_property(
823        &self,
824        pspec: impl AsRef<glib::ParamSpec>,
825    ) -> Result<(), glib::error::BoolError> {
826        unsafe {
827            glib::result_from_gboolean!(
828                ffi::ges_timeline_element_remove_child_property(
829                    self.as_ref().to_glib_none().0,
830                    pspec.as_ref().to_glib_none().0
831                ),
832                "Failed to remove child property"
833            )
834        }
835    }
836
837    /// Edits the start time of an element within its timeline in ripple mode.
838    /// See [`edit()`][Self::edit()] with [`EditMode::Ripple`][crate::EditMode::Ripple] and
839    /// [`Edge::None`][crate::Edge::None].
840    /// ## `start`
841    /// The new start time of `self` in ripple mode
842    ///
843    /// # Returns
844    ///
845    /// [`true`] if the ripple edit of `self` completed, [`false`] on
846    /// failure.
847    #[doc(alias = "ges_timeline_element_ripple")]
848    fn ripple(&self, start: gst::ClockTime) -> Result<(), glib::error::BoolError> {
849        unsafe {
850            glib::result_from_gboolean!(
851                ffi::ges_timeline_element_ripple(self.as_ref().to_glib_none().0, start.into_glib()),
852                "Failed to ripple"
853            )
854        }
855    }
856
857    /// Edits the end time of an element within its timeline in ripple mode.
858    /// See [`edit()`][Self::edit()] with [`EditMode::Ripple`][crate::EditMode::Ripple] and
859    /// [`Edge::End`][crate::Edge::End].
860    /// ## `end`
861    /// The new end time of `self` in ripple mode
862    ///
863    /// # Returns
864    ///
865    /// [`true`] if the ripple edit of `self` completed, [`false`] on
866    /// failure.
867    #[doc(alias = "ges_timeline_element_ripple_end")]
868    fn ripple_end(&self, end: gst::ClockTime) -> Result<(), glib::error::BoolError> {
869        unsafe {
870            glib::result_from_gboolean!(
871                ffi::ges_timeline_element_ripple_end(
872                    self.as_ref().to_glib_none().0,
873                    end.into_glib()
874                ),
875                "Failed to ripple"
876            )
877        }
878    }
879
880    /// Edits the end time of an element within its timeline in roll mode.
881    /// See [`edit()`][Self::edit()] with [`EditMode::Roll`][crate::EditMode::Roll] and
882    /// [`Edge::End`][crate::Edge::End].
883    /// ## `end`
884    /// The new end time of `self` in roll mode
885    ///
886    /// # Returns
887    ///
888    /// [`true`] if the roll edit of `self` completed, [`false`] on failure.
889    #[doc(alias = "ges_timeline_element_roll_end")]
890    fn roll_end(&self, end: gst::ClockTime) -> Result<(), glib::error::BoolError> {
891        unsafe {
892            glib::result_from_gboolean!(
893                ffi::ges_timeline_element_roll_end(self.as_ref().to_glib_none().0, end.into_glib()),
894                "Failed to roll"
895            )
896        }
897    }
898
899    /// Edits the start time of an element within its timeline in roll mode.
900    /// See [`edit()`][Self::edit()] with [`EditMode::Roll`][crate::EditMode::Roll] and
901    /// [`Edge::Start`][crate::Edge::Start].
902    /// ## `start`
903    /// The new start time of `self` in roll mode
904    ///
905    /// # Returns
906    ///
907    /// [`true`] if the roll edit of `self` completed, [`false`] on failure.
908    #[doc(alias = "ges_timeline_element_roll_start")]
909    fn roll_start(&self, start: gst::ClockTime) -> Result<(), glib::error::BoolError> {
910        unsafe {
911            glib::result_from_gboolean!(
912                ffi::ges_timeline_element_roll_start(
913                    self.as_ref().to_glib_none().0,
914                    start.into_glib()
915                ),
916                "Failed to roll"
917            )
918        }
919    }
920
921    //#[doc(alias = "ges_timeline_element_set_child_properties")]
922    //fn set_child_properties(&self, first_property_name: &str, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) {
923    //    unsafe { TODO: call ffi:ges_timeline_element_set_child_properties() }
924    //}
925
926    /// See [`set_child_property_full()`][Self::set_child_property_full()], which also gives an
927    /// error.
928    ///
929    /// Note that `ges_timeline_element_set_child_properties()` may be more
930    /// convenient for C programming.
931    /// ## `property_name`
932    /// The name of the child property to set
933    /// ## `value`
934    /// The value to set the property to
935    ///
936    /// # Returns
937    ///
938    /// [`true`] if the property was found and set.
939    #[doc(alias = "ges_timeline_element_set_child_property")]
940    fn set_child_property(
941        &self,
942        property_name: &str,
943        value: &glib::Value,
944    ) -> Result<(), glib::error::BoolError> {
945        unsafe {
946            glib::result_from_gboolean!(
947                ffi::ges_timeline_element_set_child_property(
948                    self.as_ref().to_glib_none().0,
949                    property_name.to_glib_none().0,
950                    value.to_glib_none().0
951                ),
952                "Failed to set child property"
953            )
954        }
955    }
956
957    /// Sets the property of a child of the element. Specifically, the property
958    /// corresponding to the `pspec` used in
959    /// [`add_child_property()`][Self::add_child_property()] is set to `value`.
960    /// ## `pspec`
961    /// The specification of a registered child property to set
962    /// ## `value`
963    /// The value to set the property to
964    #[doc(alias = "ges_timeline_element_set_child_property_by_pspec")]
965    fn set_child_property_by_pspec(&self, pspec: impl AsRef<glib::ParamSpec>, value: &glib::Value) {
966        unsafe {
967            ffi::ges_timeline_element_set_child_property_by_pspec(
968                self.as_ref().to_glib_none().0,
969                pspec.as_ref().to_glib_none().0,
970                value.to_glib_none().0,
971            );
972        }
973    }
974
975    /// Sets the property of a child of the element.
976    ///
977    /// `property_name` can either be in the format "prop-name" or
978    /// "TypeName::prop-name", where "prop-name" is the name of the property
979    /// to set (as used in [`ObjectExt::set()`][crate::glib::prelude::ObjectExt::set()]), and "TypeName" is the type name of
980    /// the child (as returned by G_OBJECT_TYPE_NAME()). The latter format is
981    /// useful when two children of different types share the same property
982    /// name.
983    ///
984    /// The first child found with the given "prop-name" property that was
985    /// registered with [`add_child_property()`][Self::add_child_property()] (and of the
986    /// type "TypeName", if it was given) will have the corresponding
987    /// property set to `value`. Other children that may have also matched the
988    /// property name (and type name) are left unchanged!
989    /// ## `property_name`
990    /// The name of the child property to set
991    /// ## `value`
992    /// The value to set the property to
993    ///
994    /// # Returns
995    ///
996    /// [`true`] if the property was found and set.
997    #[cfg(feature = "v1_18")]
998    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
999    #[doc(alias = "ges_timeline_element_set_child_property_full")]
1000    fn set_child_property_full(
1001        &self,
1002        property_name: &str,
1003        value: &glib::Value,
1004    ) -> Result<(), glib::Error> {
1005        unsafe {
1006            let mut error = std::ptr::null_mut();
1007            let is_ok = ffi::ges_timeline_element_set_child_property_full(
1008                self.as_ref().to_glib_none().0,
1009                property_name.to_glib_none().0,
1010                value.to_glib_none().0,
1011                &mut error,
1012            );
1013            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
1014            if error.is_null() {
1015                Ok(())
1016            } else {
1017                Err(from_glib_full(error))
1018            }
1019        }
1020    }
1021
1022    //#[doc(alias = "ges_timeline_element_set_child_property_valist")]
1023    //fn set_child_property_valist(&self, first_property_name: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported) {
1024    //    unsafe { TODO: call ffi:ges_timeline_element_set_child_property_valist() }
1025    //}
1026
1027    /// Sets [`duration`][struct@crate::TimelineElement#duration] for the element.
1028    ///
1029    /// Whilst the element is part of a [`Timeline`][crate::Timeline], this is the same as
1030    /// editing the element with [`edit()`][Self::edit()] under
1031    /// [`EditMode::Trim`][crate::EditMode::Trim] with [`Edge::End`][crate::Edge::End]. In particular, the
1032    /// [`duration`][struct@crate::TimelineElement#duration] of the element may be snapped to a
1033    /// different timeline time difference from the one given. In addition,
1034    /// setting may fail if it would place the timeline in an unsupported
1035    /// configuration, or the element does not have enough internal content to
1036    /// last the desired duration.
1037    /// ## `duration`
1038    /// The desired duration in its timeline
1039    ///
1040    /// # Returns
1041    ///
1042    /// [`true`] if `duration` could be set for `self`.
1043    #[doc(alias = "ges_timeline_element_set_duration")]
1044    #[doc(alias = "duration")]
1045    fn set_duration(&self, duration: impl Into<Option<gst::ClockTime>>) -> bool {
1046        unsafe {
1047            from_glib(ffi::ges_timeline_element_set_duration(
1048                self.as_ref().to_glib_none().0,
1049                duration.into().into_glib(),
1050            ))
1051        }
1052    }
1053
1054    /// Sets [`in-point`][struct@crate::TimelineElement#in-point] for the element. If the new in-point
1055    /// is above the current [`max-duration`][struct@crate::TimelineElement#max-duration] of the element,
1056    /// this method will fail.
1057    /// ## `inpoint`
1058    /// The in-point, in internal time coordinates
1059    ///
1060    /// # Returns
1061    ///
1062    /// [`true`] if `inpoint` could be set for `self`.
1063    #[doc(alias = "ges_timeline_element_set_inpoint")]
1064    #[doc(alias = "in-point")]
1065    fn set_inpoint(&self, inpoint: gst::ClockTime) -> bool {
1066        unsafe {
1067            from_glib(ffi::ges_timeline_element_set_inpoint(
1068                self.as_ref().to_glib_none().0,
1069                inpoint.into_glib(),
1070            ))
1071        }
1072    }
1073
1074    /// Sets [`max-duration`][struct@crate::TimelineElement#max-duration] for the element. If the new
1075    /// maximum duration is below the current [`in-point`][struct@crate::TimelineElement#in-point] of
1076    /// the element, this method will fail.
1077    /// ## `maxduration`
1078    /// The maximum duration, in internal time coordinates
1079    ///
1080    /// # Returns
1081    ///
1082    /// [`true`] if `maxduration` could be set for `self`.
1083    #[doc(alias = "ges_timeline_element_set_max_duration")]
1084    #[doc(alias = "max-duration")]
1085    fn set_max_duration(&self, maxduration: impl Into<Option<gst::ClockTime>>) -> bool {
1086        unsafe {
1087            from_glib(ffi::ges_timeline_element_set_max_duration(
1088                self.as_ref().to_glib_none().0,
1089                maxduration.into().into_glib(),
1090            ))
1091        }
1092    }
1093
1094    /// Sets the [`name`][struct@crate::TimelineElement#name] for the element. If [`None`] is given
1095    /// for `name`, then the library will instead generate a new name based on
1096    /// the type name of the element, such as the name "uriclip3" for a
1097    /// [`UriClip`][crate::UriClip], and will set that name instead.
1098    ///
1099    /// If `self` already has a [`timeline`][struct@crate::TimelineElement#timeline], you should not
1100    /// call this function with `name` set to [`None`].
1101    ///
1102    /// You should ensure that, within each [`Timeline`][crate::Timeline], every element has a
1103    /// unique name. If you call this function with `name` as [`None`], then
1104    /// the library should ensure that the set generated name is unique from
1105    /// previously **generated** names. However, if you choose a `name` that
1106    /// interferes with the naming conventions of the library, the library will
1107    /// attempt to ensure that the generated names will not conflict with the
1108    /// chosen name, which may lead to a different name being set instead, but
1109    /// the uniqueness between generated and user-chosen names is not
1110    /// guaranteed.
1111    /// ## `name`
1112    /// The name `self` should take
1113    ///
1114    /// # Returns
1115    ///
1116    /// [`true`] if `name` or a generated name for `self` could be set.
1117    #[doc(alias = "ges_timeline_element_set_name")]
1118    #[doc(alias = "name")]
1119    fn set_name(&self, name: Option<&str>) -> Result<(), glib::error::BoolError> {
1120        unsafe {
1121            glib::result_from_gboolean!(
1122                ffi::ges_timeline_element_set_name(
1123                    self.as_ref().to_glib_none().0,
1124                    name.to_glib_none().0
1125                ),
1126                "Failed to set name"
1127            )
1128        }
1129    }
1130
1131    /// Sets the [`parent`][struct@crate::TimelineElement#parent] for the element.
1132    ///
1133    /// This is used internally and you should normally not call this. A
1134    /// [`Container`][crate::Container] will set the [`parent`][struct@crate::TimelineElement#parent] of its children
1135    /// in [`GESContainerExt::add()`][crate::prelude::GESContainerExt::add()] and [`GESContainerExt::remove()`][crate::prelude::GESContainerExt::remove()].
1136    ///
1137    /// Note, if `parent` is not [`None`], `self` must not already have a parent
1138    /// set. Therefore, if you wish to switch parents, you will need to call
1139    /// this function twice: first to set the parent to [`None`], and then to the
1140    /// new parent.
1141    ///
1142    /// If `parent` is not [`None`], you must ensure it already has a
1143    /// (non-floating) reference to `self` before calling this.
1144    ///
1145    /// # Returns
1146    ///
1147    /// [`true`] if `parent` could be set for `self`.
1148    #[doc(alias = "ges_timeline_element_set_parent")]
1149    #[doc(alias = "parent")]
1150    fn set_parent(&self, parent: &impl IsA<TimelineElement>) -> Result<(), glib::error::BoolError> {
1151        unsafe {
1152            glib::result_from_gboolean!(
1153                ffi::ges_timeline_element_set_parent(
1154                    self.as_ref().to_glib_none().0,
1155                    parent.as_ref().to_glib_none().0
1156                ),
1157                "`TimelineElement` already had a parent or its parent was the same as specified"
1158            )
1159        }
1160    }
1161
1162    /// Sets the priority of the element within the containing layer.
1163    ///
1164    /// # Deprecated since 1.10
1165    ///
1166    /// All priority management is done by GES itself now.
1167    /// To set [`Effect`][crate::Effect] priorities `ges_clip_set_top_effect_index` should
1168    /// be used.
1169    /// ## `priority`
1170    /// The priority
1171    ///
1172    /// # Returns
1173    ///
1174    /// [`true`] if `priority` could be set for `self`.
1175    #[deprecated = "Since 1.10"]
1176    #[allow(deprecated)]
1177    #[doc(alias = "ges_timeline_element_set_priority")]
1178    #[doc(alias = "priority")]
1179    fn set_priority(&self, priority: u32) -> bool {
1180        unsafe {
1181            from_glib(ffi::ges_timeline_element_set_priority(
1182                self.as_ref().to_glib_none().0,
1183                priority,
1184            ))
1185        }
1186    }
1187
1188    /// Sets [`start`][struct@crate::TimelineElement#start] for the element. If the element has a
1189    /// parent, this will also move its siblings with the same shift.
1190    ///
1191    /// Whilst the element is part of a [`Timeline`][crate::Timeline], this is the same as
1192    /// editing the element with [`edit()`][Self::edit()] under
1193    /// [`EditMode::Normal`][crate::EditMode::Normal] with [`Edge::None`][crate::Edge::None]. In particular, the
1194    /// [`start`][struct@crate::TimelineElement#start] of the element may be snapped to a different
1195    /// timeline time from the one given. In addition, setting may fail if it
1196    /// would place the timeline in an unsupported configuration.
1197    /// ## `start`
1198    /// The desired start position of the element in its timeline
1199    ///
1200    /// # Returns
1201    ///
1202    /// [`true`] if `start` could be set for `self`.
1203    #[doc(alias = "ges_timeline_element_set_start")]
1204    #[doc(alias = "start")]
1205    fn set_start(&self, start: gst::ClockTime) -> bool {
1206        unsafe {
1207            from_glib(ffi::ges_timeline_element_set_start(
1208                self.as_ref().to_glib_none().0,
1209                start.into_glib(),
1210            ))
1211        }
1212    }
1213
1214    /// Sets the [`timeline`][struct@crate::TimelineElement#timeline] of the element.
1215    ///
1216    /// This is used internally and you should normally not call this. A
1217    /// [`Clip`][crate::Clip] will have its [`timeline`][struct@crate::TimelineElement#timeline] set through its
1218    /// [`Layer`][crate::Layer]. A [`Track`][crate::Track] will similarly take care of setting the
1219    /// [`timeline`][struct@crate::TimelineElement#timeline] of its [`TrackElement`][crate::TrackElement]-s. A [`Group`][crate::Group]
1220    /// will adopt the same [`timeline`][struct@crate::TimelineElement#timeline] as its children.
1221    ///
1222    /// If `timeline` is [`None`], this will stop its current
1223    /// [`timeline`][struct@crate::TimelineElement#timeline] from tracking it, otherwise `timeline` will
1224    /// start tracking `self`. Note, in the latter case, `self` must not already
1225    /// have a timeline set. Therefore, if you wish to switch timelines, you
1226    /// will need to call this function twice: first to set the timeline to
1227    /// [`None`], and then to the new timeline.
1228    ///
1229    /// # Returns
1230    ///
1231    /// [`true`] if `timeline` could be set for `self`.
1232    #[doc(alias = "ges_timeline_element_set_timeline")]
1233    #[doc(alias = "timeline")]
1234    fn set_timeline(&self, timeline: &impl IsA<Timeline>) -> Result<(), glib::error::BoolError> {
1235        unsafe {
1236            glib::result_from_gboolean!(
1237                ffi::ges_timeline_element_set_timeline(
1238                    self.as_ref().to_glib_none().0,
1239                    timeline.as_ref().to_glib_none().0
1240                ),
1241                "`Failed to set timeline"
1242            )
1243        }
1244    }
1245
1246    /// Edits the start time of an element within its timeline in trim mode.
1247    /// See [`edit()`][Self::edit()] with [`EditMode::Trim`][crate::EditMode::Trim] and
1248    /// [`Edge::Start`][crate::Edge::Start].
1249    /// ## `start`
1250    /// The new start time of `self` in trim mode
1251    ///
1252    /// # Returns
1253    ///
1254    /// [`true`] if the trim edit of `self` completed, [`false`] on failure.
1255    #[doc(alias = "ges_timeline_element_trim")]
1256    fn trim(&self, start: gst::ClockTime) -> Result<(), glib::error::BoolError> {
1257        unsafe {
1258            glib::result_from_gboolean!(
1259                ffi::ges_timeline_element_trim(self.as_ref().to_glib_none().0, start.into_glib()),
1260                "Failed to trim"
1261            )
1262        }
1263    }
1264
1265    /// Whether the element should be serialized.
1266    fn is_serialize(&self) -> bool {
1267        ObjectExt::property(self.as_ref(), "serialize")
1268    }
1269
1270    /// Whether the element should be serialized.
1271    fn set_serialize(&self, serialize: bool) {
1272        ObjectExt::set_property(self.as_ref(), "serialize", serialize)
1273    }
1274
1275    /// Emitted when the element has a new child property registered. See
1276    /// [`add_child_property()`][Self::add_child_property()].
1277    ///
1278    /// Note that some GES elements will be automatically created with
1279    /// pre-registered children properties. You can use
1280    /// [`list_children_properties()`][Self::list_children_properties()] to list these.
1281    /// ## `prop_object`
1282    /// The child whose property has been registered
1283    /// ## `prop`
1284    /// The specification for the property that has been registered
1285    #[cfg(feature = "v1_18")]
1286    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
1287    #[doc(alias = "child-property-added")]
1288    fn connect_child_property_added<F: Fn(&Self, &glib::Object, &glib::ParamSpec) + 'static>(
1289        &self,
1290        f: F,
1291    ) -> SignalHandlerId {
1292        unsafe extern "C" fn child_property_added_trampoline<
1293            P: IsA<TimelineElement>,
1294            F: Fn(&P, &glib::Object, &glib::ParamSpec) + 'static,
1295        >(
1296            this: *mut ffi::GESTimelineElement,
1297            prop_object: *mut glib::gobject_ffi::GObject,
1298            prop: *mut glib::gobject_ffi::GParamSpec,
1299            f: glib::ffi::gpointer,
1300        ) {
1301            let f: &F = &*(f as *const F);
1302            f(
1303                TimelineElement::from_glib_borrow(this).unsafe_cast_ref(),
1304                &from_glib_borrow(prop_object),
1305                &from_glib_borrow(prop),
1306            )
1307        }
1308        unsafe {
1309            let f: Box_<F> = Box_::new(f);
1310            connect_raw(
1311                self.as_ptr() as *mut _,
1312                c"child-property-added".as_ptr() as *const _,
1313                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1314                    child_property_added_trampoline::<Self, F> as *const (),
1315                )),
1316                Box_::into_raw(f),
1317            )
1318        }
1319    }
1320
1321    /// Emitted when the element has a child property unregistered. See
1322    /// [`remove_child_property()`][Self::remove_child_property()].
1323    /// ## `prop_object`
1324    /// The child whose property has been unregistered
1325    /// ## `prop`
1326    /// The specification for the property that has been unregistered
1327    #[cfg(feature = "v1_18")]
1328    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
1329    #[doc(alias = "child-property-removed")]
1330    fn connect_child_property_removed<F: Fn(&Self, &glib::Object, &glib::ParamSpec) + 'static>(
1331        &self,
1332        f: F,
1333    ) -> SignalHandlerId {
1334        unsafe extern "C" fn child_property_removed_trampoline<
1335            P: IsA<TimelineElement>,
1336            F: Fn(&P, &glib::Object, &glib::ParamSpec) + 'static,
1337        >(
1338            this: *mut ffi::GESTimelineElement,
1339            prop_object: *mut glib::gobject_ffi::GObject,
1340            prop: *mut glib::gobject_ffi::GParamSpec,
1341            f: glib::ffi::gpointer,
1342        ) {
1343            let f: &F = &*(f as *const F);
1344            f(
1345                TimelineElement::from_glib_borrow(this).unsafe_cast_ref(),
1346                &from_glib_borrow(prop_object),
1347                &from_glib_borrow(prop),
1348            )
1349        }
1350        unsafe {
1351            let f: Box_<F> = Box_::new(f);
1352            connect_raw(
1353                self.as_ptr() as *mut _,
1354                c"child-property-removed".as_ptr() as *const _,
1355                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1356                    child_property_removed_trampoline::<Self, F> as *const (),
1357                )),
1358                Box_::into_raw(f),
1359            )
1360        }
1361    }
1362
1363    /// Emitted when a child of the element has one of its registered
1364    /// properties set. See [`add_child_property()`][Self::add_child_property()].
1365    /// Note that unlike [`notify`][struct@crate::glib::Object#notify], a child property name can not be
1366    /// used as a signal detail.
1367    /// ## `prop_object`
1368    /// The child whose property has been set
1369    /// ## `prop`
1370    /// The specification for the property that been set
1371    #[doc(alias = "deep-notify")]
1372    fn connect_deep_notify<F: Fn(&Self, &glib::Object, &glib::ParamSpec) + 'static>(
1373        &self,
1374        detail: Option<&str>,
1375        f: F,
1376    ) -> SignalHandlerId {
1377        unsafe extern "C" fn deep_notify_trampoline<
1378            P: IsA<TimelineElement>,
1379            F: Fn(&P, &glib::Object, &glib::ParamSpec) + 'static,
1380        >(
1381            this: *mut ffi::GESTimelineElement,
1382            prop_object: *mut glib::gobject_ffi::GObject,
1383            prop: *mut glib::gobject_ffi::GParamSpec,
1384            f: glib::ffi::gpointer,
1385        ) {
1386            let f: &F = &*(f as *const F);
1387            f(
1388                TimelineElement::from_glib_borrow(this).unsafe_cast_ref(),
1389                &from_glib_borrow(prop_object),
1390                &from_glib_borrow(prop),
1391            )
1392        }
1393        unsafe {
1394            let f: Box_<F> = Box_::new(f);
1395            let detailed_signal_name = detail.map(|name| format!("deep-notify::{name}\0"));
1396            let signal_name: &[u8] = detailed_signal_name
1397                .as_ref()
1398                .map_or(c"deep-notify".to_bytes(), |n| n.as_bytes());
1399            connect_raw(
1400                self.as_ptr() as *mut _,
1401                signal_name.as_ptr() as *const _,
1402                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1403                    deep_notify_trampoline::<Self, F> as *const (),
1404                )),
1405                Box_::into_raw(f),
1406            )
1407        }
1408    }
1409
1410    #[doc(alias = "duration")]
1411    fn connect_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1412        unsafe extern "C" fn notify_duration_trampoline<
1413            P: IsA<TimelineElement>,
1414            F: Fn(&P) + 'static,
1415        >(
1416            this: *mut ffi::GESTimelineElement,
1417            _param_spec: glib::ffi::gpointer,
1418            f: glib::ffi::gpointer,
1419        ) {
1420            let f: &F = &*(f as *const F);
1421            f(TimelineElement::from_glib_borrow(this).unsafe_cast_ref())
1422        }
1423        unsafe {
1424            let f: Box_<F> = Box_::new(f);
1425            connect_raw(
1426                self.as_ptr() as *mut _,
1427                c"notify::duration".as_ptr() as *const _,
1428                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1429                    notify_duration_trampoline::<Self, F> as *const (),
1430                )),
1431                Box_::into_raw(f),
1432            )
1433        }
1434    }
1435
1436    #[doc(alias = "in-point")]
1437    fn connect_in_point_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1438        unsafe extern "C" fn notify_in_point_trampoline<
1439            P: IsA<TimelineElement>,
1440            F: Fn(&P) + 'static,
1441        >(
1442            this: *mut ffi::GESTimelineElement,
1443            _param_spec: glib::ffi::gpointer,
1444            f: glib::ffi::gpointer,
1445        ) {
1446            let f: &F = &*(f as *const F);
1447            f(TimelineElement::from_glib_borrow(this).unsafe_cast_ref())
1448        }
1449        unsafe {
1450            let f: Box_<F> = Box_::new(f);
1451            connect_raw(
1452                self.as_ptr() as *mut _,
1453                c"notify::in-point".as_ptr() as *const _,
1454                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1455                    notify_in_point_trampoline::<Self, F> as *const (),
1456                )),
1457                Box_::into_raw(f),
1458            )
1459        }
1460    }
1461
1462    #[doc(alias = "max-duration")]
1463    fn connect_max_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1464        unsafe extern "C" fn notify_max_duration_trampoline<
1465            P: IsA<TimelineElement>,
1466            F: Fn(&P) + 'static,
1467        >(
1468            this: *mut ffi::GESTimelineElement,
1469            _param_spec: glib::ffi::gpointer,
1470            f: glib::ffi::gpointer,
1471        ) {
1472            let f: &F = &*(f as *const F);
1473            f(TimelineElement::from_glib_borrow(this).unsafe_cast_ref())
1474        }
1475        unsafe {
1476            let f: Box_<F> = Box_::new(f);
1477            connect_raw(
1478                self.as_ptr() as *mut _,
1479                c"notify::max-duration".as_ptr() as *const _,
1480                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1481                    notify_max_duration_trampoline::<Self, F> as *const (),
1482                )),
1483                Box_::into_raw(f),
1484            )
1485        }
1486    }
1487
1488    #[doc(alias = "name")]
1489    fn connect_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1490        unsafe extern "C" fn notify_name_trampoline<
1491            P: IsA<TimelineElement>,
1492            F: Fn(&P) + 'static,
1493        >(
1494            this: *mut ffi::GESTimelineElement,
1495            _param_spec: glib::ffi::gpointer,
1496            f: glib::ffi::gpointer,
1497        ) {
1498            let f: &F = &*(f as *const F);
1499            f(TimelineElement::from_glib_borrow(this).unsafe_cast_ref())
1500        }
1501        unsafe {
1502            let f: Box_<F> = Box_::new(f);
1503            connect_raw(
1504                self.as_ptr() as *mut _,
1505                c"notify::name".as_ptr() as *const _,
1506                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1507                    notify_name_trampoline::<Self, F> as *const (),
1508                )),
1509                Box_::into_raw(f),
1510            )
1511        }
1512    }
1513
1514    #[doc(alias = "parent")]
1515    fn connect_parent_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1516        unsafe extern "C" fn notify_parent_trampoline<
1517            P: IsA<TimelineElement>,
1518            F: Fn(&P) + 'static,
1519        >(
1520            this: *mut ffi::GESTimelineElement,
1521            _param_spec: glib::ffi::gpointer,
1522            f: glib::ffi::gpointer,
1523        ) {
1524            let f: &F = &*(f as *const F);
1525            f(TimelineElement::from_glib_borrow(this).unsafe_cast_ref())
1526        }
1527        unsafe {
1528            let f: Box_<F> = Box_::new(f);
1529            connect_raw(
1530                self.as_ptr() as *mut _,
1531                c"notify::parent".as_ptr() as *const _,
1532                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1533                    notify_parent_trampoline::<Self, F> as *const (),
1534                )),
1535                Box_::into_raw(f),
1536            )
1537        }
1538    }
1539
1540    #[deprecated = "Since 1.10"]
1541    #[doc(alias = "priority")]
1542    fn connect_priority_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1543        unsafe extern "C" fn notify_priority_trampoline<
1544            P: IsA<TimelineElement>,
1545            F: Fn(&P) + 'static,
1546        >(
1547            this: *mut ffi::GESTimelineElement,
1548            _param_spec: glib::ffi::gpointer,
1549            f: glib::ffi::gpointer,
1550        ) {
1551            let f: &F = &*(f as *const F);
1552            f(TimelineElement::from_glib_borrow(this).unsafe_cast_ref())
1553        }
1554        unsafe {
1555            let f: Box_<F> = Box_::new(f);
1556            connect_raw(
1557                self.as_ptr() as *mut _,
1558                c"notify::priority".as_ptr() as *const _,
1559                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1560                    notify_priority_trampoline::<Self, F> as *const (),
1561                )),
1562                Box_::into_raw(f),
1563            )
1564        }
1565    }
1566
1567    #[doc(alias = "serialize")]
1568    fn connect_serialize_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1569        unsafe extern "C" fn notify_serialize_trampoline<
1570            P: IsA<TimelineElement>,
1571            F: Fn(&P) + 'static,
1572        >(
1573            this: *mut ffi::GESTimelineElement,
1574            _param_spec: glib::ffi::gpointer,
1575            f: glib::ffi::gpointer,
1576        ) {
1577            let f: &F = &*(f as *const F);
1578            f(TimelineElement::from_glib_borrow(this).unsafe_cast_ref())
1579        }
1580        unsafe {
1581            let f: Box_<F> = Box_::new(f);
1582            connect_raw(
1583                self.as_ptr() as *mut _,
1584                c"notify::serialize".as_ptr() as *const _,
1585                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1586                    notify_serialize_trampoline::<Self, F> as *const (),
1587                )),
1588                Box_::into_raw(f),
1589            )
1590        }
1591    }
1592
1593    #[doc(alias = "start")]
1594    fn connect_start_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1595        unsafe extern "C" fn notify_start_trampoline<
1596            P: IsA<TimelineElement>,
1597            F: Fn(&P) + 'static,
1598        >(
1599            this: *mut ffi::GESTimelineElement,
1600            _param_spec: glib::ffi::gpointer,
1601            f: glib::ffi::gpointer,
1602        ) {
1603            let f: &F = &*(f as *const F);
1604            f(TimelineElement::from_glib_borrow(this).unsafe_cast_ref())
1605        }
1606        unsafe {
1607            let f: Box_<F> = Box_::new(f);
1608            connect_raw(
1609                self.as_ptr() as *mut _,
1610                c"notify::start".as_ptr() as *const _,
1611                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1612                    notify_start_trampoline::<Self, F> as *const (),
1613                )),
1614                Box_::into_raw(f),
1615            )
1616        }
1617    }
1618
1619    #[doc(alias = "timeline")]
1620    fn connect_timeline_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1621        unsafe extern "C" fn notify_timeline_trampoline<
1622            P: IsA<TimelineElement>,
1623            F: Fn(&P) + 'static,
1624        >(
1625            this: *mut ffi::GESTimelineElement,
1626            _param_spec: glib::ffi::gpointer,
1627            f: glib::ffi::gpointer,
1628        ) {
1629            let f: &F = &*(f as *const F);
1630            f(TimelineElement::from_glib_borrow(this).unsafe_cast_ref())
1631        }
1632        unsafe {
1633            let f: Box_<F> = Box_::new(f);
1634            connect_raw(
1635                self.as_ptr() as *mut _,
1636                c"notify::timeline".as_ptr() as *const _,
1637                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1638                    notify_timeline_trampoline::<Self, F> as *const (),
1639                )),
1640                Box_::into_raw(f),
1641            )
1642        }
1643    }
1644}
1645
1646impl<O: IsA<TimelineElement>> TimelineElementExt for O {}