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
289/// Trait containing all [`struct@TrackElement`] methods.
290///
291/// # Implementors
292///
293/// [`Operation`][struct@crate::Operation], [`Source`][struct@crate::Source], [`TrackElement`][struct@crate::TrackElement]
294pub trait TrackElementExt: IsA<TrackElement> + 'static {
295 /// Adds all the properties of a [`gst::Element`][crate::gst::Element] that match the criteria as
296 /// children properties of the track element. If the name of `element`'s
297 /// [`gst::ElementFactory`][crate::gst::ElementFactory] is not in `blacklist`, and the factory's
298 /// `GST_ELEMENT_METADATA_KLASS` contains at least one member of
299 /// `wanted_categories` (e.g. `GST_ELEMENT_FACTORY_KLASS_DECODER`), then
300 /// all the properties of `element` that are also in `whitelist` are added as
301 /// child properties of `self` using
302 /// [`TimelineElementExt::add_child_property()`][crate::prelude::TimelineElementExt::add_child_property()].
303 ///
304 /// This is intended to be used by subclasses when constructing.
305 /// ## `element`
306 /// The child object to retrieve properties from
307 /// ## `wanted_categories`
308 ///
309 /// An array of element factory "klass" categories to whitelist, or [`None`]
310 /// to accept all categories
311 /// ## `blacklist`
312 /// A
313 /// blacklist of element factory names, or [`None`] to not blacklist any
314 /// element factory
315 /// ## `whitelist`
316 /// A
317 /// whitelist of element property names, or [`None`] to whitelist all
318 /// writeable properties
319 #[doc(alias = "ges_track_element_add_children_props")]
320 fn add_children_props(
321 &self,
322 element: &impl IsA<gst::Element>,
323 wanted_categories: &[&str],
324 blacklist: &[&str],
325 whitelist: &[&str],
326 ) {
327 unsafe {
328 ffi::ges_track_element_add_children_props(
329 self.as_ref().to_glib_none().0,
330 element.as_ref().to_glib_none().0,
331 wanted_categories.to_glib_none().0,
332 blacklist.to_glib_none().0,
333 whitelist.to_glib_none().0,
334 );
335 }
336 }
337
338 /// Clamp the `GstTimedValueControlSource` for the specified child property
339 /// to lie between the [`in-point`][struct@crate::TimelineElement#in-point] and out-point of the
340 /// element. The out-point is the `GES_TIMELINE_ELEMENT_END` of the element
341 /// translated from the timeline coordinates to the internal source
342 /// coordinates of the element.
343 ///
344 /// If the property does not have a `GstTimedValueControlSource` set by
345 /// [`set_control_source()`][Self::set_control_source()], nothing happens. Otherwise, if
346 /// a timed value for the control source lies before the in-point of the
347 /// element, or after its out-point, then it will be removed. At the
348 /// in-point and out-point times, a new interpolated value will be placed.
349 /// ## `property_name`
350 /// The name of the child property to clamp the control
351 /// source of
352 #[cfg(feature = "v1_18")]
353 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
354 #[doc(alias = "ges_track_element_clamp_control_source")]
355 fn clamp_control_source(&self, property_name: &str) {
356 unsafe {
357 ffi::ges_track_element_clamp_control_source(
358 self.as_ref().to_glib_none().0,
359 property_name.to_glib_none().0,
360 );
361 }
362 }
363
364 /// Edits the element within its track.
365 ///
366 /// # Deprecated since 1.18
367 ///
368 /// use `ges_timeline_element_edit` instead.
369 /// ## `layers`
370 /// A whitelist of layers
371 /// where the edit can be performed, [`None`] allows all layers in the
372 /// timeline
373 /// ## `mode`
374 /// The edit mode
375 /// ## `edge`
376 /// The edge of `self` where the edit should occur
377 /// ## `position`
378 /// The edit position: a new location for the edge of `self`
379 /// (in nanoseconds)
380 ///
381 /// # Returns
382 ///
383 /// [`true`] if the edit of `self` completed, [`false`] on failure.
384 #[cfg_attr(feature = "v1_18", deprecated = "Since 1.18")]
385 #[allow(deprecated)]
386 #[doc(alias = "ges_track_element_edit")]
387 fn edit(
388 &self,
389 layers: &[Layer],
390 mode: EditMode,
391 edge: Edge,
392 position: u64,
393 ) -> Result<(), glib::error::BoolError> {
394 unsafe {
395 glib::result_from_gboolean!(
396 ffi::ges_track_element_edit(
397 self.as_ref().to_glib_none().0,
398 layers.to_glib_none().0,
399 mode.into_glib(),
400 edge.into_glib(),
401 position
402 ),
403 "Failed to edit"
404 )
405 }
406 }
407
408 //#[doc(alias = "ges_track_element_get_all_control_bindings")]
409 //#[doc(alias = "get_all_control_bindings")]
410 //fn all_control_bindings(&self) -> /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 6, id: 90 } {
411 // unsafe { TODO: call ffi:ges_track_element_get_all_control_bindings() }
412 //}
413
414 /// Gets [`auto-clamp-control-sources`][struct@crate::TrackElement#auto-clamp-control-sources].
415 ///
416 /// # Returns
417 ///
418 /// Whether the control sources for the child properties of
419 /// `self` are automatically clamped.
420 #[cfg(feature = "v1_18")]
421 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
422 #[doc(alias = "ges_track_element_get_auto_clamp_control_sources")]
423 #[doc(alias = "get_auto_clamp_control_sources")]
424 #[doc(alias = "auto-clamp-control-sources")]
425 fn is_auto_clamp_control_sources(&self) -> bool {
426 unsafe {
427 from_glib(ffi::ges_track_element_get_auto_clamp_control_sources(
428 self.as_ref().to_glib_none().0,
429 ))
430 }
431 }
432
433 //#[doc(alias = "ges_track_element_get_child_properties")]
434 //#[doc(alias = "get_child_properties")]
435 //fn child_properties(&self, first_property_name: &str, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) {
436 // unsafe { TODO: call ffi:ges_track_element_get_child_properties() }
437 //}
438
439 /// In general, a copy is made of the property contents and
440 /// the caller is responsible for freeing the memory by calling
441 /// [`glib::Value::unset()`][crate::glib::Value::unset()].
442 ///
443 /// Gets a property of a GstElement contained in `self`.
444 ///
445 /// Note that `ges_track_element_get_child_property` is really
446 /// intended for language bindings, `ges_track_element_get_child_properties`
447 /// is much more convenient for C programming.
448 ///
449 /// # Deprecated
450 ///
451 /// Use `ges_timeline_element_get_child_property`
452 /// ## `property_name`
453 /// The name of the property
454 ///
455 /// # Returns
456 ///
457 /// [`true`] if the property was found, [`false`] otherwise.
458 ///
459 /// ## `value`
460 /// return location for the property value, it will
461 /// be initialized if it is initialized with 0
462 #[doc(alias = "ges_track_element_get_child_property")]
463 #[doc(alias = "get_child_property")]
464 fn child_property(&self, property_name: &str) -> Option<glib::Value> {
465 unsafe {
466 let mut value = glib::Value::uninitialized();
467 let ret = from_glib(ffi::ges_track_element_get_child_property(
468 self.as_ref().to_glib_none().0,
469 property_name.to_glib_none().0,
470 value.to_glib_none_mut().0,
471 ));
472 if ret {
473 Some(value)
474 } else {
475 None
476 }
477 }
478 }
479
480 /// Gets a property of a child of `self`.
481 ///
482 /// # Deprecated
483 ///
484 /// Use `ges_timeline_element_get_child_property_by_pspec`
485 /// ## `pspec`
486 /// The [`glib::ParamSpec`][crate::glib::ParamSpec] that specifies the property you want to get
487 ///
488 /// # Returns
489 ///
490 ///
491 /// ## `value`
492 /// return location for the value
493 #[doc(alias = "ges_track_element_get_child_property_by_pspec")]
494 #[doc(alias = "get_child_property_by_pspec")]
495 fn child_property_by_pspec(&self, pspec: impl AsRef<glib::ParamSpec>) -> glib::Value {
496 unsafe {
497 let mut value = glib::Value::uninitialized();
498 ffi::ges_track_element_get_child_property_by_pspec(
499 self.as_ref().to_glib_none().0,
500 pspec.as_ref().to_glib_none().0,
501 value.to_glib_none_mut().0,
502 );
503 value
504 }
505 }
506
507 //#[doc(alias = "ges_track_element_get_child_property_valist")]
508 //#[doc(alias = "get_child_property_valist")]
509 //fn child_property_valist(&self, first_property_name: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported) {
510 // unsafe { TODO: call ffi:ges_track_element_get_child_property_valist() }
511 //}
512
513 /// Gets the control binding that was created for the specified child
514 /// property of the track element using
515 /// [`set_control_source()`][Self::set_control_source()]. The given `property_name` must
516 /// be the same name of the child property that was passed to
517 /// [`set_control_source()`][Self::set_control_source()].
518 /// ## `property_name`
519 /// The name of the child property to return the control
520 /// binding of
521 ///
522 /// # Returns
523 ///
524 /// The control binding that was
525 /// created for the specified child property of `self`, or [`None`] if
526 /// `property_name` does not correspond to any control binding.
527 #[doc(alias = "ges_track_element_get_control_binding")]
528 #[doc(alias = "get_control_binding")]
529 fn control_binding(&self, property_name: &str) -> Option<gst::ControlBinding> {
530 unsafe {
531 from_glib_none(ffi::ges_track_element_get_control_binding(
532 self.as_ref().to_glib_none().0,
533 property_name.to_glib_none().0,
534 ))
535 }
536 }
537
538 /// Get the [`gst::Element`][crate::gst::Element] that the track element's underlying nleobject
539 /// controls.
540 ///
541 /// # Returns
542 ///
543 /// The [`gst::Element`][crate::gst::Element] being controlled by the
544 /// nleobject that `self` wraps.
545 #[doc(alias = "ges_track_element_get_element")]
546 #[doc(alias = "get_element")]
547 fn element(&self) -> Option<gst::Element> {
548 unsafe {
549 from_glib_none(ffi::ges_track_element_get_element(
550 self.as_ref().to_glib_none().0,
551 ))
552 }
553 }
554
555 /// Get the GNonLin object this object is controlling.
556 ///
557 /// # Deprecated
558 ///
559 /// use `ges_track_element_get_nleobject` instead.
560 ///
561 /// # Returns
562 ///
563 /// The GNonLin object this object is controlling.
564 #[doc(alias = "ges_track_element_get_gnlobject")]
565 #[doc(alias = "get_gnlobject")]
566 fn gnlobject(&self) -> gst::Element {
567 unsafe {
568 from_glib_none(ffi::ges_track_element_get_gnlobject(
569 self.as_ref().to_glib_none().0,
570 ))
571 }
572 }
573
574 /// Get the nleobject that this element wraps.
575 ///
576 /// # Returns
577 ///
578 /// The nleobject that `self` wraps.
579 #[doc(alias = "ges_track_element_get_nleobject")]
580 #[doc(alias = "get_nleobject")]
581 fn nleobject(&self) -> gst::Element {
582 unsafe {
583 from_glib_none(ffi::ges_track_element_get_nleobject(
584 self.as_ref().to_glib_none().0,
585 ))
586 }
587 }
588
589 /// Get the [`track`][struct@crate::TrackElement#track] for the element.
590 ///
591 /// # Returns
592 ///
593 /// The track that `self` belongs to,
594 /// or [`None`] if it does not belong to a track.
595 #[doc(alias = "ges_track_element_get_track")]
596 #[doc(alias = "get_track")]
597 fn track(&self) -> Option<Track> {
598 unsafe {
599 from_glib_none(ffi::ges_track_element_get_track(
600 self.as_ref().to_glib_none().0,
601 ))
602 }
603 }
604
605 /// Gets the [`track-type`][struct@crate::TrackElement#track-type] for the element.
606 ///
607 /// # Returns
608 ///
609 /// The track-type of `self`.
610 #[doc(alias = "ges_track_element_get_track_type")]
611 #[doc(alias = "get_track_type")]
612 #[doc(alias = "track-type")]
613 fn track_type(&self) -> TrackType {
614 unsafe {
615 from_glib(ffi::ges_track_element_get_track_type(
616 self.as_ref().to_glib_none().0,
617 ))
618 }
619 }
620
621 /// Gets [`has-internal-source`][struct@crate::TrackElement#has-internal-source] for the element.
622 ///
623 /// # Returns
624 ///
625 /// [`true`] if `self` can have its 'internal time' properties set.
626 #[cfg(feature = "v1_18")]
627 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
628 #[doc(alias = "ges_track_element_has_internal_source")]
629 fn has_internal_source(&self) -> bool {
630 unsafe {
631 from_glib(ffi::ges_track_element_has_internal_source(
632 self.as_ref().to_glib_none().0,
633 ))
634 }
635 }
636
637 /// Gets [`active`][struct@crate::TrackElement#active] for the element.
638 ///
639 /// # Returns
640 ///
641 /// [`true`] if `self` is active in its track.
642 #[doc(alias = "ges_track_element_is_active")]
643 #[doc(alias = "active")]
644 fn is_active(&self) -> bool {
645 unsafe {
646 from_glib(ffi::ges_track_element_is_active(
647 self.as_ref().to_glib_none().0,
648 ))
649 }
650 }
651
652 /// Get whether the given track element is a core track element. That is,
653 /// it was created by the `create_track_elements` `GESClipClass` method for
654 /// some [`Clip`][crate::Clip].
655 ///
656 /// Note that such a track element can only be added to a clip that shares
657 /// the same [`Asset`][crate::Asset] as the clip that created it. For example, you are
658 /// allowed to move core children between clips that resulted from
659 /// [`GESContainerExt::ungroup()`][crate::prelude::GESContainerExt::ungroup()], but you could not move the core child from a
660 /// [`UriClip`][crate::UriClip] to a [`TitleClip`][crate::TitleClip] or another [`UriClip`][crate::UriClip] with a different
661 /// [`uri`][struct@crate::UriClip#uri].
662 ///
663 /// Moreover, if a core track element is added to a clip, it will always be
664 /// added as a core child. Therefore, if this returns [`true`], then `element`
665 /// will be a core child of its parent clip.
666 ///
667 /// # Returns
668 ///
669 /// [`true`] if `element` is a core track element.
670 #[cfg(feature = "v1_18")]
671 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
672 #[doc(alias = "ges_track_element_is_core")]
673 fn is_core(&self) -> bool {
674 unsafe {
675 from_glib(ffi::ges_track_element_is_core(
676 self.as_ref().to_glib_none().0,
677 ))
678 }
679 }
680
681 /// Gets an array of [`glib::ParamSpec`][crate::glib::ParamSpec]* for all configurable properties of the
682 /// children of `self`.
683 ///
684 /// # Deprecated
685 ///
686 /// Use `ges_timeline_element_list_children_properties`
687 ///
688 /// # Returns
689 ///
690 /// An array of [`glib::ParamSpec`][crate::glib::ParamSpec]* which should be freed after use or
691 /// [`None`] if something went wrong.
692 #[doc(alias = "ges_track_element_list_children_properties")]
693 fn list_children_properties(&self) -> Vec<glib::ParamSpec> {
694 unsafe {
695 let mut n_properties = std::mem::MaybeUninit::uninit();
696 let ret = FromGlibContainer::from_glib_full_num(
697 ffi::ges_track_element_list_children_properties(
698 self.as_ref().to_glib_none().0,
699 n_properties.as_mut_ptr(),
700 ),
701 n_properties.assume_init() as _,
702 );
703 ret
704 }
705 }
706
707 /// Looks up which `element` and `pspec` would be effected by the given `name`. If various
708 /// contained elements have this property name you will get the first one, unless you
709 /// specify the class name in `name`.
710 ///
711 /// # Deprecated
712 ///
713 /// Use `ges_timeline_element_lookup_child`
714 /// ## `prop_name`
715 /// Name of the property to look up. You can specify the name of the
716 /// class as such: "ClassName::property-name", to guarantee that you get the
717 /// proper GParamSpec in case various GstElement-s contain the same property
718 /// name. If you don't do so, you will get the first element found, having
719 /// this property and the and the corresponding GParamSpec.
720 ///
721 /// # Returns
722 ///
723 /// TRUE if `element` and `pspec` could be found. FALSE otherwise. In that
724 /// case the values for `pspec` and `element` are not modified. Unref `element` after
725 /// usage.
726 ///
727 /// ## `element`
728 /// pointer to a [`gst::Element`][crate::gst::Element] that
729 /// takes the real object to set property on
730 ///
731 /// ## `pspec`
732 /// pointer to take the specification
733 /// describing the property
734 #[doc(alias = "ges_track_element_lookup_child")]
735 fn lookup_child(&self, prop_name: &str) -> Option<(gst::Element, glib::ParamSpec)> {
736 unsafe {
737 let mut element = std::ptr::null_mut();
738 let mut pspec = std::ptr::null_mut();
739 let ret = from_glib(ffi::ges_track_element_lookup_child(
740 self.as_ref().to_glib_none().0,
741 prop_name.to_glib_none().0,
742 &mut element,
743 &mut pspec,
744 ));
745 if ret {
746 Some((from_glib_full(element), from_glib_full(pspec)))
747 } else {
748 None
749 }
750 }
751 }
752
753 /// Removes the [`gst::ControlBinding`][crate::gst::ControlBinding] that was created for the specified child
754 /// property of the track element using
755 /// [`set_control_source()`][Self::set_control_source()]. The given `property_name` must
756 /// be the same name of the child property that was passed to
757 /// [`set_control_source()`][Self::set_control_source()].
758 /// ## `property_name`
759 /// The name of the child property to remove the control
760 /// binding from
761 ///
762 /// # Returns
763 ///
764 /// [`true`] if the control binding was removed from the specified
765 /// child property of `self`, or [`false`] if an error occurred.
766 #[doc(alias = "ges_track_element_remove_control_binding")]
767 fn remove_control_binding(&self, property_name: &str) -> Result<(), glib::error::BoolError> {
768 unsafe {
769 glib::result_from_gboolean!(
770 ffi::ges_track_element_remove_control_binding(
771 self.as_ref().to_glib_none().0,
772 property_name.to_glib_none().0
773 ),
774 "Failed to remove control binding"
775 )
776 }
777 }
778
779 /// Sets [`active`][struct@crate::TrackElement#active] for the element.
780 /// ## `active`
781 /// Whether `self` should be active in its track
782 ///
783 /// # Returns
784 ///
785 /// [`true`] if the property was *toggled*.
786 #[doc(alias = "ges_track_element_set_active")]
787 #[doc(alias = "active")]
788 fn set_active(&self, active: bool) -> bool {
789 unsafe {
790 from_glib(ffi::ges_track_element_set_active(
791 self.as_ref().to_glib_none().0,
792 active.into_glib(),
793 ))
794 }
795 }
796
797 /// Sets [`auto-clamp-control-sources`][struct@crate::TrackElement#auto-clamp-control-sources]. If set to [`true`], this
798 /// will immediately clamp all the control sources.
799 /// ## `auto_clamp`
800 /// Whether to automatically clamp the control sources for the
801 /// child properties of `self`
802 #[cfg(feature = "v1_18")]
803 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
804 #[doc(alias = "ges_track_element_set_auto_clamp_control_sources")]
805 #[doc(alias = "auto-clamp-control-sources")]
806 fn set_auto_clamp_control_sources(&self, auto_clamp: bool) {
807 unsafe {
808 ffi::ges_track_element_set_auto_clamp_control_sources(
809 self.as_ref().to_glib_none().0,
810 auto_clamp.into_glib(),
811 );
812 }
813 }
814
815 //#[doc(alias = "ges_track_element_set_child_properties")]
816 //fn set_child_properties(&self, first_property_name: &str, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) {
817 // unsafe { TODO: call ffi:ges_track_element_set_child_properties() }
818 //}
819
820 /// Sets a property of a GstElement contained in `self`.
821 ///
822 /// Note that `ges_track_element_set_child_property` is really
823 /// intended for language bindings, `ges_track_element_set_child_properties`
824 /// is much more convenient for C programming.
825 ///
826 /// # Deprecated
827 ///
828 /// use `ges_timeline_element_set_child_property` instead
829 /// ## `property_name`
830 /// The name of the property
831 /// ## `value`
832 /// The value
833 ///
834 /// # Returns
835 ///
836 /// [`true`] if the property was set, [`false`] otherwise.
837 #[doc(alias = "ges_track_element_set_child_property")]
838 fn set_child_property(
839 &self,
840 property_name: &str,
841 value: &glib::Value,
842 ) -> Result<(), glib::error::BoolError> {
843 unsafe {
844 glib::result_from_gboolean!(
845 ffi::ges_track_element_set_child_property(
846 self.as_ref().to_glib_none().0,
847 property_name.to_glib_none().0,
848 mut_override(value.to_glib_none().0)
849 ),
850 "Failed to set child property"
851 )
852 }
853 }
854
855 /// Sets a property of a child of `self`.
856 ///
857 /// # Deprecated
858 ///
859 /// Use `ges_timeline_element_set_child_property_by_spec`
860 /// ## `pspec`
861 /// The [`glib::ParamSpec`][crate::glib::ParamSpec] that specifies the property you want to set
862 /// ## `value`
863 /// The value
864 #[doc(alias = "ges_track_element_set_child_property_by_pspec")]
865 fn set_child_property_by_pspec(&self, pspec: impl AsRef<glib::ParamSpec>, value: &glib::Value) {
866 unsafe {
867 ffi::ges_track_element_set_child_property_by_pspec(
868 self.as_ref().to_glib_none().0,
869 pspec.as_ref().to_glib_none().0,
870 mut_override(value.to_glib_none().0),
871 );
872 }
873 }
874
875 //#[doc(alias = "ges_track_element_set_child_property_valist")]
876 //fn set_child_property_valist(&self, first_property_name: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported) {
877 // unsafe { TODO: call ffi:ges_track_element_set_child_property_valist() }
878 //}
879
880 /// Creates a [`gst::ControlBinding`][crate::gst::ControlBinding] for the specified child property of the
881 /// track element using the given control source. The given `property_name`
882 /// should refer to an existing child property of the track element, as
883 /// used in [`TimelineElementExt::lookup_child()`][crate::prelude::TimelineElementExt::lookup_child()].
884 ///
885 /// If `binding_type` is "direct", then the control binding is created with
886 /// `gst_direct_control_binding_new()` using the given control source. If
887 /// `binding_type` is "direct-absolute", it is created with
888 /// `gst_direct_control_binding_new_absolute()` instead.
889 /// ## `source`
890 /// The control source to bind the child property to
891 /// ## `property_name`
892 /// The name of the child property to control
893 /// ## `binding_type`
894 /// The type of binding to create ("direct" or
895 /// "direct-absolute")
896 ///
897 /// # Returns
898 ///
899 /// [`true`] if the specified child property could be bound to
900 /// `source`, or [`false`] if an error occurred.
901 #[doc(alias = "ges_track_element_set_control_source")]
902 fn set_control_source(
903 &self,
904 source: &impl IsA<gst::ControlSource>,
905 property_name: &str,
906 binding_type: &str,
907 ) -> bool {
908 unsafe {
909 from_glib(ffi::ges_track_element_set_control_source(
910 self.as_ref().to_glib_none().0,
911 source.as_ref().to_glib_none().0,
912 property_name.to_glib_none().0,
913 binding_type.to_glib_none().0,
914 ))
915 }
916 }
917
918 /// Sets [`has-internal-source`][struct@crate::TrackElement#has-internal-source] for the element. If this is
919 /// set to [`false`], this method will also set the
920 /// [`in-point`][struct@crate::TimelineElement#in-point] of the element to 0 and its
921 /// [`max-duration`][struct@crate::TimelineElement#max-duration] to `GST_CLOCK_TIME_NONE`.
922 /// ## `has_internal_source`
923 /// Whether the `self` should be allowed to have its
924 /// 'internal time' properties set.
925 ///
926 /// # Returns
927 ///
928 /// [`false`] if `has_internal_source` is forbidden for `self` and
929 /// [`true`] in any other case.
930 #[cfg(feature = "v1_18")]
931 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
932 #[doc(alias = "ges_track_element_set_has_internal_source")]
933 #[doc(alias = "has-internal-source")]
934 fn set_has_internal_source(&self, has_internal_source: bool) -> bool {
935 unsafe {
936 from_glib(ffi::ges_track_element_set_has_internal_source(
937 self.as_ref().to_glib_none().0,
938 has_internal_source.into_glib(),
939 ))
940 }
941 }
942
943 /// Sets the [`track-type`][struct@crate::TrackElement#track-type] for the element.
944 /// ## `type_`
945 /// The new track-type for `self`
946 #[doc(alias = "ges_track_element_set_track_type")]
947 #[doc(alias = "track-type")]
948 fn set_track_type(&self, type_: TrackType) {
949 unsafe {
950 ffi::ges_track_element_set_track_type(
951 self.as_ref().to_glib_none().0,
952 type_.into_glib(),
953 );
954 }
955 }
956
957 /// This is emitted when a control binding is added to a child property
958 /// of the track element.
959 /// ## `control_binding`
960 /// The control binding that has been added
961 #[doc(alias = "control-binding-added")]
962 fn connect_control_binding_added<F: Fn(&Self, &gst::ControlBinding) + 'static>(
963 &self,
964 f: F,
965 ) -> SignalHandlerId {
966 unsafe extern "C" fn control_binding_added_trampoline<
967 P: IsA<TrackElement>,
968 F: Fn(&P, &gst::ControlBinding) + 'static,
969 >(
970 this: *mut ffi::GESTrackElement,
971 control_binding: *mut gst::ffi::GstControlBinding,
972 f: glib::ffi::gpointer,
973 ) {
974 let f: &F = &*(f as *const F);
975 f(
976 TrackElement::from_glib_borrow(this).unsafe_cast_ref(),
977 &from_glib_borrow(control_binding),
978 )
979 }
980 unsafe {
981 let f: Box_<F> = Box_::new(f);
982 connect_raw(
983 self.as_ptr() as *mut _,
984 c"control-binding-added".as_ptr() as *const _,
985 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
986 control_binding_added_trampoline::<Self, F> as *const (),
987 )),
988 Box_::into_raw(f),
989 )
990 }
991 }
992
993 /// This is emitted when a control binding is removed from a child
994 /// property of the track element.
995 /// ## `control_binding`
996 /// The control binding that has been removed
997 #[doc(alias = "control-binding-removed")]
998 fn connect_control_binding_removed<F: Fn(&Self, &gst::ControlBinding) + 'static>(
999 &self,
1000 f: F,
1001 ) -> SignalHandlerId {
1002 unsafe extern "C" fn control_binding_removed_trampoline<
1003 P: IsA<TrackElement>,
1004 F: Fn(&P, &gst::ControlBinding) + 'static,
1005 >(
1006 this: *mut ffi::GESTrackElement,
1007 control_binding: *mut gst::ffi::GstControlBinding,
1008 f: glib::ffi::gpointer,
1009 ) {
1010 let f: &F = &*(f as *const F);
1011 f(
1012 TrackElement::from_glib_borrow(this).unsafe_cast_ref(),
1013 &from_glib_borrow(control_binding),
1014 )
1015 }
1016 unsafe {
1017 let f: Box_<F> = Box_::new(f);
1018 connect_raw(
1019 self.as_ptr() as *mut _,
1020 c"control-binding-removed".as_ptr() as *const _,
1021 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1022 control_binding_removed_trampoline::<Self, F> as *const (),
1023 )),
1024 Box_::into_raw(f),
1025 )
1026 }
1027 }
1028
1029 #[doc(alias = "active")]
1030 fn connect_active_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1031 unsafe extern "C" fn notify_active_trampoline<P: IsA<TrackElement>, F: Fn(&P) + 'static>(
1032 this: *mut ffi::GESTrackElement,
1033 _param_spec: glib::ffi::gpointer,
1034 f: glib::ffi::gpointer,
1035 ) {
1036 let f: &F = &*(f as *const F);
1037 f(TrackElement::from_glib_borrow(this).unsafe_cast_ref())
1038 }
1039 unsafe {
1040 let f: Box_<F> = Box_::new(f);
1041 connect_raw(
1042 self.as_ptr() as *mut _,
1043 c"notify::active".as_ptr() as *const _,
1044 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1045 notify_active_trampoline::<Self, F> as *const (),
1046 )),
1047 Box_::into_raw(f),
1048 )
1049 }
1050 }
1051
1052 #[cfg(feature = "v1_18")]
1053 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
1054 #[doc(alias = "auto-clamp-control-sources")]
1055 fn connect_auto_clamp_control_sources_notify<F: Fn(&Self) + 'static>(
1056 &self,
1057 f: F,
1058 ) -> SignalHandlerId {
1059 unsafe extern "C" fn notify_auto_clamp_control_sources_trampoline<
1060 P: IsA<TrackElement>,
1061 F: Fn(&P) + 'static,
1062 >(
1063 this: *mut ffi::GESTrackElement,
1064 _param_spec: glib::ffi::gpointer,
1065 f: glib::ffi::gpointer,
1066 ) {
1067 let f: &F = &*(f as *const F);
1068 f(TrackElement::from_glib_borrow(this).unsafe_cast_ref())
1069 }
1070 unsafe {
1071 let f: Box_<F> = Box_::new(f);
1072 connect_raw(
1073 self.as_ptr() as *mut _,
1074 c"notify::auto-clamp-control-sources".as_ptr() as *const _,
1075 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1076 notify_auto_clamp_control_sources_trampoline::<Self, F> as *const (),
1077 )),
1078 Box_::into_raw(f),
1079 )
1080 }
1081 }
1082
1083 #[cfg(feature = "v1_18")]
1084 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
1085 #[doc(alias = "has-internal-source")]
1086 fn connect_has_internal_source_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1087 unsafe extern "C" fn notify_has_internal_source_trampoline<
1088 P: IsA<TrackElement>,
1089 F: Fn(&P) + 'static,
1090 >(
1091 this: *mut ffi::GESTrackElement,
1092 _param_spec: glib::ffi::gpointer,
1093 f: glib::ffi::gpointer,
1094 ) {
1095 let f: &F = &*(f as *const F);
1096 f(TrackElement::from_glib_borrow(this).unsafe_cast_ref())
1097 }
1098 unsafe {
1099 let f: Box_<F> = Box_::new(f);
1100 connect_raw(
1101 self.as_ptr() as *mut _,
1102 c"notify::has-internal-source".as_ptr() as *const _,
1103 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1104 notify_has_internal_source_trampoline::<Self, F> as *const (),
1105 )),
1106 Box_::into_raw(f),
1107 )
1108 }
1109 }
1110
1111 #[doc(alias = "track")]
1112 fn connect_track_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1113 unsafe extern "C" fn notify_track_trampoline<P: IsA<TrackElement>, F: Fn(&P) + 'static>(
1114 this: *mut ffi::GESTrackElement,
1115 _param_spec: glib::ffi::gpointer,
1116 f: glib::ffi::gpointer,
1117 ) {
1118 let f: &F = &*(f as *const F);
1119 f(TrackElement::from_glib_borrow(this).unsafe_cast_ref())
1120 }
1121 unsafe {
1122 let f: Box_<F> = Box_::new(f);
1123 connect_raw(
1124 self.as_ptr() as *mut _,
1125 c"notify::track".as_ptr() as *const _,
1126 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1127 notify_track_trampoline::<Self, F> as *const (),
1128 )),
1129 Box_::into_raw(f),
1130 )
1131 }
1132 }
1133
1134 #[doc(alias = "track-type")]
1135 fn connect_track_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1136 unsafe extern "C" fn notify_track_type_trampoline<
1137 P: IsA<TrackElement>,
1138 F: Fn(&P) + 'static,
1139 >(
1140 this: *mut ffi::GESTrackElement,
1141 _param_spec: glib::ffi::gpointer,
1142 f: glib::ffi::gpointer,
1143 ) {
1144 let f: &F = &*(f as *const F);
1145 f(TrackElement::from_glib_borrow(this).unsafe_cast_ref())
1146 }
1147 unsafe {
1148 let f: Box_<F> = Box_::new(f);
1149 connect_raw(
1150 self.as_ptr() as *mut _,
1151 c"notify::track-type".as_ptr() as *const _,
1152 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1153 notify_track_type_trampoline::<Self, F> as *const (),
1154 )),
1155 Box_::into_raw(f),
1156 )
1157 }
1158 }
1159}
1160
1161impl<O: IsA<TrackElement>> TrackElementExt for O {}