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
236/// Trait containing all [`struct@VideoTransition`] methods.
237///
238/// # Implementors
239///
240/// [`VideoTransition`][struct@crate::VideoTransition]
241pub trait VideoTransitionExt: IsA<VideoTransition> + 'static {
242 /// Get the border property of `self`, this value represents
243 /// the border width of the transition.
244 ///
245 /// # Deprecated since 1.20
246 ///
247 /// Use ges_timeline_element_get_child_property instead.
248 ///
249 /// # Returns
250 ///
251 /// The border values of `self` or -1 if not meaningful
252 /// (this will happen when not using a smpte transition).
253 #[cfg_attr(feature = "v1_20", deprecated = "Since 1.20")]
254 #[allow(deprecated)]
255 #[doc(alias = "ges_video_transition_get_border")]
256 #[doc(alias = "get_border")]
257 fn border(&self) -> i32 {
258 unsafe { ffi::ges_video_transition_get_border(self.as_ref().to_glib_none().0) }
259 }
260
261 /// Get the transition type used by `self`.
262 ///
263 /// # Returns
264 ///
265 /// The transition type used by `self`.
266 #[doc(alias = "ges_video_transition_get_transition_type")]
267 #[doc(alias = "get_transition_type")]
268 #[doc(alias = "transition-type")]
269 fn transition_type(&self) -> VideoStandardTransitionType {
270 unsafe {
271 from_glib(ffi::ges_video_transition_get_transition_type(
272 self.as_ref().to_glib_none().0,
273 ))
274 }
275 }
276
277 /// Get the invert property of `self`, this value represents
278 /// the direction of the transition.
279 ///
280 /// # Deprecated since 1.20
281 ///
282 /// Use ges_timeline_element_get_child_property instead.
283 ///
284 /// # Returns
285 ///
286 /// The invert value of `self`
287 #[cfg_attr(feature = "v1_20", deprecated = "Since 1.20")]
288 #[allow(deprecated)]
289 #[doc(alias = "ges_video_transition_is_inverted")]
290 fn is_inverted(&self) -> bool {
291 unsafe {
292 from_glib(ffi::ges_video_transition_is_inverted(
293 self.as_ref().to_glib_none().0,
294 ))
295 }
296 }
297
298 /// Set the border property of `self`, this value represents
299 /// the border width of the transition. In case this value does
300 /// not make sense for the current transition type, it is cached
301 /// for later use.
302 ///
303 /// # Deprecated since 1.20
304 ///
305 /// Use ges_timeline_element_set_child_property instead.
306 /// ## `value`
307 /// The value of the border to set on `object`
308 #[cfg_attr(feature = "v1_20", deprecated = "Since 1.20")]
309 #[allow(deprecated)]
310 #[doc(alias = "ges_video_transition_set_border")]
311 #[doc(alias = "border")]
312 fn set_border(&self, value: u32) {
313 unsafe {
314 ffi::ges_video_transition_set_border(self.as_ref().to_glib_none().0, value);
315 }
316 }
317
318 /// Set the invert property of `self`, this value represents
319 /// the direction of the transition. In case this value does
320 /// not make sense for the current transition type, it is cached
321 /// for later use.
322 ///
323 /// # Deprecated since 1.20
324 ///
325 /// Use ges_timeline_element_set_child_property instead.
326 /// ## `inverted`
327 /// [`true`] if the transition should be inverted [`false`] otherwise
328 #[cfg_attr(feature = "v1_20", deprecated = "Since 1.20")]
329 #[allow(deprecated)]
330 #[doc(alias = "ges_video_transition_set_inverted")]
331 fn set_inverted(&self, inverted: bool) {
332 unsafe {
333 ffi::ges_video_transition_set_inverted(
334 self.as_ref().to_glib_none().0,
335 inverted.into_glib(),
336 );
337 }
338 }
339
340 /// Sets the transition being used to `type_`.
341 /// ## `type_`
342 /// a [`VideoStandardTransitionType`][crate::VideoStandardTransitionType]
343 ///
344 /// # Returns
345 ///
346 /// [`true`] if the transition type was properly changed, else [`false`].
347 #[doc(alias = "ges_video_transition_set_transition_type")]
348 #[doc(alias = "transition-type")]
349 fn set_transition_type(&self, type_: VideoStandardTransitionType) -> bool {
350 unsafe {
351 from_glib(ffi::ges_video_transition_set_transition_type(
352 self.as_ref().to_glib_none().0,
353 type_.into_glib(),
354 ))
355 }
356 }
357
358 /// This value represents the direction of the transition.
359 ///
360 /// # Deprecated since 1.20
361 ///
362 /// Use ges_timeline_element_[sg]et_child_property instead.
363 #[cfg_attr(feature = "v1_20", deprecated = "Since 1.20")]
364 fn inverts(&self) -> bool {
365 ObjectExt::property(self.as_ref(), "invert")
366 }
367
368 /// This value represents the direction of the transition.
369 ///
370 /// # Deprecated since 1.20
371 ///
372 /// Use ges_timeline_element_[sg]et_child_property instead.
373 #[cfg_attr(feature = "v1_20", deprecated = "Since 1.20")]
374 fn set_invert(&self, invert: bool) {
375 ObjectExt::set_property(self.as_ref(), "invert", invert)
376 }
377
378 #[doc(alias = "border")]
379 fn connect_border_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
380 unsafe extern "C" fn notify_border_trampoline<
381 P: IsA<VideoTransition>,
382 F: Fn(&P) + 'static,
383 >(
384 this: *mut ffi::GESVideoTransition,
385 _param_spec: glib::ffi::gpointer,
386 f: glib::ffi::gpointer,
387 ) {
388 let f: &F = &*(f as *const F);
389 f(VideoTransition::from_glib_borrow(this).unsafe_cast_ref())
390 }
391 unsafe {
392 let f: Box_<F> = Box_::new(f);
393 connect_raw(
394 self.as_ptr() as *mut _,
395 c"notify::border".as_ptr() as *const _,
396 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
397 notify_border_trampoline::<Self, F> as *const (),
398 )),
399 Box_::into_raw(f),
400 )
401 }
402 }
403
404 #[cfg_attr(feature = "v1_20", deprecated = "Since 1.20")]
405 #[doc(alias = "invert")]
406 fn connect_invert_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
407 unsafe extern "C" fn notify_invert_trampoline<
408 P: IsA<VideoTransition>,
409 F: Fn(&P) + 'static,
410 >(
411 this: *mut ffi::GESVideoTransition,
412 _param_spec: glib::ffi::gpointer,
413 f: glib::ffi::gpointer,
414 ) {
415 let f: &F = &*(f as *const F);
416 f(VideoTransition::from_glib_borrow(this).unsafe_cast_ref())
417 }
418 unsafe {
419 let f: Box_<F> = Box_::new(f);
420 connect_raw(
421 self.as_ptr() as *mut _,
422 c"notify::invert".as_ptr() as *const _,
423 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
424 notify_invert_trampoline::<Self, F> as *const (),
425 )),
426 Box_::into_raw(f),
427 )
428 }
429 }
430
431 #[doc(alias = "transition-type")]
432 fn connect_transition_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
433 unsafe extern "C" fn notify_transition_type_trampoline<
434 P: IsA<VideoTransition>,
435 F: Fn(&P) + 'static,
436 >(
437 this: *mut ffi::GESVideoTransition,
438 _param_spec: glib::ffi::gpointer,
439 f: glib::ffi::gpointer,
440 ) {
441 let f: &F = &*(f as *const F);
442 f(VideoTransition::from_glib_borrow(this).unsafe_cast_ref())
443 }
444 unsafe {
445 let f: Box_<F> = Box_::new(f);
446 connect_raw(
447 self.as_ptr() as *mut _,
448 c"notify::transition-type".as_ptr() as *const _,
449 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
450 notify_transition_type_trampoline::<Self, F> as *const (),
451 )),
452 Box_::into_raw(f),
453 )
454 }
455 }
456}
457
458impl<O: IsA<VideoTransition>> VideoTransitionExt for O {}