gstreamer_editing_services/auto/video_transition.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::{
8 ffi, Extractable, MetaContainer, Operation, TimelineElement, TrackElement, Transition,
9 VideoStandardTransitionType,
10};
11use glib::{
12 prelude::*,
13 signal::{connect_raw, SignalHandlerId},
14 translate::*,
15};
16use std::boxed::Box as Box_;
17
18glib::wrapper! {
19 ///
20 ///
21 /// ## Properties
22 ///
23 ///
24 /// #### `border`
25 /// This value represents the border width of the transition.
26 ///
27 /// Readable | Writeable
28 ///
29 ///
30 /// #### `invert`
31 /// This value represents the direction of the transition.
32 ///
33 /// Readable | Writeable
34 ///
35 ///
36 /// #### `transition-type`
37 /// Readable | Writeable
38 /// <details><summary><h4>TrackElement</h4></summary>
39 ///
40 ///
41 /// #### `active`
42 /// Whether the effect of the element should be applied in its
43 /// [`track`][struct@crate::TrackElement#track]. If set to [`false`], it will not be used in
44 /// the output of the track.
45 ///
46 /// Readable | Writeable
47 ///
48 ///
49 /// #### `auto-clamp-control-sources`
50 /// Whether the control sources on the element (see
51 /// [`TrackElementExt::set_control_source()`][crate::prelude::TrackElementExt::set_control_source()]) will be automatically
52 /// updated whenever the [`in-point`][struct@crate::TimelineElement#in-point] or out-point of the
53 /// element change in value.
54 ///
55 /// See [`TrackElementExt::clamp_control_source()`][crate::prelude::TrackElementExt::clamp_control_source()] for how this is done
56 /// per control source.
57 ///
58 /// Default value: [`true`]
59 ///
60 /// Readable | Writeable
61 ///
62 ///
63 /// #### `has-internal-source`
64 /// This property is used to determine whether the 'internal time'
65 /// properties of the element have any meaning. In particular, unless
66 /// this is set to [`true`], the [`in-point`][struct@crate::TimelineElement#in-point] and
67 /// [`max-duration`][struct@crate::TimelineElement#max-duration] can not be set to any value other
68 /// than the default 0 and `GST_CLOCK_TIME_NONE`, respectively.
69 ///
70 /// If an element has some *internal* *timed* source [`gst::Element`][crate::gst::Element] that it
71 /// reads stream data from as part of its function in a [`Track`][crate::Track], then
72 /// you'll likely want to set this to [`true`] to allow the
73 /// [`in-point`][struct@crate::TimelineElement#in-point] and [`max-duration`][struct@crate::TimelineElement#max-duration] to
74 /// be set.
75 ///
76 /// The default value is determined by the `GESTrackElementClass`
77 /// `default_has_internal_source` class property. For most
78 /// `GESSourceClass`-es, this will be [`true`], with the exception of those
79 /// that have a potentially *static* source, such as `GESImageSourceClass`
80 /// and `GESTitleSourceClass`. Otherwise, this will usually be [`false`].
81 ///
82 /// For most [`Operation`][crate::Operation]-s you will likely want to leave this set to
83 /// [`false`]. The exception may be for an operation that reads some stream
84 /// data from some private internal source as part of manipulating the
85 /// input data from the usual linked upstream [`TrackElement`][crate::TrackElement].
86 ///
87 /// For example, you may want to set this to [`true`] for a
88 /// [`TrackType::VIDEO`][crate::TrackType::VIDEO] operation that wraps a `textoverlay` that reads
89 /// from a subtitle file and places its text on top of the received video
90 /// data. The [`in-point`][struct@crate::TimelineElement#in-point] of the element would be used
91 /// to shift the initial seek time on the `textoverlay` away from 0, and
92 /// the [`max-duration`][struct@crate::TimelineElement#max-duration] could be set to reflect the
93 /// time at which the subtitle file runs out of data.
94 ///
95 /// Note that GES can not support track elements that have both internal
96 /// content and manipulate the timing of their data streams (time
97 /// effects).
98 ///
99 /// Readable | Writeable
100 ///
101 ///
102 /// #### `track`
103 /// The track that this element belongs to, or [`None`] if it does not
104 /// belong to a track.
105 ///
106 /// Readable
107 ///
108 ///
109 /// #### `track-type`
110 /// The track type of the element, which determines the type of track the
111 /// element can be added to (see [`track-type`][struct@crate::Track#track-type]). This should
112 /// correspond to the type of data that the element can produce or
113 /// process.
114 ///
115 /// Readable | Writeable | Construct
116 /// </details>
117 /// <details><summary><h4>TimelineElement</h4></summary>
118 ///
119 ///
120 /// #### `duration`
121 /// The duration that the element is in effect for in the timeline (a
122 /// time difference in nanoseconds using the time coordinates of the
123 /// timeline). For example, for a source element, this would determine
124 /// for how long it should output its internal content for. For an
125 /// operation element, this would determine for how long its effect
126 /// should be applied to any source content.
127 ///
128 /// Readable | Writeable
129 ///
130 ///
131 /// #### `in-point`
132 /// The initial offset to use internally when outputting content (in
133 /// nanoseconds, but in the time coordinates of the internal content).
134 ///
135 /// For example, for a [`VideoUriSource`][crate::VideoUriSource] that references some media
136 /// file, the "internal content" is the media file data, and the
137 /// in-point would correspond to some timestamp in the media file.
138 /// When playing the timeline, and when the element is first reached at
139 /// timeline-time [`start`][struct@crate::TimelineElement#start], it will begin outputting the
140 /// data from the timestamp in-point **onwards**, until it reaches the
141 /// end of its [`duration`][struct@crate::TimelineElement#duration] in the timeline.
142 ///
143 /// For elements that have no internal content, this should be kept
144 /// as 0.
145 ///
146 /// Readable | Writeable
147 ///
148 ///
149 /// #### `max-duration`
150 /// The full duration of internal content that is available (a time
151 /// difference in nanoseconds using the time coordinates of the internal
152 /// content).
153 ///
154 /// This will act as a cap on the [`in-point`][struct@crate::TimelineElement#in-point] of the
155 /// element (which is in the same time coordinates), and will sometimes
156 /// be used to limit the [`duration`][struct@crate::TimelineElement#duration] of the element in
157 /// the timeline.
158 ///
159 /// For example, for a [`VideoUriSource`][crate::VideoUriSource] that references some media
160 /// file, this would be the length of the media file.
161 ///
162 /// For elements that have no internal content, or whose content is
163 /// indefinite, this should be kept as `GST_CLOCK_TIME_NONE`.
164 ///
165 /// Readable | Writeable | Construct
166 ///
167 ///
168 /// #### `name`
169 /// The name of the element. This should be unique within its timeline.
170 ///
171 /// Readable | Writeable | Construct
172 ///
173 ///
174 /// #### `parent`
175 /// The parent container of the element.
176 ///
177 /// Readable | Writeable
178 ///
179 ///
180 /// #### `priority`
181 /// The priority of the element.
182 ///
183 /// Readable | Writeable
184 ///
185 ///
186 /// #### `serialize`
187 /// Whether the element should be serialized.
188 ///
189 /// Readable | Writeable
190 ///
191 ///
192 /// #### `start`
193 /// The starting position of the element in the timeline (in nanoseconds
194 /// and in the time coordinates of the timeline). For example, for a
195 /// source element, this would determine the time at which it should
196 /// start outputting its internal content. For an operation element, this
197 /// would determine the time at which it should start applying its effect
198 /// to any source content.
199 ///
200 /// Readable | Writeable
201 ///
202 ///
203 /// #### `timeline`
204 /// The timeline that the element lies within.
205 ///
206 /// Readable | Writeable
207 /// </details>
208 ///
209 /// # Implements
210 ///
211 /// [`VideoTransitionExt`][trait@crate::prelude::VideoTransitionExt], [`TransitionExt`][trait@crate::prelude::TransitionExt], [`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]
212 #[doc(alias = "GESVideoTransition")]
213 pub struct VideoTransition(Object<ffi::GESVideoTransition, ffi::GESVideoTransitionClass>) @extends Transition, Operation, TrackElement, TimelineElement, @implements Extractable, MetaContainer;
214
215 match fn {
216 type_ => || ffi::ges_video_transition_get_type(),
217 }
218}
219
220impl VideoTransition {
221 pub const NONE: Option<&'static VideoTransition> = None;
222
223 #[doc(alias = "ges_video_transition_new")]
224 pub fn new() -> VideoTransition {
225 assert_initialized_main_thread!();
226 unsafe { from_glib_none(ffi::ges_video_transition_new()) }
227 }
228}
229
230impl Default for VideoTransition {
231 fn default() -> Self {
232 Self::new()
233 }
234}
235
236mod sealed {
237 pub trait Sealed {}
238 impl<T: super::IsA<super::VideoTransition>> Sealed for T {}
239}
240
241/// Trait containing all [`struct@VideoTransition`] methods.
242///
243/// # Implementors
244///
245/// [`VideoTransition`][struct@crate::VideoTransition]
246pub trait VideoTransitionExt: IsA<VideoTransition> + sealed::Sealed + 'static {
247 /// Get the border property of `self`, this value represents
248 /// the border width of the transition.
249 ///
250 /// # Deprecated since 1.20
251 ///
252 /// Use ges_timeline_element_get_child_property instead.
253 ///
254 /// # Returns
255 ///
256 /// The border values of `self` or -1 if not meaningful
257 /// (this will happen when not using a smpte transition).
258 #[cfg_attr(feature = "v1_20", deprecated = "Since 1.20")]
259 #[allow(deprecated)]
260 #[doc(alias = "ges_video_transition_get_border")]
261 #[doc(alias = "get_border")]
262 fn border(&self) -> i32 {
263 unsafe { ffi::ges_video_transition_get_border(self.as_ref().to_glib_none().0) }
264 }
265
266 /// Get the transition type used by `self`.
267 ///
268 /// # Returns
269 ///
270 /// The transition type used by `self`.
271 #[doc(alias = "ges_video_transition_get_transition_type")]
272 #[doc(alias = "get_transition_type")]
273 #[doc(alias = "transition-type")]
274 fn transition_type(&self) -> VideoStandardTransitionType {
275 unsafe {
276 from_glib(ffi::ges_video_transition_get_transition_type(
277 self.as_ref().to_glib_none().0,
278 ))
279 }
280 }
281
282 /// Get the invert property of `self`, this value represents
283 /// the direction of the transition.
284 ///
285 /// # Deprecated since 1.20
286 ///
287 /// Use ges_timeline_element_get_child_property instead.
288 ///
289 /// # Returns
290 ///
291 /// The invert value of `self`
292 #[cfg_attr(feature = "v1_20", deprecated = "Since 1.20")]
293 #[allow(deprecated)]
294 #[doc(alias = "ges_video_transition_is_inverted")]
295 fn is_inverted(&self) -> bool {
296 unsafe {
297 from_glib(ffi::ges_video_transition_is_inverted(
298 self.as_ref().to_glib_none().0,
299 ))
300 }
301 }
302
303 /// Set the border property of `self`, this value represents
304 /// the border width of the transition. In case this value does
305 /// not make sense for the current transition type, it is cached
306 /// for later use.
307 ///
308 /// # Deprecated since 1.20
309 ///
310 /// Use ges_timeline_element_set_child_property instead.
311 /// ## `value`
312 /// The value of the border to set on `object`
313 #[cfg_attr(feature = "v1_20", deprecated = "Since 1.20")]
314 #[allow(deprecated)]
315 #[doc(alias = "ges_video_transition_set_border")]
316 #[doc(alias = "border")]
317 fn set_border(&self, value: u32) {
318 unsafe {
319 ffi::ges_video_transition_set_border(self.as_ref().to_glib_none().0, value);
320 }
321 }
322
323 /// Set the invert property of `self`, this value represents
324 /// the direction of the transition. In case this value does
325 /// not make sense for the current transition type, it is cached
326 /// for later use.
327 ///
328 /// # Deprecated since 1.20
329 ///
330 /// Use ges_timeline_element_set_child_property instead.
331 /// ## `inverted`
332 /// [`true`] if the transition should be inverted [`false`] otherwise
333 #[cfg_attr(feature = "v1_20", deprecated = "Since 1.20")]
334 #[allow(deprecated)]
335 #[doc(alias = "ges_video_transition_set_inverted")]
336 fn set_inverted(&self, inverted: bool) {
337 unsafe {
338 ffi::ges_video_transition_set_inverted(
339 self.as_ref().to_glib_none().0,
340 inverted.into_glib(),
341 );
342 }
343 }
344
345 /// Sets the transition being used to `type_`.
346 /// ## `type_`
347 /// a [`VideoStandardTransitionType`][crate::VideoStandardTransitionType]
348 ///
349 /// # Returns
350 ///
351 /// [`true`] if the transition type was properly changed, else [`false`].
352 #[doc(alias = "ges_video_transition_set_transition_type")]
353 #[doc(alias = "transition-type")]
354 fn set_transition_type(&self, type_: VideoStandardTransitionType) -> bool {
355 unsafe {
356 from_glib(ffi::ges_video_transition_set_transition_type(
357 self.as_ref().to_glib_none().0,
358 type_.into_glib(),
359 ))
360 }
361 }
362
363 /// This value represents the direction of the transition.
364 ///
365 /// # Deprecated since 1.20
366 ///
367 /// Use ges_timeline_element_[sg]et_child_property instead.
368 #[cfg_attr(feature = "v1_20", deprecated = "Since 1.20")]
369 fn inverts(&self) -> bool {
370 ObjectExt::property(self.as_ref(), "invert")
371 }
372
373 /// This value represents the direction of the transition.
374 ///
375 /// # Deprecated since 1.20
376 ///
377 /// Use ges_timeline_element_[sg]et_child_property instead.
378 #[cfg_attr(feature = "v1_20", deprecated = "Since 1.20")]
379 fn set_invert(&self, invert: bool) {
380 ObjectExt::set_property(self.as_ref(), "invert", invert)
381 }
382
383 #[doc(alias = "border")]
384 fn connect_border_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
385 unsafe extern "C" fn notify_border_trampoline<
386 P: IsA<VideoTransition>,
387 F: Fn(&P) + 'static,
388 >(
389 this: *mut ffi::GESVideoTransition,
390 _param_spec: glib::ffi::gpointer,
391 f: glib::ffi::gpointer,
392 ) {
393 let f: &F = &*(f as *const F);
394 f(VideoTransition::from_glib_borrow(this).unsafe_cast_ref())
395 }
396 unsafe {
397 let f: Box_<F> = Box_::new(f);
398 connect_raw(
399 self.as_ptr() as *mut _,
400 b"notify::border\0".as_ptr() as *const _,
401 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
402 notify_border_trampoline::<Self, F> as *const (),
403 )),
404 Box_::into_raw(f),
405 )
406 }
407 }
408
409 #[cfg_attr(feature = "v1_20", deprecated = "Since 1.20")]
410 #[doc(alias = "invert")]
411 fn connect_invert_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
412 unsafe extern "C" fn notify_invert_trampoline<
413 P: IsA<VideoTransition>,
414 F: Fn(&P) + 'static,
415 >(
416 this: *mut ffi::GESVideoTransition,
417 _param_spec: glib::ffi::gpointer,
418 f: glib::ffi::gpointer,
419 ) {
420 let f: &F = &*(f as *const F);
421 f(VideoTransition::from_glib_borrow(this).unsafe_cast_ref())
422 }
423 unsafe {
424 let f: Box_<F> = Box_::new(f);
425 connect_raw(
426 self.as_ptr() as *mut _,
427 b"notify::invert\0".as_ptr() as *const _,
428 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
429 notify_invert_trampoline::<Self, F> as *const (),
430 )),
431 Box_::into_raw(f),
432 )
433 }
434 }
435
436 #[doc(alias = "transition-type")]
437 fn connect_transition_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
438 unsafe extern "C" fn notify_transition_type_trampoline<
439 P: IsA<VideoTransition>,
440 F: Fn(&P) + 'static,
441 >(
442 this: *mut ffi::GESVideoTransition,
443 _param_spec: glib::ffi::gpointer,
444 f: glib::ffi::gpointer,
445 ) {
446 let f: &F = &*(f as *const F);
447 f(VideoTransition::from_glib_borrow(this).unsafe_cast_ref())
448 }
449 unsafe {
450 let f: Box_<F> = Box_::new(f);
451 connect_raw(
452 self.as_ptr() as *mut _,
453 b"notify::transition-type\0".as_ptr() as *const _,
454 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
455 notify_transition_type_trampoline::<Self, F> as *const (),
456 )),
457 Box_::into_raw(f),
458 )
459 }
460 }
461}
462
463impl<O: IsA<VideoTransition>> VideoTransitionExt for O {}