1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use ges_sys;
use glib::object::IsA;
use glib::translate::*;
use Extractable;
use TimelineElement;
use TrackElement;

glib_wrapper! {
    /// A `BaseEffect` is some operation that applies an effect to the data
    /// it receives.
    ///
    /// ## Time Effects
    ///
    /// Some operations will change the timing of the stream data they receive
    /// in some way. In particular, the `gst::Element` that they wrap could alter
    /// the times of the segment they receive in a `gst::EventType::Segment` event,
    /// or the times of a seek they receive in a `gst::EventType::Seek` event. Such
    /// operations would be considered time effects since they translate the
    /// times they receive on their source to different times at their sink,
    /// and vis versa. This introduces two sets of time coordinates for the
    /// event: (internal) sink coordinates and (internal) source coordinates,
    /// where segment times are translated from the sink coordinates to the
    /// source coordinates, and seek times are translated from the source
    /// coordinates to the sink coordinates.
    ///
    /// If you use such an effect in GES, you will need to inform GES of the
    /// properties that control the timing with
    /// `BaseEffectExt::register_time_property`, and the effect's timing
    /// behaviour using `BaseEffectExt::set_time_translation_funcs`.
    ///
    /// Note that a time effect should not have its
    /// `TrackElement:has-internal-source` set to `true`.
    ///
    /// In addition, note that GES only *fully* supports time effects whose
    /// mapping from the source to sink coordinates (those applied to seeks)
    /// obeys:
    ///
    /// + Maps the time `0` to `0`. So initial time-shifting effects are
    ///  excluded.
    /// + Is monotonically increasing. So reversing effects, and effects that
    ///  jump backwards in the stream are excluded.
    /// + Can handle a reasonable `gst::ClockTime`, relative to the project. So
    ///  this would exclude a time effect with an extremely large speed-up
    ///  that would cause the converted `gst::ClockTime` seeks to overflow.
    /// + Is 'continuously reversible'. This essentially means that for every
    ///  time in the sink coordinates, we can, to 'good enough' accuracy,
    ///  calculate the corresponding time in the source coordinates. Moreover,
    ///  this should correspond to how segment times are translated from
    ///  sink to source.
    /// + Only depends on the registered time properties, rather than the
    ///  state of the `gst::Element` or the data it receives. This would exclude,
    ///  say, an effect that would speedup if there is more red in the image
    ///  it receives.
    ///
    /// Note that a constant-rate-change effect that is not extremely fast or
    /// slow would satisfy these conditions. For such effects, you may wish to
    /// use `EffectClass::register_rate_property`.
    ///
    /// # Implements
    ///
    /// [`BaseEffectExt`](trait.BaseEffectExt.html), [`TrackElementExt`](trait.TrackElementExt.html), [`TimelineElementExt`](trait.TimelineElementExt.html), [`glib::object::ObjectExt`](../glib/object/trait.ObjectExt.html), [`ExtractableExt`](trait.ExtractableExt.html), [`TimelineElementExtManual`](prelude/trait.TimelineElementExtManual.html)
    pub struct BaseEffect(Object<ges_sys::GESBaseEffect, ges_sys::GESBaseEffectClass, BaseEffectClass>) @extends TrackElement, TimelineElement, @implements Extractable;

    match fn {
        get_type => || ges_sys::ges_base_effect_get_type(),
    }
}

pub const NONE_BASE_EFFECT: Option<&BaseEffect> = None;

/// Trait containing all `BaseEffect` methods.
///
/// # Implementors
///
/// [`BaseEffect`](struct.BaseEffect.html), [`Effect`](struct.Effect.html)
pub trait BaseEffectExt: 'static {
    /// Get whether the effect is considered a time effect or not. An effect
    /// with registered time properties or set translation functions is
    /// considered a time effect.
    ///
    /// Feature: `v1_18`
    ///
    ///
    /// # Returns
    ///
    /// `true` if `self` is considered a time effect.
    #[cfg(any(feature = "v1_18", feature = "dox"))]
    fn is_time_effect(&self) -> bool;

    /// Register a child property of the effect as a property that, when set,
    /// can change the timing of its input data. The child property should be
    /// specified as in `TimelineElementExt::lookup_child`.
    ///
    /// You should also set the corresponding time translation using
    /// `BaseEffectExt::set_time_translation_funcs`.
    ///
    /// Note that `self` must not be part of a clip, nor can it have
    /// `TrackElement:has-internal-source` set to `true`.
    ///
    /// Feature: `v1_18`
    ///
    /// ## `child_property_name`
    /// The name of the child property to register as
    /// a time property
    ///
    /// # Returns
    ///
    /// `true` if the child property was found and newly registered.
    #[cfg(any(feature = "v1_18", feature = "dox"))]
    fn register_time_property(&self, child_property_name: &str) -> bool;

    //#[cfg(any(feature = "v1_18", feature = "dox"))]
    //fn set_time_translation_funcs(&self, source_to_sink_func: /*Unimplemented*/Fn(&BaseEffect, gst::ClockTime, /*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 3, id: 11 }) -> gst::ClockTime, sink_to_source_func: /*Unimplemented*/Fn(&BaseEffect, gst::ClockTime, /*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 3, id: 11 }) -> gst::ClockTime, user_data: /*Unimplemented*/Option<Fundamental: Pointer>) -> bool;
}

impl<O: IsA<BaseEffect>> BaseEffectExt for O {
    #[cfg(any(feature = "v1_18", feature = "dox"))]
    fn is_time_effect(&self) -> bool {
        unsafe {
            from_glib(ges_sys::ges_base_effect_is_time_effect(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    #[cfg(any(feature = "v1_18", feature = "dox"))]
    fn register_time_property(&self, child_property_name: &str) -> bool {
        unsafe {
            from_glib(ges_sys::ges_base_effect_register_time_property(
                self.as_ref().to_glib_none().0,
                child_property_name.to_glib_none().0,
            ))
        }
    }

    //#[cfg(any(feature = "v1_18", feature = "dox"))]
    //fn set_time_translation_funcs(&self, source_to_sink_func: /*Unimplemented*/Fn(&BaseEffect, gst::ClockTime, /*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 3, id: 11 }) -> gst::ClockTime, sink_to_source_func: /*Unimplemented*/Fn(&BaseEffect, gst::ClockTime, /*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 3, id: 11 }) -> gst::ClockTime, user_data: /*Unimplemented*/Option<Fundamental: Pointer>) -> bool {
    //    unsafe { TODO: call ges_sys:ges_base_effect_set_time_translation_funcs() }
    //}
}