gstreamer_editing_services/auto/
base_effect.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, Extractable, MetaContainer, Operation, TimelineElement, TrackElement};
7use glib::prelude::*;
8#[cfg(feature = "v1_18")]
9#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
10use glib::translate::*;
11
12glib::wrapper! {
13    /// A [`BaseEffect`][crate::BaseEffect] is some operation that applies an effect to the data
14    /// it receives.
15    ///
16    /// ## Time Effects
17    ///
18    /// Some operations will change the timing of the stream data they receive
19    /// in some way. In particular, the [`gst::Element`][crate::gst::Element] that they wrap could alter
20    /// the times of the segment they receive in a [`gst::EventType::Segment`][crate::gst::EventType::Segment] event,
21    /// or the times of a seek they receive in a [`gst::EventType::Seek`][crate::gst::EventType::Seek] event. Such
22    /// operations would be considered time effects since they translate the
23    /// times they receive on their source to different times at their sink,
24    /// and vis versa. This introduces two sets of time coordinates for the
25    /// event: (internal) sink coordinates and (internal) source coordinates,
26    /// where segment times are translated from the sink coordinates to the
27    /// source coordinates, and seek times are translated from the source
28    /// coordinates to the sink coordinates.
29    ///
30    /// If you use such an effect in GES, you will need to inform GES of the
31    /// properties that control the timing with
32    /// [`BaseEffectExt::register_time_property()`][crate::prelude::BaseEffectExt::register_time_property()], and the effect's timing
33    /// behaviour using `ges_base_effect_set_time_translation_funcs()`.
34    ///
35    /// Note that a time effect should not have its
36    /// [`has-internal-source`][struct@crate::TrackElement#has-internal-source] set to [`true`].
37    ///
38    /// In addition, note that GES only *fully* supports time effects whose
39    /// mapping from the source to sink coordinates (those applied to seeks)
40    /// obeys:
41    ///
42    /// + Maps the time `0` to `0`. So initial time-shifting effects are
43    ///  excluded.
44    /// + Is monotonically increasing. So reversing effects, and effects that
45    ///  jump backwards in the stream are excluded.
46    /// + Can handle a reasonable `GstClockTime`, relative to the project. So
47    ///  this would exclude a time effect with an extremely large speed-up
48    ///  that would cause the converted `GstClockTime` seeks to overflow.
49    /// + Is 'continuously reversible'. This essentially means that for every
50    ///  time in the sink coordinates, we can, to 'good enough' accuracy,
51    ///  calculate the corresponding time in the source coordinates. Moreover,
52    ///  this should correspond to how segment times are translated from
53    ///  sink to source.
54    /// + Only depends on the registered time properties, rather than the
55    ///  state of the [`gst::Element`][crate::gst::Element] or the data it receives. This would exclude,
56    ///  say, an effect that would speedup if there is more red in the image
57    ///  it receives.
58    ///
59    /// Note that a constant-rate-change effect that is not extremely fast or
60    /// slow would satisfy these conditions. For such effects, you may wish to
61    /// use `ges_effect_class_register_rate_property()`.
62    ///
63    /// This is an Abstract Base Class, you cannot instantiate it.
64    ///
65    /// # Implements
66    ///
67    /// [`BaseEffectExt`][trait@crate::prelude::BaseEffectExt], [`OperationExt`][trait@crate::prelude::OperationExt], [`TrackElementExt`][trait@crate::prelude::TrackElementExt], [`TimelineElementExt`][trait@crate::prelude::TimelineElementExt], [`trait@glib::ObjectExt`], [`ExtractableExt`][trait@crate::prelude::ExtractableExt], [`MetaContainerExt`][trait@crate::prelude::MetaContainerExt], [`TimelineElementExtManual`][trait@crate::prelude::TimelineElementExtManual]
68    #[doc(alias = "GESBaseEffect")]
69    pub struct BaseEffect(Object<ffi::GESBaseEffect, ffi::GESBaseEffectClass>) @extends Operation, TrackElement, TimelineElement, @implements Extractable, MetaContainer;
70
71    match fn {
72        type_ => || ffi::ges_base_effect_get_type(),
73    }
74}
75
76impl BaseEffect {
77    pub const NONE: Option<&'static BaseEffect> = None;
78}
79
80/// Trait containing all [`struct@BaseEffect`] methods.
81///
82/// # Implementors
83///
84/// [`BaseEffect`][struct@crate::BaseEffect], [`Effect`][struct@crate::Effect]
85pub trait BaseEffectExt: IsA<BaseEffect> + 'static {
86    /// Get whether the effect is considered a time effect or not. An effect
87    /// with registered time properties or set translation functions is
88    /// considered a time effect.
89    ///
90    /// # Returns
91    ///
92    /// [`true`] if `self` is considered a time effect.
93    #[cfg(feature = "v1_18")]
94    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
95    #[doc(alias = "ges_base_effect_is_time_effect")]
96    fn is_time_effect(&self) -> bool {
97        unsafe {
98            from_glib(ffi::ges_base_effect_is_time_effect(
99                self.as_ref().to_glib_none().0,
100            ))
101        }
102    }
103
104    /// Register a child property of the effect as a property that, when set,
105    /// can change the timing of its input data. The child property should be
106    /// specified as in [`TimelineElementExt::lookup_child()`][crate::prelude::TimelineElementExt::lookup_child()].
107    ///
108    /// You should also set the corresponding time translation using
109    /// `ges_base_effect_set_time_translation_funcs()`.
110    ///
111    /// Note that `self` must not be part of a clip, nor can it have
112    /// [`has-internal-source`][struct@crate::TrackElement#has-internal-source] set to [`true`].
113    /// ## `child_property_name`
114    /// The name of the child property to register as
115    /// a time property
116    ///
117    /// # Returns
118    ///
119    /// [`true`] if the child property was found and newly registered.
120    #[cfg(feature = "v1_18")]
121    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
122    #[doc(alias = "ges_base_effect_register_time_property")]
123    fn register_time_property(&self, child_property_name: &str) -> bool {
124        unsafe {
125            from_glib(ffi::ges_base_effect_register_time_property(
126                self.as_ref().to_glib_none().0,
127                child_property_name.to_glib_none().0,
128            ))
129        }
130    }
131}
132
133impl<O: IsA<BaseEffect>> BaseEffectExt for O {}