gstreamer_editing_services/auto/
transition_clip.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::{
7    ffi, BaseTransitionClip, Clip, Container, Extractable, MetaContainer, OperationClip,
8    TimelineElement, VideoStandardTransitionType,
9};
10use glib::{
11    prelude::*,
12    signal::{connect_raw, SignalHandlerId},
13    translate::*,
14};
15use std::boxed::Box as Box_;
16
17glib::wrapper! {
18    /// Creates an object that mixes together the two underlying objects, A and B.
19    /// The A object is assumed to have a higher prioirity (lower number) than the
20    /// B object. At the transition in point, only A will be visible, and by the
21    /// end only B will be visible.
22    ///
23    /// The shape of the video transition depends on the value of the "vtype"
24    /// property. The default value is "crossfade". For audio, only "crossfade" is
25    /// supported.
26    ///
27    /// The ID of the ExtractableType is the nickname of the vtype property value. Note
28    /// that this value can be changed after creation and the GESExtractable.asset value
29    /// will be updated when needed.
30    ///
31    /// ## Properties
32    ///
33    ///
34    /// #### `vtype`
35    ///  a [`VideoStandardTransitionType`][crate::VideoStandardTransitionType] representing the wipe to use
36    ///
37    /// Readable | Writeable | Construct
38    /// <details><summary><h4>Clip</h4></summary>
39    ///
40    ///
41    /// #### `duration-limit`
42    ///  The maximum [`duration`][struct@crate::TimelineElement#duration] that can be *currently* set
43    /// for the clip, taking into account the [`in-point`][struct@crate::TimelineElement#in-point],
44    /// [`max-duration`][struct@crate::TimelineElement#max-duration], [`active`][struct@crate::TrackElement#active], and
45    /// [`track`][struct@crate::TrackElement#track] properties of its children, as well as any
46    /// time effects. If there is no limit, this will be set to
47    /// `GST_CLOCK_TIME_NONE`.
48    ///
49    /// Note that whilst a clip has no children in any tracks, the limit will
50    /// be unknown, and similarly set to `GST_CLOCK_TIME_NONE`.
51    ///
52    /// If the duration-limit would ever go below the current
53    /// [`duration`][struct@crate::TimelineElement#duration] of the clip due to a change in the above
54    /// variables, its [`duration`][struct@crate::TimelineElement#duration] will be set to the new
55    /// limit.
56    ///
57    /// Readable
58    ///
59    ///
60    /// #### `layer`
61    ///  The layer this clip lies in.
62    ///
63    /// If you want to connect to this property's [`notify`][struct@crate::glib::Object#notify] signal,
64    /// you should connect to it with `g_signal_connect_after()` since the
65    /// signal emission may be stopped internally.
66    ///
67    /// Readable
68    ///
69    ///
70    /// #### `supported-formats`
71    ///  The [`TrackType`][crate::TrackType]-s that the clip supports, which it can create
72    /// [`TrackElement`][crate::TrackElement]-s for. Note that this can be a combination of
73    /// [`TrackType`][crate::TrackType] flags to indicate support for several
74    /// [`track-type`][struct@crate::TrackElement#track-type] elements.
75    ///
76    /// Readable | Writeable | Construct
77    /// </details>
78    /// <details><summary><h4>Container</h4></summary>
79    ///
80    ///
81    /// #### `height`
82    ///  The span of the container's children's [`priority`][struct@crate::TimelineElement#priority]
83    /// values, which is the number of integers that lie between (inclusive)
84    /// the minimum and maximum priorities found amongst the container's
85    /// children (maximum - minimum + 1).
86    ///
87    /// Readable
88    /// </details>
89    /// <details><summary><h4>TimelineElement</h4></summary>
90    ///
91    ///
92    /// #### `duration`
93    ///  The duration that the element is in effect for in the timeline (a
94    /// time difference in nanoseconds using the time coordinates of the
95    /// timeline). For example, for a source element, this would determine
96    /// for how long it should output its internal content for. For an
97    /// operation element, this would determine for how long its effect
98    /// should be applied to any source content.
99    ///
100    /// Readable | Writeable
101    ///
102    ///
103    /// #### `in-point`
104    ///  The initial offset to use internally when outputting content (in
105    /// nanoseconds, but in the time coordinates of the internal content).
106    ///
107    /// For example, for a [`VideoUriSource`][crate::VideoUriSource] that references some media
108    /// file, the "internal content" is the media file data, and the
109    /// in-point would correspond to some timestamp in the media file.
110    /// When playing the timeline, and when the element is first reached at
111    /// timeline-time [`start`][struct@crate::TimelineElement#start], it will begin outputting the
112    /// data from the timestamp in-point **onwards**, until it reaches the
113    /// end of its [`duration`][struct@crate::TimelineElement#duration] in the timeline.
114    ///
115    /// For elements that have no internal content, this should be kept
116    /// as 0.
117    ///
118    /// Readable | Writeable
119    ///
120    ///
121    /// #### `max-duration`
122    ///  The full duration of internal content that is available (a time
123    /// difference in nanoseconds using the time coordinates of the internal
124    /// content).
125    ///
126    /// This will act as a cap on the [`in-point`][struct@crate::TimelineElement#in-point] of the
127    /// element (which is in the same time coordinates), and will sometimes
128    /// be used to limit the [`duration`][struct@crate::TimelineElement#duration] of the element in
129    /// the timeline.
130    ///
131    /// For example, for a [`VideoUriSource`][crate::VideoUriSource] that references some media
132    /// file, this would be the length of the media file.
133    ///
134    /// For elements that have no internal content, or whose content is
135    /// indefinite, this should be kept as `GST_CLOCK_TIME_NONE`.
136    ///
137    /// Readable | Writeable | Construct
138    ///
139    ///
140    /// #### `name`
141    ///  The name of the element. This should be unique within its timeline.
142    ///
143    /// Readable | Writeable | Construct
144    ///
145    ///
146    /// #### `parent`
147    ///  The parent container of the element.
148    ///
149    /// Readable | Writeable
150    ///
151    ///
152    /// #### `priority`
153    ///  The priority of the element.
154    ///
155    /// Readable | Writeable
156    ///
157    ///
158    /// #### `serialize`
159    ///  Whether the element should be serialized.
160    ///
161    /// Readable | Writeable
162    ///
163    ///
164    /// #### `start`
165    ///  The starting position of the element in the timeline (in nanoseconds
166    /// and in the time coordinates of the timeline). For example, for a
167    /// source element, this would determine the time at which it should
168    /// start outputting its internal content. For an operation element, this
169    /// would determine the time at which it should start applying its effect
170    /// to any source content.
171    ///
172    /// Readable | Writeable
173    ///
174    ///
175    /// #### `timeline`
176    ///  The timeline that the element lies within.
177    ///
178    /// Readable | Writeable
179    /// </details>
180    ///
181    /// # Implements
182    ///
183    /// [`TransitionClipExt`][trait@crate::prelude::TransitionClipExt], [`BaseTransitionClipExt`][trait@crate::prelude::BaseTransitionClipExt], [`OperationClipExt`][trait@crate::prelude::OperationClipExt], [`ClipExt`][trait@crate::prelude::ClipExt], [`GESContainerExt`][trait@crate::prelude::GESContainerExt], [`TimelineElementExt`][trait@crate::prelude::TimelineElementExt], [`trait@glib::ObjectExt`], [`ExtractableExt`][trait@crate::prelude::ExtractableExt], [`MetaContainerExt`][trait@crate::prelude::MetaContainerExt], [`TimelineElementExtManual`][trait@crate::prelude::TimelineElementExtManual]
184    #[doc(alias = "GESTransitionClip")]
185    pub struct TransitionClip(Object<ffi::GESTransitionClip, ffi::GESTransitionClipClass>) @extends BaseTransitionClip, OperationClip, Clip, Container, TimelineElement, @implements Extractable, MetaContainer;
186
187    match fn {
188        type_ => || ffi::ges_transition_clip_get_type(),
189    }
190}
191
192impl TransitionClip {
193    pub const NONE: Option<&'static TransitionClip> = None;
194
195    /// Creates a new [`TransitionClip`][crate::TransitionClip].
196    /// ## `vtype`
197    /// the type of transition to create
198    ///
199    /// # Returns
200    ///
201    /// a newly created [`TransitionClip`][crate::TransitionClip],
202    /// or [`None`] if something went wrong.
203    #[doc(alias = "ges_transition_clip_new")]
204    pub fn new(vtype: VideoStandardTransitionType) -> Option<TransitionClip> {
205        assert_initialized_main_thread!();
206        unsafe { from_glib_none(ffi::ges_transition_clip_new(vtype.into_glib())) }
207    }
208
209    /// Creates a new [`TransitionClip`][crate::TransitionClip] for the provided `nick`.
210    /// ## `nick`
211    /// a string representing the type of transition to create
212    ///
213    /// # Returns
214    ///
215    /// The newly created [`TransitionClip`][crate::TransitionClip],
216    /// or [`None`] if something went wrong
217    #[doc(alias = "ges_transition_clip_new_for_nick")]
218    #[doc(alias = "new_for_nick")]
219    pub fn for_nick(nick: &str) -> Option<TransitionClip> {
220        assert_initialized_main_thread!();
221        unsafe { from_glib_none(ffi::ges_transition_clip_new_for_nick(nick.to_glib_none().0)) }
222    }
223}
224
225mod sealed {
226    pub trait Sealed {}
227    impl<T: super::IsA<super::TransitionClip>> Sealed for T {}
228}
229
230/// Trait containing all [`struct@TransitionClip`] methods.
231///
232/// # Implementors
233///
234/// [`TransitionClip`][struct@crate::TransitionClip]
235pub trait TransitionClipExt: IsA<TransitionClip> + sealed::Sealed + 'static {
236    /// a [`VideoStandardTransitionType`][crate::VideoStandardTransitionType] representing the wipe to use
237    fn vtype(&self) -> VideoStandardTransitionType {
238        ObjectExt::property(self.as_ref(), "vtype")
239    }
240
241    /// a [`VideoStandardTransitionType`][crate::VideoStandardTransitionType] representing the wipe to use
242    fn set_vtype(&self, vtype: VideoStandardTransitionType) {
243        ObjectExt::set_property(self.as_ref(), "vtype", vtype)
244    }
245
246    #[doc(alias = "vtype")]
247    fn connect_vtype_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
248        unsafe extern "C" fn notify_vtype_trampoline<
249            P: IsA<TransitionClip>,
250            F: Fn(&P) + 'static,
251        >(
252            this: *mut ffi::GESTransitionClip,
253            _param_spec: glib::ffi::gpointer,
254            f: glib::ffi::gpointer,
255        ) {
256            let f: &F = &*(f as *const F);
257            f(TransitionClip::from_glib_borrow(this).unsafe_cast_ref())
258        }
259        unsafe {
260            let f: Box_<F> = Box_::new(f);
261            connect_raw(
262                self.as_ptr() as *mut _,
263                b"notify::vtype\0".as_ptr() as *const _,
264                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
265                    notify_vtype_trampoline::<Self, F> as *const (),
266                )),
267                Box_::into_raw(f),
268            )
269        }
270    }
271}
272
273impl<O: IsA<TransitionClip>> TransitionClipExt for O {}