gstreamer_editing_services/auto/track_element.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, Edge, EditMode, Extractable, Layer, MetaContainer, TimelineElement, Track, TrackType,
9};
10use glib::{
11 object::ObjectType as _,
12 prelude::*,
13 signal::{connect_raw, SignalHandlerId},
14 translate::*,
15};
16use std::boxed::Box as Box_;
17
18glib::wrapper! {
19 /// A [`TrackElement`][crate::TrackElement] is a [`TimelineElement`][crate::TimelineElement] that specifically belongs
20 /// to a single [`Track`][crate::Track] of its [`timeline`][struct@crate::TimelineElement#timeline]. Its
21 /// [`start`][struct@crate::TimelineElement#start] and [`duration`][struct@crate::TimelineElement#duration] specify its
22 /// temporal extent in the track. Specifically, a track element wraps some
23 /// nleobject, such as an `nlesource` or `nleoperation`, which can be
24 /// retrieved with [`TrackElementExt::nleobject()`][crate::prelude::TrackElementExt::nleobject()], and its
25 /// [`start`][struct@crate::TimelineElement#start], [`duration`][struct@crate::TimelineElement#duration],
26 /// [`in-point`][struct@crate::TimelineElement#in-point], [`priority`][struct@crate::TimelineElement#priority] and
27 /// [`active`][struct@crate::TrackElement#active] properties expose the corresponding nleobject
28 /// properties. When a track element is added to a track, its nleobject is
29 /// added to the corresponding `nlecomposition` that the track wraps.
30 ///
31 /// Most users will not have to work directly with track elements since a
32 /// [`Clip`][crate::Clip] will automatically create track elements for its timeline's
33 /// tracks and take responsibility for updating them. The only track
34 /// elements that are not automatically created by clips, but a user is
35 /// likely to want to create, are [`Effect`][crate::Effect]-s.
36 ///
37 /// ## Control Bindings for Children Properties
38 ///
39 /// You can set up control bindings for a track element child property
40 /// using [`TrackElementExt::set_control_source()`][crate::prelude::TrackElementExt::set_control_source()]. A
41 /// `GstTimedValueControlSource` should specify the timed values using the
42 /// internal source coordinates (see [`TimelineElement`][crate::TimelineElement]). By default,
43 /// these will be updated to lie between the [`in-point`][struct@crate::TimelineElement#in-point]
44 /// and out-point of the element. This can be switched off by setting
45 /// [`auto-clamp-control-sources`][struct@crate::TrackElement#auto-clamp-control-sources] to [`false`].
46 ///
47 /// This is an Abstract Base Class, you cannot instantiate it.
48 ///
49 /// ## Properties
50 ///
51 ///
52 /// #### `active`
53 /// Whether the effect of the element should be applied in its
54 /// [`track`][struct@crate::TrackElement#track]. If set to [`false`], it will not be used in
55 /// the output of the track.
56 ///
57 /// Readable | Writeable
58 ///
59 ///
60 /// #### `auto-clamp-control-sources`
61 /// Whether the control sources on the element (see
62 /// [`TrackElementExt::set_control_source()`][crate::prelude::TrackElementExt::set_control_source()]) will be automatically
63 /// updated whenever the [`in-point`][struct@crate::TimelineElement#in-point] or out-point of the
64 /// element change in value.
65 ///
66 /// See [`TrackElementExt::clamp_control_source()`][crate::prelude::TrackElementExt::clamp_control_source()] for how this is done
67 /// per control source.
68 ///
69 /// Default value: [`true`]
70 ///
71 /// Readable | Writeable
72 ///
73 ///
74 /// #### `has-internal-source`
75 /// This property is used to determine whether the 'internal time'
76 /// properties of the element have any meaning. In particular, unless
77 /// this is set to [`true`], the [`in-point`][struct@crate::TimelineElement#in-point] and
78 /// [`max-duration`][struct@crate::TimelineElement#max-duration] can not be set to any value other
79 /// than the default 0 and `GST_CLOCK_TIME_NONE`, respectively.
80 ///
81 /// If an element has some *internal* *timed* source [`gst::Element`][crate::gst::Element] that it
82 /// reads stream data from as part of its function in a [`Track`][crate::Track], then
83 /// you'll likely want to set this to [`true`] to allow the
84 /// [`in-point`][struct@crate::TimelineElement#in-point] and [`max-duration`][struct@crate::TimelineElement#max-duration] to
85 /// be set.
86 ///
87 /// The default value is determined by the `GESTrackElementClass`
88 /// `default_has_internal_source` class property. For most
89 /// `GESSourceClass`-es, this will be [`true`], with the exception of those
90 /// that have a potentially *static* source, such as `GESImageSourceClass`
91 /// and `GESTitleSourceClass`. Otherwise, this will usually be [`false`].
92 ///
93 /// For most [`Operation`][crate::Operation]-s you will likely want to leave this set to
94 /// [`false`]. The exception may be for an operation that reads some stream
95 /// data from some private internal source as part of manipulating the
96 /// input data from the usual linked upstream [`TrackElement`][crate::TrackElement].
97 ///
98 /// For example, you may want to set this to [`true`] for a
99 /// [`TrackType::VIDEO`][crate::TrackType::VIDEO] operation that wraps a `textoverlay` that reads
100 /// from a subtitle file and places its text on top of the received video
101 /// data. The [`in-point`][struct@crate::TimelineElement#in-point] of the element would be used
102 /// to shift the initial seek time on the `textoverlay` away from 0, and
103 /// the [`max-duration`][struct@crate::TimelineElement#max-duration] could be set to reflect the
104 /// time at which the subtitle file runs out of data.
105 ///
106 /// Note that GES can not support track elements that have both internal
107 /// content and manipulate the timing of their data streams (time
108 /// effects).
109 ///
110 /// Readable | Writeable
111 ///
112 ///
113 /// #### `track`
114 /// The track that this element belongs to, or [`None`] if it does not
115 /// belong to a track.
116 ///
117 /// Readable
118 ///
119 ///
120 /// #### `track-type`
121 /// The track type of the element, which determines the type of track the
122 /// element can be added to (see [`track-type`][struct@crate::Track#track-type]). This should
123 /// correspond to the type of data that the element can produce or
124 /// process.
125 ///
126 /// Readable | Writeable | Construct
127 /// <details><summary><h4>TimelineElement</h4></summary>
128 ///
129 ///
130 /// #### `duration`
131 /// The duration that the element is in effect for in the timeline (a
132 /// time difference in nanoseconds using the time coordinates of the
133 /// timeline). For example, for a source element, this would determine
134 /// for how long it should output its internal content for. For an
135 /// operation element, this would determine for how long its effect
136 /// should be applied to any source content.
137 ///
138 /// Readable | Writeable
139 ///
140 ///
141 /// #### `in-point`
142 /// The initial offset to use internally when outputting content (in
143 /// nanoseconds, but in the time coordinates of the internal content).
144 ///
145 /// For example, for a [`VideoUriSource`][crate::VideoUriSource] that references some media
146 /// file, the "internal content" is the media file data, and the
147 /// in-point would correspond to some timestamp in the media file.
148 /// When playing the timeline, and when the element is first reached at
149 /// timeline-time [`start`][struct@crate::TimelineElement#start], it will begin outputting the
150 /// data from the timestamp in-point **onwards**, until it reaches the
151 /// end of its [`duration`][struct@crate::TimelineElement#duration] in the timeline.
152 ///
153 /// For elements that have no internal content, this should be kept
154 /// as 0.
155 ///
156 /// Readable | Writeable
157 ///
158 ///
159 /// #### `max-duration`
160 /// The full duration of internal content that is available (a time
161 /// difference in nanoseconds using the time coordinates of the internal
162 /// content).
163 ///
164 /// This will act as a cap on the [`in-point`][struct@crate::TimelineElement#in-point] of the
165 /// element (which is in the same time coordinates), and will sometimes
166 /// be used to limit the [`duration`][struct@crate::TimelineElement#duration] of the element in
167 /// the timeline.
168 ///
169 /// For example, for a [`VideoUriSource`][crate::VideoUriSource] that references some media
170 /// file, this would be the length of the media file.
171 ///
172 /// For elements that have no internal content, or whose content is
173 /// indefinite, this should be kept as `GST_CLOCK_TIME_NONE`.
174 ///
175 /// Readable | Writeable | Construct
176 ///
177 ///
178 /// #### `name`
179 /// The name of the element. This should be unique within its timeline.
180 ///
181 /// Readable | Writeable | Construct
182 ///
183 ///
184 /// #### `parent`
185 /// The parent container of the element.
186 ///
187 /// Readable | Writeable
188 ///
189 ///
190 /// #### `priority`
191 /// The priority of the element.
192 ///
193 /// Readable | Writeable
194 ///
195 ///
196 /// #### `serialize`
197 /// Whether the element should be serialized.
198 ///
199 /// Readable | Writeable
200 ///
201 ///
202 /// #### `start`
203 /// The starting position of the element in the timeline (in nanoseconds
204 /// and in the time coordinates of the timeline). For example, for a
205 /// source element, this would determine the time at which it should
206 /// start outputting its internal content. For an operation element, this
207 /// would determine the time at which it should start applying its effect
208 /// to any source content.
209 ///
210 /// Readable | Writeable
211 ///
212 ///
213 /// #### `timeline`
214 /// The timeline that the element lies within.
215 ///
216 /// Readable | Writeable
217 /// </details>
218 ///
219 /// ## Signals
220 ///
221 ///
222 /// #### `control-binding-added`
223 /// This is emitted when a control binding is added to a child property
224 /// of the track element.
225 ///
226 ///
227 ///
228 ///
229 /// #### `control-binding-removed`
230 /// This is emitted when a control binding is removed from a child
231 /// property of the track element.
232 ///
233 ///
234 /// <details><summary><h4>TimelineElement</h4></summary>
235 ///
236 ///
237 /// #### `child-property-added`
238 /// Emitted when the element has a new child property registered. See
239 /// [`TimelineElementExt::add_child_property()`][crate::prelude::TimelineElementExt::add_child_property()].
240 ///
241 /// Note that some GES elements will be automatically created with
242 /// pre-registered children properties. You can use
243 /// [`TimelineElementExt::list_children_properties()`][crate::prelude::TimelineElementExt::list_children_properties()] to list these.
244 ///
245 ///
246 ///
247 ///
248 /// #### `child-property-removed`
249 /// Emitted when the element has a child property unregistered. See
250 /// [`TimelineElementExt::remove_child_property()`][crate::prelude::TimelineElementExt::remove_child_property()].
251 ///
252 ///
253 ///
254 ///
255 /// #### `deep-notify`
256 /// Emitted when a child of the element has one of its registered
257 /// properties set. See [`TimelineElementExt::add_child_property()`][crate::prelude::TimelineElementExt::add_child_property()].
258 /// Note that unlike [`notify`][struct@crate::glib::Object#notify], a child property name can not be
259 /// used as a signal detail.
260 ///
261 /// Detailed
262 /// </details>
263 /// <details><summary><h4>MetaContainer</h4></summary>
264 ///
265 ///
266 /// #### `notify-meta`
267 /// This is emitted for a meta container whenever the metadata under one
268 /// of its fields changes, is set for the first time, or is removed. In
269 /// the latter case, `value` will be [`None`].
270 ///
271 /// Detailed
272 /// </details>
273 ///
274 /// # Implements
275 ///
276 /// [`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]
277 #[doc(alias = "GESTrackElement")]
278 pub struct TrackElement(Object<ffi::GESTrackElement, ffi::GESTrackElementClass>) @extends TimelineElement, @implements Extractable, MetaContainer;
279
280 match fn {
281 type_ => || ffi::ges_track_element_get_type(),
282 }
283}
284
285impl TrackElement {
286 pub const NONE: Option<&'static TrackElement> = None;
287}
288
289mod sealed {
290 pub trait Sealed {}
291 impl<T: super::IsA<super::TrackElement>> Sealed for T {}
292}
293
294/// Trait containing all [`struct@TrackElement`] methods.
295///
296/// # Implementors
297///
298/// [`Operation`][struct@crate::Operation], [`Source`][struct@crate::Source], [`TrackElement`][struct@crate::TrackElement]
299pub trait TrackElementExt: IsA<TrackElement> + sealed::Sealed + 'static {
300 /// Adds all the properties of a [`gst::Element`][crate::gst::Element] that match the criteria as
301 /// children properties of the track element. If the name of `element`'s
302 /// [`gst::ElementFactory`][crate::gst::ElementFactory] is not in `blacklist`, and the factory's
303 /// `GST_ELEMENT_METADATA_KLASS` contains at least one member of
304 /// `wanted_categories` (e.g. `GST_ELEMENT_FACTORY_KLASS_DECODER`), then
305 /// all the properties of `element` that are also in `whitelist` are added as
306 /// child properties of `self` using
307 /// [`TimelineElementExt::add_child_property()`][crate::prelude::TimelineElementExt::add_child_property()].
308 ///
309 /// This is intended to be used by subclasses when constructing.
310 /// ## `element`
311 /// The child object to retrieve properties from
312 /// ## `wanted_categories`
313 ///
314 /// An array of element factory "klass" categories to whitelist, or [`None`]
315 /// to accept all categories
316 /// ## `blacklist`
317 /// A
318 /// blacklist of element factory names, or [`None`] to not blacklist any
319 /// element factory
320 /// ## `whitelist`
321 /// A
322 /// whitelist of element property names, or [`None`] to whitelist all
323 /// writeable properties
324 #[doc(alias = "ges_track_element_add_children_props")]
325 fn add_children_props(
326 &self,
327 element: &impl IsA<gst::Element>,
328 wanted_categories: &[&str],
329 blacklist: &[&str],
330 whitelist: &[&str],
331 ) {
332 unsafe {
333 ffi::ges_track_element_add_children_props(
334 self.as_ref().to_glib_none().0,
335 element.as_ref().to_glib_none().0,
336 wanted_categories.to_glib_none().0,
337 blacklist.to_glib_none().0,
338 whitelist.to_glib_none().0,
339 );
340 }
341 }
342
343 /// Clamp the `GstTimedValueControlSource` for the specified child property
344 /// to lie between the [`in-point`][struct@crate::TimelineElement#in-point] and out-point of the
345 /// element. The out-point is the `GES_TIMELINE_ELEMENT_END` of the element
346 /// translated from the timeline coordinates to the internal source
347 /// coordinates of the element.
348 ///
349 /// If the property does not have a `GstTimedValueControlSource` set by
350 /// [`set_control_source()`][Self::set_control_source()], nothing happens. Otherwise, if
351 /// a timed value for the control source lies before the in-point of the
352 /// element, or after its out-point, then it will be removed. At the
353 /// in-point and out-point times, a new interpolated value will be placed.
354 /// ## `property_name`
355 /// The name of the child property to clamp the control
356 /// source of
357 #[cfg(feature = "v1_18")]
358 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
359 #[doc(alias = "ges_track_element_clamp_control_source")]
360 fn clamp_control_source(&self, property_name: &str) {
361 unsafe {
362 ffi::ges_track_element_clamp_control_source(
363 self.as_ref().to_glib_none().0,
364 property_name.to_glib_none().0,
365 );
366 }
367 }
368
369 /// Edits the element within its track.
370 ///
371 /// # Deprecated since 1.18
372 ///
373 /// use `ges_timeline_element_edit` instead.
374 /// ## `layers`
375 /// A whitelist of layers
376 /// where the edit can be performed, [`None`] allows all layers in the
377 /// timeline
378 /// ## `mode`
379 /// The edit mode
380 /// ## `edge`
381 /// The edge of `self` where the edit should occur
382 /// ## `position`
383 /// The edit position: a new location for the edge of `self`
384 /// (in nanoseconds)
385 ///
386 /// # Returns
387 ///
388 /// [`true`] if the edit of `self` completed, [`false`] on failure.
389 #[cfg_attr(feature = "v1_18", deprecated = "Since 1.18")]
390 #[allow(deprecated)]
391 #[doc(alias = "ges_track_element_edit")]
392 fn edit(
393 &self,
394 layers: &[Layer],
395 mode: EditMode,
396 edge: Edge,
397 position: u64,
398 ) -> Result<(), glib::error::BoolError> {
399 unsafe {
400 glib::result_from_gboolean!(
401 ffi::ges_track_element_edit(
402 self.as_ref().to_glib_none().0,
403 layers.to_glib_none().0,
404 mode.into_glib(),
405 edge.into_glib(),
406 position
407 ),
408 "Failed to edit"
409 )
410 }
411 }
412
413 //#[doc(alias = "ges_track_element_get_all_control_bindings")]
414 //#[doc(alias = "get_all_control_bindings")]
415 //fn all_control_bindings(&self) -> /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 6, id: 90 } {
416 // unsafe { TODO: call ffi:ges_track_element_get_all_control_bindings() }
417 //}
418
419 /// Gets [`auto-clamp-control-sources`][struct@crate::TrackElement#auto-clamp-control-sources].
420 ///
421 /// # Returns
422 ///
423 /// Whether the control sources for the child properties of
424 /// `self` are automatically clamped.
425 #[cfg(feature = "v1_18")]
426 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
427 #[doc(alias = "ges_track_element_get_auto_clamp_control_sources")]
428 #[doc(alias = "get_auto_clamp_control_sources")]
429 #[doc(alias = "auto-clamp-control-sources")]
430 fn is_auto_clamp_control_sources(&self) -> bool {
431 unsafe {
432 from_glib(ffi::ges_track_element_get_auto_clamp_control_sources(
433 self.as_ref().to_glib_none().0,
434 ))
435 }
436 }
437
438 //#[doc(alias = "ges_track_element_get_child_properties")]
439 //#[doc(alias = "get_child_properties")]
440 //fn child_properties(&self, first_property_name: &str, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) {
441 // unsafe { TODO: call ffi:ges_track_element_get_child_properties() }
442 //}
443
444 /// In general, a copy is made of the property contents and
445 /// the caller is responsible for freeing the memory by calling
446 /// [`glib::Value::unset()`][crate::glib::Value::unset()].
447 ///
448 /// Gets a property of a GstElement contained in `self`.
449 ///
450 /// Note that `ges_track_element_get_child_property` is really
451 /// intended for language bindings, `ges_track_element_get_child_properties`
452 /// is much more convenient for C programming.
453 ///
454 /// # Deprecated
455 ///
456 /// Use `ges_timeline_element_get_child_property`
457 /// ## `property_name`
458 /// The name of the property
459 ///
460 /// # Returns
461 ///
462 /// [`true`] if the property was found, [`false`] otherwise.
463 ///
464 /// ## `value`
465 /// return location for the property value, it will
466 /// be initialized if it is initialized with 0
467 #[doc(alias = "ges_track_element_get_child_property")]
468 #[doc(alias = "get_child_property")]
469 fn child_property(&self, property_name: &str) -> Option<glib::Value> {
470 unsafe {
471 let mut value = glib::Value::uninitialized();
472 let ret = from_glib(ffi::ges_track_element_get_child_property(
473 self.as_ref().to_glib_none().0,
474 property_name.to_glib_none().0,
475 value.to_glib_none_mut().0,
476 ));
477 if ret {
478 Some(value)
479 } else {
480 None
481 }
482 }
483 }
484
485 /// Gets a property of a child of `self`.
486 ///
487 /// # Deprecated
488 ///
489 /// Use `ges_timeline_element_get_child_property_by_pspec`
490 /// ## `pspec`
491 /// The [`glib::ParamSpec`][crate::glib::ParamSpec] that specifies the property you want to get
492 ///
493 /// # Returns
494 ///
495 ///
496 /// ## `value`
497 /// return location for the value
498 #[doc(alias = "ges_track_element_get_child_property_by_pspec")]
499 #[doc(alias = "get_child_property_by_pspec")]
500 fn child_property_by_pspec(&self, pspec: impl AsRef<glib::ParamSpec>) -> glib::Value {
501 unsafe {
502 let mut value = glib::Value::uninitialized();
503 ffi::ges_track_element_get_child_property_by_pspec(
504 self.as_ref().to_glib_none().0,
505 pspec.as_ref().to_glib_none().0,
506 value.to_glib_none_mut().0,
507 );
508 value
509 }
510 }
511
512 //#[doc(alias = "ges_track_element_get_child_property_valist")]
513 //#[doc(alias = "get_child_property_valist")]
514 //fn child_property_valist(&self, first_property_name: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported) {
515 // unsafe { TODO: call ffi:ges_track_element_get_child_property_valist() }
516 //}
517
518 /// Gets the control binding that was created for the specified child
519 /// property of the track element using
520 /// [`set_control_source()`][Self::set_control_source()]. The given `property_name` must
521 /// be the same name of the child property that was passed to
522 /// [`set_control_source()`][Self::set_control_source()].
523 /// ## `property_name`
524 /// The name of the child property to return the control
525 /// binding of
526 ///
527 /// # Returns
528 ///
529 /// The control binding that was
530 /// created for the specified child property of `self`, or [`None`] if
531 /// `property_name` does not correspond to any control binding.
532 #[doc(alias = "ges_track_element_get_control_binding")]
533 #[doc(alias = "get_control_binding")]
534 fn control_binding(&self, property_name: &str) -> Option<gst::ControlBinding> {
535 unsafe {
536 from_glib_none(ffi::ges_track_element_get_control_binding(
537 self.as_ref().to_glib_none().0,
538 property_name.to_glib_none().0,
539 ))
540 }
541 }
542
543 /// Get the [`gst::Element`][crate::gst::Element] that the track element's underlying nleobject
544 /// controls.
545 ///
546 /// # Returns
547 ///
548 /// The [`gst::Element`][crate::gst::Element] being controlled by the
549 /// nleobject that `self` wraps.
550 #[doc(alias = "ges_track_element_get_element")]
551 #[doc(alias = "get_element")]
552 fn element(&self) -> Option<gst::Element> {
553 unsafe {
554 from_glib_none(ffi::ges_track_element_get_element(
555 self.as_ref().to_glib_none().0,
556 ))
557 }
558 }
559
560 /// Get the GNonLin object this object is controlling.
561 ///
562 /// # Deprecated
563 ///
564 /// use `ges_track_element_get_nleobject` instead.
565 ///
566 /// # Returns
567 ///
568 /// The GNonLin object this object is controlling.
569 #[doc(alias = "ges_track_element_get_gnlobject")]
570 #[doc(alias = "get_gnlobject")]
571 fn gnlobject(&self) -> gst::Element {
572 unsafe {
573 from_glib_none(ffi::ges_track_element_get_gnlobject(
574 self.as_ref().to_glib_none().0,
575 ))
576 }
577 }
578
579 /// Get the nleobject that this element wraps.
580 ///
581 /// # Returns
582 ///
583 /// The nleobject that `self` wraps.
584 #[doc(alias = "ges_track_element_get_nleobject")]
585 #[doc(alias = "get_nleobject")]
586 fn nleobject(&self) -> gst::Element {
587 unsafe {
588 from_glib_none(ffi::ges_track_element_get_nleobject(
589 self.as_ref().to_glib_none().0,
590 ))
591 }
592 }
593
594 /// Get the [`track`][struct@crate::TrackElement#track] for the element.
595 ///
596 /// # Returns
597 ///
598 /// The track that `self` belongs to,
599 /// or [`None`] if it does not belong to a track.
600 #[doc(alias = "ges_track_element_get_track")]
601 #[doc(alias = "get_track")]
602 fn track(&self) -> Option<Track> {
603 unsafe {
604 from_glib_none(ffi::ges_track_element_get_track(
605 self.as_ref().to_glib_none().0,
606 ))
607 }
608 }
609
610 /// Gets the [`track-type`][struct@crate::TrackElement#track-type] for the element.
611 ///
612 /// # Returns
613 ///
614 /// The track-type of `self`.
615 #[doc(alias = "ges_track_element_get_track_type")]
616 #[doc(alias = "get_track_type")]
617 #[doc(alias = "track-type")]
618 fn track_type(&self) -> TrackType {
619 unsafe {
620 from_glib(ffi::ges_track_element_get_track_type(
621 self.as_ref().to_glib_none().0,
622 ))
623 }
624 }
625
626 /// Gets [`has-internal-source`][struct@crate::TrackElement#has-internal-source] for the element.
627 ///
628 /// # Returns
629 ///
630 /// [`true`] if `self` can have its 'internal time' properties set.
631 #[cfg(feature = "v1_18")]
632 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
633 #[doc(alias = "ges_track_element_has_internal_source")]
634 fn has_internal_source(&self) -> bool {
635 unsafe {
636 from_glib(ffi::ges_track_element_has_internal_source(
637 self.as_ref().to_glib_none().0,
638 ))
639 }
640 }
641
642 /// Gets [`active`][struct@crate::TrackElement#active] for the element.
643 ///
644 /// # Returns
645 ///
646 /// [`true`] if `self` is active in its track.
647 #[doc(alias = "ges_track_element_is_active")]
648 #[doc(alias = "active")]
649 fn is_active(&self) -> bool {
650 unsafe {
651 from_glib(ffi::ges_track_element_is_active(
652 self.as_ref().to_glib_none().0,
653 ))
654 }
655 }
656
657 /// Get whether the given track element is a core track element. That is,
658 /// it was created by the `create_track_elements` `GESClipClass` method for
659 /// some [`Clip`][crate::Clip].
660 ///
661 /// Note that such a track element can only be added to a clip that shares
662 /// the same [`Asset`][crate::Asset] as the clip that created it. For example, you are
663 /// allowed to move core children between clips that resulted from
664 /// [`GESContainerExt::ungroup()`][crate::prelude::GESContainerExt::ungroup()], but you could not move the core child from a
665 /// [`UriClip`][crate::UriClip] to a [`TitleClip`][crate::TitleClip] or another [`UriClip`][crate::UriClip] with a different
666 /// [`uri`][struct@crate::UriClip#uri].
667 ///
668 /// Moreover, if a core track element is added to a clip, it will always be
669 /// added as a core child. Therefore, if this returns [`true`], then `element`
670 /// will be a core child of its parent clip.
671 ///
672 /// # Returns
673 ///
674 /// [`true`] if `element` is a core track element.
675 #[cfg(feature = "v1_18")]
676 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
677 #[doc(alias = "ges_track_element_is_core")]
678 fn is_core(&self) -> bool {
679 unsafe {
680 from_glib(ffi::ges_track_element_is_core(
681 self.as_ref().to_glib_none().0,
682 ))
683 }
684 }
685
686 /// Gets an array of [`glib::ParamSpec`][crate::glib::ParamSpec]* for all configurable properties of the
687 /// children of `self`.
688 ///
689 /// # Deprecated
690 ///
691 /// Use `ges_timeline_element_list_children_properties`
692 ///
693 /// # Returns
694 ///
695 /// An array of [`glib::ParamSpec`][crate::glib::ParamSpec]* which should be freed after use or
696 /// [`None`] if something went wrong.
697 #[doc(alias = "ges_track_element_list_children_properties")]
698 fn list_children_properties(&self) -> Vec<glib::ParamSpec> {
699 unsafe {
700 let mut n_properties = std::mem::MaybeUninit::uninit();
701 let ret = FromGlibContainer::from_glib_full_num(
702 ffi::ges_track_element_list_children_properties(
703 self.as_ref().to_glib_none().0,
704 n_properties.as_mut_ptr(),
705 ),
706 n_properties.assume_init() as _,
707 );
708 ret
709 }
710 }
711
712 /// Looks up which `element` and `pspec` would be effected by the given `name`. If various
713 /// contained elements have this property name you will get the first one, unless you
714 /// specify the class name in `name`.
715 ///
716 /// # Deprecated
717 ///
718 /// Use `ges_timeline_element_lookup_child`
719 /// ## `prop_name`
720 /// Name of the property to look up. You can specify the name of the
721 /// class as such: "ClassName::property-name", to guarantee that you get the
722 /// proper GParamSpec in case various GstElement-s contain the same property
723 /// name. If you don't do so, you will get the first element found, having
724 /// this property and the and the corresponding GParamSpec.
725 ///
726 /// # Returns
727 ///
728 /// TRUE if `element` and `pspec` could be found. FALSE otherwise. In that
729 /// case the values for `pspec` and `element` are not modified. Unref `element` after
730 /// usage.
731 ///
732 /// ## `element`
733 /// pointer to a [`gst::Element`][crate::gst::Element] that
734 /// takes the real object to set property on
735 ///
736 /// ## `pspec`
737 /// pointer to take the specification
738 /// describing the property
739 #[doc(alias = "ges_track_element_lookup_child")]
740 fn lookup_child(&self, prop_name: &str) -> Option<(gst::Element, glib::ParamSpec)> {
741 unsafe {
742 let mut element = std::ptr::null_mut();
743 let mut pspec = std::ptr::null_mut();
744 let ret = from_glib(ffi::ges_track_element_lookup_child(
745 self.as_ref().to_glib_none().0,
746 prop_name.to_glib_none().0,
747 &mut element,
748 &mut pspec,
749 ));
750 if ret {
751 Some((from_glib_full(element), from_glib_full(pspec)))
752 } else {
753 None
754 }
755 }
756 }
757
758 /// Removes the [`gst::ControlBinding`][crate::gst::ControlBinding] that was created for the specified child
759 /// property of the track element using
760 /// [`set_control_source()`][Self::set_control_source()]. The given `property_name` must
761 /// be the same name of the child property that was passed to
762 /// [`set_control_source()`][Self::set_control_source()].
763 /// ## `property_name`
764 /// The name of the child property to remove the control
765 /// binding from
766 ///
767 /// # Returns
768 ///
769 /// [`true`] if the control binding was removed from the specified
770 /// child property of `self`, or [`false`] if an error occurred.
771 #[doc(alias = "ges_track_element_remove_control_binding")]
772 fn remove_control_binding(&self, property_name: &str) -> Result<(), glib::error::BoolError> {
773 unsafe {
774 glib::result_from_gboolean!(
775 ffi::ges_track_element_remove_control_binding(
776 self.as_ref().to_glib_none().0,
777 property_name.to_glib_none().0
778 ),
779 "Failed to remove control binding"
780 )
781 }
782 }
783
784 /// Sets [`active`][struct@crate::TrackElement#active] for the element.
785 /// ## `active`
786 /// Whether `self` should be active in its track
787 ///
788 /// # Returns
789 ///
790 /// [`true`] if the property was *toggled*.
791 #[doc(alias = "ges_track_element_set_active")]
792 #[doc(alias = "active")]
793 fn set_active(&self, active: bool) -> bool {
794 unsafe {
795 from_glib(ffi::ges_track_element_set_active(
796 self.as_ref().to_glib_none().0,
797 active.into_glib(),
798 ))
799 }
800 }
801
802 /// Sets [`auto-clamp-control-sources`][struct@crate::TrackElement#auto-clamp-control-sources]. If set to [`true`], this
803 /// will immediately clamp all the control sources.
804 /// ## `auto_clamp`
805 /// Whether to automatically clamp the control sources for the
806 /// child properties of `self`
807 #[cfg(feature = "v1_18")]
808 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
809 #[doc(alias = "ges_track_element_set_auto_clamp_control_sources")]
810 #[doc(alias = "auto-clamp-control-sources")]
811 fn set_auto_clamp_control_sources(&self, auto_clamp: bool) {
812 unsafe {
813 ffi::ges_track_element_set_auto_clamp_control_sources(
814 self.as_ref().to_glib_none().0,
815 auto_clamp.into_glib(),
816 );
817 }
818 }
819
820 //#[doc(alias = "ges_track_element_set_child_properties")]
821 //fn set_child_properties(&self, first_property_name: &str, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) {
822 // unsafe { TODO: call ffi:ges_track_element_set_child_properties() }
823 //}
824
825 /// Sets a property of a GstElement contained in `self`.
826 ///
827 /// Note that `ges_track_element_set_child_property` is really
828 /// intended for language bindings, `ges_track_element_set_child_properties`
829 /// is much more convenient for C programming.
830 ///
831 /// # Deprecated
832 ///
833 /// use `ges_timeline_element_set_child_property` instead
834 /// ## `property_name`
835 /// The name of the property
836 /// ## `value`
837 /// The value
838 ///
839 /// # Returns
840 ///
841 /// [`true`] if the property was set, [`false`] otherwise.
842 #[doc(alias = "ges_track_element_set_child_property")]
843 fn set_child_property(
844 &self,
845 property_name: &str,
846 value: &glib::Value,
847 ) -> Result<(), glib::error::BoolError> {
848 unsafe {
849 glib::result_from_gboolean!(
850 ffi::ges_track_element_set_child_property(
851 self.as_ref().to_glib_none().0,
852 property_name.to_glib_none().0,
853 mut_override(value.to_glib_none().0)
854 ),
855 "Failed to set child property"
856 )
857 }
858 }
859
860 /// Sets a property of a child of `self`.
861 ///
862 /// # Deprecated
863 ///
864 /// Use `ges_timeline_element_set_child_property_by_spec`
865 /// ## `pspec`
866 /// The [`glib::ParamSpec`][crate::glib::ParamSpec] that specifies the property you want to set
867 /// ## `value`
868 /// The value
869 #[doc(alias = "ges_track_element_set_child_property_by_pspec")]
870 fn set_child_property_by_pspec(&self, pspec: impl AsRef<glib::ParamSpec>, value: &glib::Value) {
871 unsafe {
872 ffi::ges_track_element_set_child_property_by_pspec(
873 self.as_ref().to_glib_none().0,
874 pspec.as_ref().to_glib_none().0,
875 mut_override(value.to_glib_none().0),
876 );
877 }
878 }
879
880 //#[doc(alias = "ges_track_element_set_child_property_valist")]
881 //fn set_child_property_valist(&self, first_property_name: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported) {
882 // unsafe { TODO: call ffi:ges_track_element_set_child_property_valist() }
883 //}
884
885 /// Creates a [`gst::ControlBinding`][crate::gst::ControlBinding] for the specified child property of the
886 /// track element using the given control source. The given `property_name`
887 /// should refer to an existing child property of the track element, as
888 /// used in [`TimelineElementExt::lookup_child()`][crate::prelude::TimelineElementExt::lookup_child()].
889 ///
890 /// If `binding_type` is "direct", then the control binding is created with
891 /// `gst_direct_control_binding_new()` using the given control source. If
892 /// `binding_type` is "direct-absolute", it is created with
893 /// `gst_direct_control_binding_new_absolute()` instead.
894 /// ## `source`
895 /// The control source to bind the child property to
896 /// ## `property_name`
897 /// The name of the child property to control
898 /// ## `binding_type`
899 /// The type of binding to create ("direct" or
900 /// "direct-absolute")
901 ///
902 /// # Returns
903 ///
904 /// [`true`] if the specified child property could be bound to
905 /// `source`, or [`false`] if an error occurred.
906 #[doc(alias = "ges_track_element_set_control_source")]
907 fn set_control_source(
908 &self,
909 source: &impl IsA<gst::ControlSource>,
910 property_name: &str,
911 binding_type: &str,
912 ) -> bool {
913 unsafe {
914 from_glib(ffi::ges_track_element_set_control_source(
915 self.as_ref().to_glib_none().0,
916 source.as_ref().to_glib_none().0,
917 property_name.to_glib_none().0,
918 binding_type.to_glib_none().0,
919 ))
920 }
921 }
922
923 /// Sets [`has-internal-source`][struct@crate::TrackElement#has-internal-source] for the element. If this is
924 /// set to [`false`], this method will also set the
925 /// [`in-point`][struct@crate::TimelineElement#in-point] of the element to 0 and its
926 /// [`max-duration`][struct@crate::TimelineElement#max-duration] to `GST_CLOCK_TIME_NONE`.
927 /// ## `has_internal_source`
928 /// Whether the `self` should be allowed to have its
929 /// 'internal time' properties set.
930 ///
931 /// # Returns
932 ///
933 /// [`false`] if `has_internal_source` is forbidden for `self` and
934 /// [`true`] in any other case.
935 #[cfg(feature = "v1_18")]
936 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
937 #[doc(alias = "ges_track_element_set_has_internal_source")]
938 #[doc(alias = "has-internal-source")]
939 fn set_has_internal_source(&self, has_internal_source: bool) -> bool {
940 unsafe {
941 from_glib(ffi::ges_track_element_set_has_internal_source(
942 self.as_ref().to_glib_none().0,
943 has_internal_source.into_glib(),
944 ))
945 }
946 }
947
948 /// Sets the [`track-type`][struct@crate::TrackElement#track-type] for the element.
949 /// ## `type_`
950 /// The new track-type for `self`
951 #[doc(alias = "ges_track_element_set_track_type")]
952 #[doc(alias = "track-type")]
953 fn set_track_type(&self, type_: TrackType) {
954 unsafe {
955 ffi::ges_track_element_set_track_type(
956 self.as_ref().to_glib_none().0,
957 type_.into_glib(),
958 );
959 }
960 }
961
962 /// This is emitted when a control binding is added to a child property
963 /// of the track element.
964 /// ## `control_binding`
965 /// The control binding that has been added
966 #[doc(alias = "control-binding-added")]
967 fn connect_control_binding_added<F: Fn(&Self, &gst::ControlBinding) + 'static>(
968 &self,
969 f: F,
970 ) -> SignalHandlerId {
971 unsafe extern "C" fn control_binding_added_trampoline<
972 P: IsA<TrackElement>,
973 F: Fn(&P, &gst::ControlBinding) + 'static,
974 >(
975 this: *mut ffi::GESTrackElement,
976 control_binding: *mut gst::ffi::GstControlBinding,
977 f: glib::ffi::gpointer,
978 ) {
979 let f: &F = &*(f as *const F);
980 f(
981 TrackElement::from_glib_borrow(this).unsafe_cast_ref(),
982 &from_glib_borrow(control_binding),
983 )
984 }
985 unsafe {
986 let f: Box_<F> = Box_::new(f);
987 connect_raw(
988 self.as_ptr() as *mut _,
989 b"control-binding-added\0".as_ptr() as *const _,
990 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
991 control_binding_added_trampoline::<Self, F> as *const (),
992 )),
993 Box_::into_raw(f),
994 )
995 }
996 }
997
998 /// This is emitted when a control binding is removed from a child
999 /// property of the track element.
1000 /// ## `control_binding`
1001 /// The control binding that has been removed
1002 #[doc(alias = "control-binding-removed")]
1003 fn connect_control_binding_removed<F: Fn(&Self, &gst::ControlBinding) + 'static>(
1004 &self,
1005 f: F,
1006 ) -> SignalHandlerId {
1007 unsafe extern "C" fn control_binding_removed_trampoline<
1008 P: IsA<TrackElement>,
1009 F: Fn(&P, &gst::ControlBinding) + 'static,
1010 >(
1011 this: *mut ffi::GESTrackElement,
1012 control_binding: *mut gst::ffi::GstControlBinding,
1013 f: glib::ffi::gpointer,
1014 ) {
1015 let f: &F = &*(f as *const F);
1016 f(
1017 TrackElement::from_glib_borrow(this).unsafe_cast_ref(),
1018 &from_glib_borrow(control_binding),
1019 )
1020 }
1021 unsafe {
1022 let f: Box_<F> = Box_::new(f);
1023 connect_raw(
1024 self.as_ptr() as *mut _,
1025 b"control-binding-removed\0".as_ptr() as *const _,
1026 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1027 control_binding_removed_trampoline::<Self, F> as *const (),
1028 )),
1029 Box_::into_raw(f),
1030 )
1031 }
1032 }
1033
1034 #[doc(alias = "active")]
1035 fn connect_active_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1036 unsafe extern "C" fn notify_active_trampoline<P: IsA<TrackElement>, F: Fn(&P) + 'static>(
1037 this: *mut ffi::GESTrackElement,
1038 _param_spec: glib::ffi::gpointer,
1039 f: glib::ffi::gpointer,
1040 ) {
1041 let f: &F = &*(f as *const F);
1042 f(TrackElement::from_glib_borrow(this).unsafe_cast_ref())
1043 }
1044 unsafe {
1045 let f: Box_<F> = Box_::new(f);
1046 connect_raw(
1047 self.as_ptr() as *mut _,
1048 b"notify::active\0".as_ptr() as *const _,
1049 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1050 notify_active_trampoline::<Self, F> as *const (),
1051 )),
1052 Box_::into_raw(f),
1053 )
1054 }
1055 }
1056
1057 #[cfg(feature = "v1_18")]
1058 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
1059 #[doc(alias = "auto-clamp-control-sources")]
1060 fn connect_auto_clamp_control_sources_notify<F: Fn(&Self) + 'static>(
1061 &self,
1062 f: F,
1063 ) -> SignalHandlerId {
1064 unsafe extern "C" fn notify_auto_clamp_control_sources_trampoline<
1065 P: IsA<TrackElement>,
1066 F: Fn(&P) + 'static,
1067 >(
1068 this: *mut ffi::GESTrackElement,
1069 _param_spec: glib::ffi::gpointer,
1070 f: glib::ffi::gpointer,
1071 ) {
1072 let f: &F = &*(f as *const F);
1073 f(TrackElement::from_glib_borrow(this).unsafe_cast_ref())
1074 }
1075 unsafe {
1076 let f: Box_<F> = Box_::new(f);
1077 connect_raw(
1078 self.as_ptr() as *mut _,
1079 b"notify::auto-clamp-control-sources\0".as_ptr() as *const _,
1080 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1081 notify_auto_clamp_control_sources_trampoline::<Self, F> as *const (),
1082 )),
1083 Box_::into_raw(f),
1084 )
1085 }
1086 }
1087
1088 #[cfg(feature = "v1_18")]
1089 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
1090 #[doc(alias = "has-internal-source")]
1091 fn connect_has_internal_source_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1092 unsafe extern "C" fn notify_has_internal_source_trampoline<
1093 P: IsA<TrackElement>,
1094 F: Fn(&P) + 'static,
1095 >(
1096 this: *mut ffi::GESTrackElement,
1097 _param_spec: glib::ffi::gpointer,
1098 f: glib::ffi::gpointer,
1099 ) {
1100 let f: &F = &*(f as *const F);
1101 f(TrackElement::from_glib_borrow(this).unsafe_cast_ref())
1102 }
1103 unsafe {
1104 let f: Box_<F> = Box_::new(f);
1105 connect_raw(
1106 self.as_ptr() as *mut _,
1107 b"notify::has-internal-source\0".as_ptr() as *const _,
1108 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1109 notify_has_internal_source_trampoline::<Self, F> as *const (),
1110 )),
1111 Box_::into_raw(f),
1112 )
1113 }
1114 }
1115
1116 #[doc(alias = "track")]
1117 fn connect_track_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1118 unsafe extern "C" fn notify_track_trampoline<P: IsA<TrackElement>, F: Fn(&P) + 'static>(
1119 this: *mut ffi::GESTrackElement,
1120 _param_spec: glib::ffi::gpointer,
1121 f: glib::ffi::gpointer,
1122 ) {
1123 let f: &F = &*(f as *const F);
1124 f(TrackElement::from_glib_borrow(this).unsafe_cast_ref())
1125 }
1126 unsafe {
1127 let f: Box_<F> = Box_::new(f);
1128 connect_raw(
1129 self.as_ptr() as *mut _,
1130 b"notify::track\0".as_ptr() as *const _,
1131 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1132 notify_track_trampoline::<Self, F> as *const (),
1133 )),
1134 Box_::into_raw(f),
1135 )
1136 }
1137 }
1138
1139 #[doc(alias = "track-type")]
1140 fn connect_track_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1141 unsafe extern "C" fn notify_track_type_trampoline<
1142 P: IsA<TrackElement>,
1143 F: Fn(&P) + 'static,
1144 >(
1145 this: *mut ffi::GESTrackElement,
1146 _param_spec: glib::ffi::gpointer,
1147 f: glib::ffi::gpointer,
1148 ) {
1149 let f: &F = &*(f as *const F);
1150 f(TrackElement::from_glib_borrow(this).unsafe_cast_ref())
1151 }
1152 unsafe {
1153 let f: Box_<F> = Box_::new(f);
1154 connect_raw(
1155 self.as_ptr() as *mut _,
1156 b"notify::track-type\0".as_ptr() as *const _,
1157 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1158 notify_track_type_trampoline::<Self, F> as *const (),
1159 )),
1160 Box_::into_raw(f),
1161 )
1162 }
1163 }
1164}
1165
1166impl<O: IsA<TrackElement>> TrackElementExt for O {}