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 Edge, EditMode, Extractable, Layer, MetaContainer, TimelineElement, Track, TrackType, ffi,
9};
10use glib::{
11 object::ObjectType as _,
12 prelude::*,
13 signal::{SignalHandlerId, connect_raw},
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: 92 } {
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 { Some(value) } else { None }
473 }
474 }
475
476 /// Gets a property of a child of `self`.
477 ///
478 /// # Deprecated
479 ///
480 /// Use `ges_timeline_element_get_child_property_by_pspec`
481 /// ## `pspec`
482 /// The [`glib::ParamSpec`][crate::glib::ParamSpec] that specifies the property you want to get
483 ///
484 /// # Returns
485 ///
486 ///
487 /// ## `value`
488 /// return location for the value
489 #[doc(alias = "ges_track_element_get_child_property_by_pspec")]
490 #[doc(alias = "get_child_property_by_pspec")]
491 fn child_property_by_pspec(&self, pspec: impl AsRef<glib::ParamSpec>) -> glib::Value {
492 unsafe {
493 let mut value = glib::Value::uninitialized();
494 ffi::ges_track_element_get_child_property_by_pspec(
495 self.as_ref().to_glib_none().0,
496 pspec.as_ref().to_glib_none().0,
497 value.to_glib_none_mut().0,
498 );
499 value
500 }
501 }
502
503 //#[doc(alias = "ges_track_element_get_child_property_valist")]
504 //#[doc(alias = "get_child_property_valist")]
505 //fn child_property_valist(&self, first_property_name: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported) {
506 // unsafe { TODO: call ffi:ges_track_element_get_child_property_valist() }
507 //}
508
509 /// Gets the control binding that was created for the specified child
510 /// property of the track element using
511 /// [`set_control_source()`][Self::set_control_source()]. The given `property_name` must
512 /// be the same name of the child property that was passed to
513 /// [`set_control_source()`][Self::set_control_source()].
514 /// ## `property_name`
515 /// The name of the child property to return the control
516 /// binding of
517 ///
518 /// # Returns
519 ///
520 /// The control binding that was
521 /// created for the specified child property of `self`, or [`None`] if
522 /// `property_name` does not correspond to any control binding.
523 #[doc(alias = "ges_track_element_get_control_binding")]
524 #[doc(alias = "get_control_binding")]
525 fn control_binding(&self, property_name: &str) -> Option<gst::ControlBinding> {
526 unsafe {
527 from_glib_none(ffi::ges_track_element_get_control_binding(
528 self.as_ref().to_glib_none().0,
529 property_name.to_glib_none().0,
530 ))
531 }
532 }
533
534 /// Get the [`gst::Element`][crate::gst::Element] that the track element's underlying nleobject
535 /// controls.
536 ///
537 /// # Returns
538 ///
539 /// The [`gst::Element`][crate::gst::Element] being controlled by the
540 /// nleobject that `self` wraps.
541 #[doc(alias = "ges_track_element_get_element")]
542 #[doc(alias = "get_element")]
543 fn element(&self) -> Option<gst::Element> {
544 unsafe {
545 from_glib_none(ffi::ges_track_element_get_element(
546 self.as_ref().to_glib_none().0,
547 ))
548 }
549 }
550
551 /// Get the GNonLin object this object is controlling.
552 ///
553 /// # Deprecated
554 ///
555 /// use `ges_track_element_get_nleobject` instead.
556 ///
557 /// # Returns
558 ///
559 /// The GNonLin object this object is controlling.
560 #[doc(alias = "ges_track_element_get_gnlobject")]
561 #[doc(alias = "get_gnlobject")]
562 fn gnlobject(&self) -> gst::Element {
563 unsafe {
564 from_glib_none(ffi::ges_track_element_get_gnlobject(
565 self.as_ref().to_glib_none().0,
566 ))
567 }
568 }
569
570 /// Get the nleobject that this element wraps.
571 ///
572 /// # Returns
573 ///
574 /// The nleobject that `self` wraps.
575 #[doc(alias = "ges_track_element_get_nleobject")]
576 #[doc(alias = "get_nleobject")]
577 fn nleobject(&self) -> gst::Element {
578 unsafe {
579 from_glib_none(ffi::ges_track_element_get_nleobject(
580 self.as_ref().to_glib_none().0,
581 ))
582 }
583 }
584
585 /// Get the [`track`][struct@crate::TrackElement#track] for the element.
586 ///
587 /// # Returns
588 ///
589 /// The track that `self` belongs to,
590 /// or [`None`] if it does not belong to a track.
591 #[doc(alias = "ges_track_element_get_track")]
592 #[doc(alias = "get_track")]
593 fn track(&self) -> Option<Track> {
594 unsafe {
595 from_glib_none(ffi::ges_track_element_get_track(
596 self.as_ref().to_glib_none().0,
597 ))
598 }
599 }
600
601 /// Gets the [`track-type`][struct@crate::TrackElement#track-type] for the element.
602 ///
603 /// # Returns
604 ///
605 /// The track-type of `self`.
606 #[doc(alias = "ges_track_element_get_track_type")]
607 #[doc(alias = "get_track_type")]
608 #[doc(alias = "track-type")]
609 fn track_type(&self) -> TrackType {
610 unsafe {
611 from_glib(ffi::ges_track_element_get_track_type(
612 self.as_ref().to_glib_none().0,
613 ))
614 }
615 }
616
617 /// Gets [`has-internal-source`][struct@crate::TrackElement#has-internal-source] for the element.
618 ///
619 /// # Returns
620 ///
621 /// [`true`] if `self` can have its 'internal time' properties set.
622 #[cfg(feature = "v1_18")]
623 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
624 #[doc(alias = "ges_track_element_has_internal_source")]
625 fn has_internal_source(&self) -> bool {
626 unsafe {
627 from_glib(ffi::ges_track_element_has_internal_source(
628 self.as_ref().to_glib_none().0,
629 ))
630 }
631 }
632
633 /// Gets [`active`][struct@crate::TrackElement#active] for the element.
634 ///
635 /// # Returns
636 ///
637 /// [`true`] if `self` is active in its track.
638 #[doc(alias = "ges_track_element_is_active")]
639 #[doc(alias = "active")]
640 fn is_active(&self) -> bool {
641 unsafe {
642 from_glib(ffi::ges_track_element_is_active(
643 self.as_ref().to_glib_none().0,
644 ))
645 }
646 }
647
648 /// Get whether the given track element is a core track element. That is,
649 /// it was created by the `create_track_elements` `GESClipClass` method for
650 /// some [`Clip`][crate::Clip].
651 ///
652 /// Note that such a track element can only be added to a clip that shares
653 /// the same [`Asset`][crate::Asset] as the clip that created it. For example, you are
654 /// allowed to move core children between clips that resulted from
655 /// [`GESContainerExt::ungroup()`][crate::prelude::GESContainerExt::ungroup()], but you could not move the core child from a
656 /// [`UriClip`][crate::UriClip] to a [`TitleClip`][crate::TitleClip] or another [`UriClip`][crate::UriClip] with a different
657 /// [`uri`][struct@crate::UriClip#uri].
658 ///
659 /// Moreover, if a core track element is added to a clip, it will always be
660 /// added as a core child. Therefore, if this returns [`true`], then `element`
661 /// will be a core child of its parent clip.
662 ///
663 /// # Returns
664 ///
665 /// [`true`] if `element` is a core track element.
666 #[cfg(feature = "v1_18")]
667 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
668 #[doc(alias = "ges_track_element_is_core")]
669 fn is_core(&self) -> bool {
670 unsafe {
671 from_glib(ffi::ges_track_element_is_core(
672 self.as_ref().to_glib_none().0,
673 ))
674 }
675 }
676
677 /// Gets an array of [`glib::ParamSpec`][crate::glib::ParamSpec]* for all configurable properties of the
678 /// children of `self`.
679 ///
680 /// # Deprecated
681 ///
682 /// Use `ges_timeline_element_list_children_properties`
683 ///
684 /// # Returns
685 ///
686 /// An array of [`glib::ParamSpec`][crate::glib::ParamSpec]* which should be freed after use or
687 /// [`None`] if something went wrong.
688 #[doc(alias = "ges_track_element_list_children_properties")]
689 fn list_children_properties(&self) -> Vec<glib::ParamSpec> {
690 unsafe {
691 let mut n_properties = std::mem::MaybeUninit::uninit();
692 let ret = FromGlibContainer::from_glib_full_num(
693 ffi::ges_track_element_list_children_properties(
694 self.as_ref().to_glib_none().0,
695 n_properties.as_mut_ptr(),
696 ),
697 n_properties.assume_init() as _,
698 );
699 ret
700 }
701 }
702
703 /// Looks up which `element` and `pspec` would be effected by the given `name`. If various
704 /// contained elements have this property name you will get the first one, unless you
705 /// specify the class name in `name`.
706 ///
707 /// # Deprecated
708 ///
709 /// Use `ges_timeline_element_lookup_child`
710 /// ## `prop_name`
711 /// Name of the property to look up. You can specify the name of the
712 /// class as such: "ClassName::property-name", to guarantee that you get the
713 /// proper GParamSpec in case various GstElement-s contain the same property
714 /// name. If you don't do so, you will get the first element found, having
715 /// this property and the and the corresponding GParamSpec.
716 ///
717 /// # Returns
718 ///
719 /// TRUE if `element` and `pspec` could be found. FALSE otherwise. In that
720 /// case the values for `pspec` and `element` are not modified. Unref `element` after
721 /// usage.
722 ///
723 /// ## `element`
724 /// pointer to a [`gst::Element`][crate::gst::Element] that
725 /// takes the real object to set property on
726 ///
727 /// ## `pspec`
728 /// pointer to take the specification
729 /// describing the property
730 #[doc(alias = "ges_track_element_lookup_child")]
731 fn lookup_child(&self, prop_name: &str) -> Option<(gst::Element, glib::ParamSpec)> {
732 unsafe {
733 let mut element = std::ptr::null_mut();
734 let mut pspec = std::ptr::null_mut();
735 let ret = from_glib(ffi::ges_track_element_lookup_child(
736 self.as_ref().to_glib_none().0,
737 prop_name.to_glib_none().0,
738 &mut element,
739 &mut pspec,
740 ));
741 if ret {
742 Some((from_glib_full(element), from_glib_full(pspec)))
743 } else {
744 None
745 }
746 }
747 }
748
749 /// Removes the [`gst::ControlBinding`][crate::gst::ControlBinding] that was created for the specified child
750 /// property of the track element using
751 /// [`set_control_source()`][Self::set_control_source()]. The given `property_name` must
752 /// be the same name of the child property that was passed to
753 /// [`set_control_source()`][Self::set_control_source()].
754 /// ## `property_name`
755 /// The name of the child property to remove the control
756 /// binding from
757 ///
758 /// # Returns
759 ///
760 /// [`true`] if the control binding was removed from the specified
761 /// child property of `self`, or [`false`] if an error occurred.
762 #[doc(alias = "ges_track_element_remove_control_binding")]
763 fn remove_control_binding(&self, property_name: &str) -> Result<(), glib::error::BoolError> {
764 unsafe {
765 glib::result_from_gboolean!(
766 ffi::ges_track_element_remove_control_binding(
767 self.as_ref().to_glib_none().0,
768 property_name.to_glib_none().0
769 ),
770 "Failed to remove control binding"
771 )
772 }
773 }
774
775 /// Sets [`active`][struct@crate::TrackElement#active] for the element.
776 /// ## `active`
777 /// Whether `self` should be active in its track
778 ///
779 /// # Returns
780 ///
781 /// [`true`] if the property was *toggled*.
782 #[doc(alias = "ges_track_element_set_active")]
783 #[doc(alias = "active")]
784 fn set_active(&self, active: bool) -> bool {
785 unsafe {
786 from_glib(ffi::ges_track_element_set_active(
787 self.as_ref().to_glib_none().0,
788 active.into_glib(),
789 ))
790 }
791 }
792
793 /// Sets [`auto-clamp-control-sources`][struct@crate::TrackElement#auto-clamp-control-sources]. If set to [`true`], this
794 /// will immediately clamp all the control sources.
795 /// ## `auto_clamp`
796 /// Whether to automatically clamp the control sources for the
797 /// child properties of `self`
798 #[cfg(feature = "v1_18")]
799 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
800 #[doc(alias = "ges_track_element_set_auto_clamp_control_sources")]
801 #[doc(alias = "auto-clamp-control-sources")]
802 fn set_auto_clamp_control_sources(&self, auto_clamp: bool) {
803 unsafe {
804 ffi::ges_track_element_set_auto_clamp_control_sources(
805 self.as_ref().to_glib_none().0,
806 auto_clamp.into_glib(),
807 );
808 }
809 }
810
811 //#[doc(alias = "ges_track_element_set_child_properties")]
812 //fn set_child_properties(&self, first_property_name: &str, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) {
813 // unsafe { TODO: call ffi:ges_track_element_set_child_properties() }
814 //}
815
816 /// Sets a property of a GstElement contained in `self`.
817 ///
818 /// Note that `ges_track_element_set_child_property` is really
819 /// intended for language bindings, `ges_track_element_set_child_properties`
820 /// is much more convenient for C programming.
821 ///
822 /// # Deprecated
823 ///
824 /// use `ges_timeline_element_set_child_property` instead
825 /// ## `property_name`
826 /// The name of the property
827 /// ## `value`
828 /// The value
829 ///
830 /// # Returns
831 ///
832 /// [`true`] if the property was set, [`false`] otherwise.
833 #[doc(alias = "ges_track_element_set_child_property")]
834 fn set_child_property(
835 &self,
836 property_name: &str,
837 value: &glib::Value,
838 ) -> Result<(), glib::error::BoolError> {
839 unsafe {
840 glib::result_from_gboolean!(
841 ffi::ges_track_element_set_child_property(
842 self.as_ref().to_glib_none().0,
843 property_name.to_glib_none().0,
844 mut_override(value.to_glib_none().0)
845 ),
846 "Failed to set child property"
847 )
848 }
849 }
850
851 /// Sets a property of a child of `self`.
852 ///
853 /// # Deprecated
854 ///
855 /// Use `ges_timeline_element_set_child_property_by_spec`
856 /// ## `pspec`
857 /// The [`glib::ParamSpec`][crate::glib::ParamSpec] that specifies the property you want to set
858 /// ## `value`
859 /// The value
860 #[doc(alias = "ges_track_element_set_child_property_by_pspec")]
861 fn set_child_property_by_pspec(&self, pspec: impl AsRef<glib::ParamSpec>, value: &glib::Value) {
862 unsafe {
863 ffi::ges_track_element_set_child_property_by_pspec(
864 self.as_ref().to_glib_none().0,
865 pspec.as_ref().to_glib_none().0,
866 mut_override(value.to_glib_none().0),
867 );
868 }
869 }
870
871 //#[doc(alias = "ges_track_element_set_child_property_valist")]
872 //fn set_child_property_valist(&self, first_property_name: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported) {
873 // unsafe { TODO: call ffi:ges_track_element_set_child_property_valist() }
874 //}
875
876 /// Creates a [`gst::ControlBinding`][crate::gst::ControlBinding] for the specified child property of the
877 /// track element using the given control source. The given `property_name`
878 /// should refer to an existing child property of the track element, as
879 /// used in [`TimelineElementExt::lookup_child()`][crate::prelude::TimelineElementExt::lookup_child()].
880 ///
881 /// If `binding_type` is "direct", then the control binding is created with
882 /// `gst_direct_control_binding_new()` using the given control source. If
883 /// `binding_type` is "direct-absolute", it is created with
884 /// `gst_direct_control_binding_new_absolute()` instead.
885 /// ## `source`
886 /// The control source to bind the child property to
887 /// ## `property_name`
888 /// The name of the child property to control
889 /// ## `binding_type`
890 /// The type of binding to create ("direct" or
891 /// "direct-absolute")
892 ///
893 /// # Returns
894 ///
895 /// [`true`] if the specified child property could be bound to
896 /// `source`, or [`false`] if an error occurred.
897 #[doc(alias = "ges_track_element_set_control_source")]
898 fn set_control_source(
899 &self,
900 source: &impl IsA<gst::ControlSource>,
901 property_name: &str,
902 binding_type: &str,
903 ) -> bool {
904 unsafe {
905 from_glib(ffi::ges_track_element_set_control_source(
906 self.as_ref().to_glib_none().0,
907 source.as_ref().to_glib_none().0,
908 property_name.to_glib_none().0,
909 binding_type.to_glib_none().0,
910 ))
911 }
912 }
913
914 /// Sets [`has-internal-source`][struct@crate::TrackElement#has-internal-source] for the element. If this is
915 /// set to [`false`], this method will also set the
916 /// [`in-point`][struct@crate::TimelineElement#in-point] of the element to 0 and its
917 /// [`max-duration`][struct@crate::TimelineElement#max-duration] to `GST_CLOCK_TIME_NONE`.
918 /// ## `has_internal_source`
919 /// Whether the `self` should be allowed to have its
920 /// 'internal time' properties set.
921 ///
922 /// # Returns
923 ///
924 /// [`false`] if `has_internal_source` is forbidden for `self` and
925 /// [`true`] in any other case.
926 #[cfg(feature = "v1_18")]
927 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
928 #[doc(alias = "ges_track_element_set_has_internal_source")]
929 #[doc(alias = "has-internal-source")]
930 fn set_has_internal_source(&self, has_internal_source: bool) -> bool {
931 unsafe {
932 from_glib(ffi::ges_track_element_set_has_internal_source(
933 self.as_ref().to_glib_none().0,
934 has_internal_source.into_glib(),
935 ))
936 }
937 }
938
939 /// Sets the [`track-type`][struct@crate::TrackElement#track-type] for the element.
940 /// ## `type_`
941 /// The new track-type for `self`
942 #[doc(alias = "ges_track_element_set_track_type")]
943 #[doc(alias = "track-type")]
944 fn set_track_type(&self, type_: TrackType) {
945 unsafe {
946 ffi::ges_track_element_set_track_type(
947 self.as_ref().to_glib_none().0,
948 type_.into_glib(),
949 );
950 }
951 }
952
953 /// This is emitted when a control binding is added to a child property
954 /// of the track element.
955 /// ## `control_binding`
956 /// The control binding that has been added
957 #[doc(alias = "control-binding-added")]
958 fn connect_control_binding_added<F: Fn(&Self, &gst::ControlBinding) + 'static>(
959 &self,
960 f: F,
961 ) -> SignalHandlerId {
962 unsafe extern "C" fn control_binding_added_trampoline<
963 P: IsA<TrackElement>,
964 F: Fn(&P, &gst::ControlBinding) + 'static,
965 >(
966 this: *mut ffi::GESTrackElement,
967 control_binding: *mut gst::ffi::GstControlBinding,
968 f: glib::ffi::gpointer,
969 ) {
970 unsafe {
971 let f: &F = &*(f as *const F);
972 f(
973 TrackElement::from_glib_borrow(this).unsafe_cast_ref(),
974 &from_glib_borrow(control_binding),
975 )
976 }
977 }
978 unsafe {
979 let f: Box_<F> = Box_::new(f);
980 connect_raw(
981 self.as_ptr() as *mut _,
982 c"control-binding-added".as_ptr(),
983 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
984 control_binding_added_trampoline::<Self, F> as *const (),
985 )),
986 Box_::into_raw(f),
987 )
988 }
989 }
990
991 /// This is emitted when a control binding is removed from a child
992 /// property of the track element.
993 /// ## `control_binding`
994 /// The control binding that has been removed
995 #[doc(alias = "control-binding-removed")]
996 fn connect_control_binding_removed<F: Fn(&Self, &gst::ControlBinding) + 'static>(
997 &self,
998 f: F,
999 ) -> SignalHandlerId {
1000 unsafe extern "C" fn control_binding_removed_trampoline<
1001 P: IsA<TrackElement>,
1002 F: Fn(&P, &gst::ControlBinding) + 'static,
1003 >(
1004 this: *mut ffi::GESTrackElement,
1005 control_binding: *mut gst::ffi::GstControlBinding,
1006 f: glib::ffi::gpointer,
1007 ) {
1008 unsafe {
1009 let f: &F = &*(f as *const F);
1010 f(
1011 TrackElement::from_glib_borrow(this).unsafe_cast_ref(),
1012 &from_glib_borrow(control_binding),
1013 )
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(),
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 unsafe {
1037 let f: &F = &*(f as *const F);
1038 f(TrackElement::from_glib_borrow(this).unsafe_cast_ref())
1039 }
1040 }
1041 unsafe {
1042 let f: Box_<F> = Box_::new(f);
1043 connect_raw(
1044 self.as_ptr() as *mut _,
1045 c"notify::active".as_ptr(),
1046 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1047 notify_active_trampoline::<Self, F> as *const (),
1048 )),
1049 Box_::into_raw(f),
1050 )
1051 }
1052 }
1053
1054 #[cfg(feature = "v1_18")]
1055 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
1056 #[doc(alias = "auto-clamp-control-sources")]
1057 fn connect_auto_clamp_control_sources_notify<F: Fn(&Self) + 'static>(
1058 &self,
1059 f: F,
1060 ) -> SignalHandlerId {
1061 unsafe extern "C" fn notify_auto_clamp_control_sources_trampoline<
1062 P: IsA<TrackElement>,
1063 F: Fn(&P) + 'static,
1064 >(
1065 this: *mut ffi::GESTrackElement,
1066 _param_spec: glib::ffi::gpointer,
1067 f: glib::ffi::gpointer,
1068 ) {
1069 unsafe {
1070 let f: &F = &*(f as *const F);
1071 f(TrackElement::from_glib_borrow(this).unsafe_cast_ref())
1072 }
1073 }
1074 unsafe {
1075 let f: Box_<F> = Box_::new(f);
1076 connect_raw(
1077 self.as_ptr() as *mut _,
1078 c"notify::auto-clamp-control-sources".as_ptr(),
1079 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1080 notify_auto_clamp_control_sources_trampoline::<Self, F> as *const (),
1081 )),
1082 Box_::into_raw(f),
1083 )
1084 }
1085 }
1086
1087 #[cfg(feature = "v1_18")]
1088 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
1089 #[doc(alias = "has-internal-source")]
1090 fn connect_has_internal_source_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1091 unsafe extern "C" fn notify_has_internal_source_trampoline<
1092 P: IsA<TrackElement>,
1093 F: Fn(&P) + 'static,
1094 >(
1095 this: *mut ffi::GESTrackElement,
1096 _param_spec: glib::ffi::gpointer,
1097 f: glib::ffi::gpointer,
1098 ) {
1099 unsafe {
1100 let f: &F = &*(f as *const F);
1101 f(TrackElement::from_glib_borrow(this).unsafe_cast_ref())
1102 }
1103 }
1104 unsafe {
1105 let f: Box_<F> = Box_::new(f);
1106 connect_raw(
1107 self.as_ptr() as *mut _,
1108 c"notify::has-internal-source".as_ptr(),
1109 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1110 notify_has_internal_source_trampoline::<Self, F> as *const (),
1111 )),
1112 Box_::into_raw(f),
1113 )
1114 }
1115 }
1116
1117 #[doc(alias = "track")]
1118 fn connect_track_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1119 unsafe extern "C" fn notify_track_trampoline<P: IsA<TrackElement>, F: Fn(&P) + 'static>(
1120 this: *mut ffi::GESTrackElement,
1121 _param_spec: glib::ffi::gpointer,
1122 f: glib::ffi::gpointer,
1123 ) {
1124 unsafe {
1125 let f: &F = &*(f as *const F);
1126 f(TrackElement::from_glib_borrow(this).unsafe_cast_ref())
1127 }
1128 }
1129 unsafe {
1130 let f: Box_<F> = Box_::new(f);
1131 connect_raw(
1132 self.as_ptr() as *mut _,
1133 c"notify::track".as_ptr(),
1134 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1135 notify_track_trampoline::<Self, F> as *const (),
1136 )),
1137 Box_::into_raw(f),
1138 )
1139 }
1140 }
1141
1142 #[doc(alias = "track-type")]
1143 fn connect_track_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1144 unsafe extern "C" fn notify_track_type_trampoline<
1145 P: IsA<TrackElement>,
1146 F: Fn(&P) + 'static,
1147 >(
1148 this: *mut ffi::GESTrackElement,
1149 _param_spec: glib::ffi::gpointer,
1150 f: glib::ffi::gpointer,
1151 ) {
1152 unsafe {
1153 let f: &F = &*(f as *const F);
1154 f(TrackElement::from_glib_borrow(this).unsafe_cast_ref())
1155 }
1156 }
1157 unsafe {
1158 let f: Box_<F> = Box_::new(f);
1159 connect_raw(
1160 self.as_ptr() as *mut _,
1161 c"notify::track-type".as_ptr(),
1162 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1163 notify_track_type_trampoline::<Self, F> as *const (),
1164 )),
1165 Box_::into_raw(f),
1166 )
1167 }
1168 }
1169}
1170
1171impl<O: IsA<TrackElement>> TrackElementExt for O {}