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    #[doc(alias = "GESTrackElement")]
20    pub struct TrackElement(Object<ffi::GESTrackElement, ffi::GESTrackElementClass>) @extends TimelineElement, @implements Extractable, MetaContainer;
21
22    match fn {
23        type_ => || ffi::ges_track_element_get_type(),
24    }
25}
26
27impl TrackElement {
28    pub const NONE: Option<&'static TrackElement> = None;
29}
30
31mod sealed {
32    pub trait Sealed {}
33    impl<T: super::IsA<super::TrackElement>> Sealed for T {}
34}
35
36pub trait TrackElementExt: IsA<TrackElement> + sealed::Sealed + 'static {
37    #[doc(alias = "ges_track_element_add_children_props")]
38    fn add_children_props(
39        &self,
40        element: &impl IsA<gst::Element>,
41        wanted_categories: &[&str],
42        blacklist: &[&str],
43        whitelist: &[&str],
44    ) {
45        unsafe {
46            ffi::ges_track_element_add_children_props(
47                self.as_ref().to_glib_none().0,
48                element.as_ref().to_glib_none().0,
49                wanted_categories.to_glib_none().0,
50                blacklist.to_glib_none().0,
51                whitelist.to_glib_none().0,
52            );
53        }
54    }
55
56    #[cfg(feature = "v1_18")]
57    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
58    #[doc(alias = "ges_track_element_clamp_control_source")]
59    fn clamp_control_source(&self, property_name: &str) {
60        unsafe {
61            ffi::ges_track_element_clamp_control_source(
62                self.as_ref().to_glib_none().0,
63                property_name.to_glib_none().0,
64            );
65        }
66    }
67
68    #[cfg_attr(feature = "v1_18", deprecated = "Since 1.18")]
69    #[allow(deprecated)]
70    #[doc(alias = "ges_track_element_edit")]
71    fn edit(
72        &self,
73        layers: &[Layer],
74        mode: EditMode,
75        edge: Edge,
76        position: u64,
77    ) -> Result<(), glib::error::BoolError> {
78        unsafe {
79            glib::result_from_gboolean!(
80                ffi::ges_track_element_edit(
81                    self.as_ref().to_glib_none().0,
82                    layers.to_glib_none().0,
83                    mode.into_glib(),
84                    edge.into_glib(),
85                    position
86                ),
87                "Failed to edit"
88            )
89        }
90    }
91
92    //#[doc(alias = "ges_track_element_get_all_control_bindings")]
93    //#[doc(alias = "get_all_control_bindings")]
94    //fn all_control_bindings(&self) -> /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 6, id: 90 } {
95    //    unsafe { TODO: call ffi:ges_track_element_get_all_control_bindings() }
96    //}
97
98    #[cfg(feature = "v1_18")]
99    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
100    #[doc(alias = "ges_track_element_get_auto_clamp_control_sources")]
101    #[doc(alias = "get_auto_clamp_control_sources")]
102    #[doc(alias = "auto-clamp-control-sources")]
103    fn is_auto_clamp_control_sources(&self) -> bool {
104        unsafe {
105            from_glib(ffi::ges_track_element_get_auto_clamp_control_sources(
106                self.as_ref().to_glib_none().0,
107            ))
108        }
109    }
110
111    //#[doc(alias = "ges_track_element_get_child_properties")]
112    //#[doc(alias = "get_child_properties")]
113    //fn child_properties(&self, first_property_name: &str, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) {
114    //    unsafe { TODO: call ffi:ges_track_element_get_child_properties() }
115    //}
116
117    #[doc(alias = "ges_track_element_get_child_property")]
118    #[doc(alias = "get_child_property")]
119    fn child_property(&self, property_name: &str) -> Option<glib::Value> {
120        unsafe {
121            let mut value = glib::Value::uninitialized();
122            let ret = from_glib(ffi::ges_track_element_get_child_property(
123                self.as_ref().to_glib_none().0,
124                property_name.to_glib_none().0,
125                value.to_glib_none_mut().0,
126            ));
127            if ret {
128                Some(value)
129            } else {
130                None
131            }
132        }
133    }
134
135    #[doc(alias = "ges_track_element_get_child_property_by_pspec")]
136    #[doc(alias = "get_child_property_by_pspec")]
137    fn child_property_by_pspec(&self, pspec: impl AsRef<glib::ParamSpec>) -> glib::Value {
138        unsafe {
139            let mut value = glib::Value::uninitialized();
140            ffi::ges_track_element_get_child_property_by_pspec(
141                self.as_ref().to_glib_none().0,
142                pspec.as_ref().to_glib_none().0,
143                value.to_glib_none_mut().0,
144            );
145            value
146        }
147    }
148
149    //#[doc(alias = "ges_track_element_get_child_property_valist")]
150    //#[doc(alias = "get_child_property_valist")]
151    //fn child_property_valist(&self, first_property_name: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported) {
152    //    unsafe { TODO: call ffi:ges_track_element_get_child_property_valist() }
153    //}
154
155    #[doc(alias = "ges_track_element_get_control_binding")]
156    #[doc(alias = "get_control_binding")]
157    fn control_binding(&self, property_name: &str) -> Option<gst::ControlBinding> {
158        unsafe {
159            from_glib_none(ffi::ges_track_element_get_control_binding(
160                self.as_ref().to_glib_none().0,
161                property_name.to_glib_none().0,
162            ))
163        }
164    }
165
166    #[doc(alias = "ges_track_element_get_element")]
167    #[doc(alias = "get_element")]
168    fn element(&self) -> Option<gst::Element> {
169        unsafe {
170            from_glib_none(ffi::ges_track_element_get_element(
171                self.as_ref().to_glib_none().0,
172            ))
173        }
174    }
175
176    #[doc(alias = "ges_track_element_get_gnlobject")]
177    #[doc(alias = "get_gnlobject")]
178    fn gnlobject(&self) -> gst::Element {
179        unsafe {
180            from_glib_none(ffi::ges_track_element_get_gnlobject(
181                self.as_ref().to_glib_none().0,
182            ))
183        }
184    }
185
186    #[doc(alias = "ges_track_element_get_nleobject")]
187    #[doc(alias = "get_nleobject")]
188    fn nleobject(&self) -> gst::Element {
189        unsafe {
190            from_glib_none(ffi::ges_track_element_get_nleobject(
191                self.as_ref().to_glib_none().0,
192            ))
193        }
194    }
195
196    #[doc(alias = "ges_track_element_get_track")]
197    #[doc(alias = "get_track")]
198    fn track(&self) -> Option<Track> {
199        unsafe {
200            from_glib_none(ffi::ges_track_element_get_track(
201                self.as_ref().to_glib_none().0,
202            ))
203        }
204    }
205
206    #[doc(alias = "ges_track_element_get_track_type")]
207    #[doc(alias = "get_track_type")]
208    #[doc(alias = "track-type")]
209    fn track_type(&self) -> TrackType {
210        unsafe {
211            from_glib(ffi::ges_track_element_get_track_type(
212                self.as_ref().to_glib_none().0,
213            ))
214        }
215    }
216
217    #[cfg(feature = "v1_18")]
218    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
219    #[doc(alias = "ges_track_element_has_internal_source")]
220    fn has_internal_source(&self) -> bool {
221        unsafe {
222            from_glib(ffi::ges_track_element_has_internal_source(
223                self.as_ref().to_glib_none().0,
224            ))
225        }
226    }
227
228    #[doc(alias = "ges_track_element_is_active")]
229    #[doc(alias = "active")]
230    fn is_active(&self) -> bool {
231        unsafe {
232            from_glib(ffi::ges_track_element_is_active(
233                self.as_ref().to_glib_none().0,
234            ))
235        }
236    }
237
238    #[cfg(feature = "v1_18")]
239    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
240    #[doc(alias = "ges_track_element_is_core")]
241    fn is_core(&self) -> bool {
242        unsafe {
243            from_glib(ffi::ges_track_element_is_core(
244                self.as_ref().to_glib_none().0,
245            ))
246        }
247    }
248
249    #[doc(alias = "ges_track_element_list_children_properties")]
250    fn list_children_properties(&self) -> Vec<glib::ParamSpec> {
251        unsafe {
252            let mut n_properties = std::mem::MaybeUninit::uninit();
253            let ret = FromGlibContainer::from_glib_full_num(
254                ffi::ges_track_element_list_children_properties(
255                    self.as_ref().to_glib_none().0,
256                    n_properties.as_mut_ptr(),
257                ),
258                n_properties.assume_init() as _,
259            );
260            ret
261        }
262    }
263
264    #[doc(alias = "ges_track_element_lookup_child")]
265    fn lookup_child(&self, prop_name: &str) -> Option<(gst::Element, glib::ParamSpec)> {
266        unsafe {
267            let mut element = std::ptr::null_mut();
268            let mut pspec = std::ptr::null_mut();
269            let ret = from_glib(ffi::ges_track_element_lookup_child(
270                self.as_ref().to_glib_none().0,
271                prop_name.to_glib_none().0,
272                &mut element,
273                &mut pspec,
274            ));
275            if ret {
276                Some((from_glib_full(element), from_glib_full(pspec)))
277            } else {
278                None
279            }
280        }
281    }
282
283    #[doc(alias = "ges_track_element_remove_control_binding")]
284    fn remove_control_binding(&self, property_name: &str) -> Result<(), glib::error::BoolError> {
285        unsafe {
286            glib::result_from_gboolean!(
287                ffi::ges_track_element_remove_control_binding(
288                    self.as_ref().to_glib_none().0,
289                    property_name.to_glib_none().0
290                ),
291                "Failed to remove control binding"
292            )
293        }
294    }
295
296    #[doc(alias = "ges_track_element_set_active")]
297    #[doc(alias = "active")]
298    fn set_active(&self, active: bool) -> bool {
299        unsafe {
300            from_glib(ffi::ges_track_element_set_active(
301                self.as_ref().to_glib_none().0,
302                active.into_glib(),
303            ))
304        }
305    }
306
307    #[cfg(feature = "v1_18")]
308    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
309    #[doc(alias = "ges_track_element_set_auto_clamp_control_sources")]
310    #[doc(alias = "auto-clamp-control-sources")]
311    fn set_auto_clamp_control_sources(&self, auto_clamp: bool) {
312        unsafe {
313            ffi::ges_track_element_set_auto_clamp_control_sources(
314                self.as_ref().to_glib_none().0,
315                auto_clamp.into_glib(),
316            );
317        }
318    }
319
320    //#[doc(alias = "ges_track_element_set_child_properties")]
321    //fn set_child_properties(&self, first_property_name: &str, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) {
322    //    unsafe { TODO: call ffi:ges_track_element_set_child_properties() }
323    //}
324
325    #[doc(alias = "ges_track_element_set_child_property")]
326    fn set_child_property(
327        &self,
328        property_name: &str,
329        value: &glib::Value,
330    ) -> Result<(), glib::error::BoolError> {
331        unsafe {
332            glib::result_from_gboolean!(
333                ffi::ges_track_element_set_child_property(
334                    self.as_ref().to_glib_none().0,
335                    property_name.to_glib_none().0,
336                    mut_override(value.to_glib_none().0)
337                ),
338                "Failed to set child property"
339            )
340        }
341    }
342
343    #[doc(alias = "ges_track_element_set_child_property_by_pspec")]
344    fn set_child_property_by_pspec(&self, pspec: impl AsRef<glib::ParamSpec>, value: &glib::Value) {
345        unsafe {
346            ffi::ges_track_element_set_child_property_by_pspec(
347                self.as_ref().to_glib_none().0,
348                pspec.as_ref().to_glib_none().0,
349                mut_override(value.to_glib_none().0),
350            );
351        }
352    }
353
354    //#[doc(alias = "ges_track_element_set_child_property_valist")]
355    //fn set_child_property_valist(&self, first_property_name: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported) {
356    //    unsafe { TODO: call ffi:ges_track_element_set_child_property_valist() }
357    //}
358
359    #[doc(alias = "ges_track_element_set_control_source")]
360    fn set_control_source(
361        &self,
362        source: &impl IsA<gst::ControlSource>,
363        property_name: &str,
364        binding_type: &str,
365    ) -> bool {
366        unsafe {
367            from_glib(ffi::ges_track_element_set_control_source(
368                self.as_ref().to_glib_none().0,
369                source.as_ref().to_glib_none().0,
370                property_name.to_glib_none().0,
371                binding_type.to_glib_none().0,
372            ))
373        }
374    }
375
376    #[cfg(feature = "v1_18")]
377    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
378    #[doc(alias = "ges_track_element_set_has_internal_source")]
379    #[doc(alias = "has-internal-source")]
380    fn set_has_internal_source(&self, has_internal_source: bool) -> bool {
381        unsafe {
382            from_glib(ffi::ges_track_element_set_has_internal_source(
383                self.as_ref().to_glib_none().0,
384                has_internal_source.into_glib(),
385            ))
386        }
387    }
388
389    #[doc(alias = "ges_track_element_set_track_type")]
390    #[doc(alias = "track-type")]
391    fn set_track_type(&self, type_: TrackType) {
392        unsafe {
393            ffi::ges_track_element_set_track_type(
394                self.as_ref().to_glib_none().0,
395                type_.into_glib(),
396            );
397        }
398    }
399
400    #[doc(alias = "control-binding-added")]
401    fn connect_control_binding_added<F: Fn(&Self, &gst::ControlBinding) + 'static>(
402        &self,
403        f: F,
404    ) -> SignalHandlerId {
405        unsafe extern "C" fn control_binding_added_trampoline<
406            P: IsA<TrackElement>,
407            F: Fn(&P, &gst::ControlBinding) + 'static,
408        >(
409            this: *mut ffi::GESTrackElement,
410            control_binding: *mut gst::ffi::GstControlBinding,
411            f: glib::ffi::gpointer,
412        ) {
413            let f: &F = &*(f as *const F);
414            f(
415                TrackElement::from_glib_borrow(this).unsafe_cast_ref(),
416                &from_glib_borrow(control_binding),
417            )
418        }
419        unsafe {
420            let f: Box_<F> = Box_::new(f);
421            connect_raw(
422                self.as_ptr() as *mut _,
423                b"control-binding-added\0".as_ptr() as *const _,
424                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
425                    control_binding_added_trampoline::<Self, F> as *const (),
426                )),
427                Box_::into_raw(f),
428            )
429        }
430    }
431
432    #[doc(alias = "control-binding-removed")]
433    fn connect_control_binding_removed<F: Fn(&Self, &gst::ControlBinding) + 'static>(
434        &self,
435        f: F,
436    ) -> SignalHandlerId {
437        unsafe extern "C" fn control_binding_removed_trampoline<
438            P: IsA<TrackElement>,
439            F: Fn(&P, &gst::ControlBinding) + 'static,
440        >(
441            this: *mut ffi::GESTrackElement,
442            control_binding: *mut gst::ffi::GstControlBinding,
443            f: glib::ffi::gpointer,
444        ) {
445            let f: &F = &*(f as *const F);
446            f(
447                TrackElement::from_glib_borrow(this).unsafe_cast_ref(),
448                &from_glib_borrow(control_binding),
449            )
450        }
451        unsafe {
452            let f: Box_<F> = Box_::new(f);
453            connect_raw(
454                self.as_ptr() as *mut _,
455                b"control-binding-removed\0".as_ptr() as *const _,
456                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
457                    control_binding_removed_trampoline::<Self, F> as *const (),
458                )),
459                Box_::into_raw(f),
460            )
461        }
462    }
463
464    #[doc(alias = "active")]
465    fn connect_active_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
466        unsafe extern "C" fn notify_active_trampoline<P: IsA<TrackElement>, F: Fn(&P) + 'static>(
467            this: *mut ffi::GESTrackElement,
468            _param_spec: glib::ffi::gpointer,
469            f: glib::ffi::gpointer,
470        ) {
471            let f: &F = &*(f as *const F);
472            f(TrackElement::from_glib_borrow(this).unsafe_cast_ref())
473        }
474        unsafe {
475            let f: Box_<F> = Box_::new(f);
476            connect_raw(
477                self.as_ptr() as *mut _,
478                b"notify::active\0".as_ptr() as *const _,
479                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
480                    notify_active_trampoline::<Self, F> as *const (),
481                )),
482                Box_::into_raw(f),
483            )
484        }
485    }
486
487    #[cfg(feature = "v1_18")]
488    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
489    #[doc(alias = "auto-clamp-control-sources")]
490    fn connect_auto_clamp_control_sources_notify<F: Fn(&Self) + 'static>(
491        &self,
492        f: F,
493    ) -> SignalHandlerId {
494        unsafe extern "C" fn notify_auto_clamp_control_sources_trampoline<
495            P: IsA<TrackElement>,
496            F: Fn(&P) + 'static,
497        >(
498            this: *mut ffi::GESTrackElement,
499            _param_spec: glib::ffi::gpointer,
500            f: glib::ffi::gpointer,
501        ) {
502            let f: &F = &*(f as *const F);
503            f(TrackElement::from_glib_borrow(this).unsafe_cast_ref())
504        }
505        unsafe {
506            let f: Box_<F> = Box_::new(f);
507            connect_raw(
508                self.as_ptr() as *mut _,
509                b"notify::auto-clamp-control-sources\0".as_ptr() as *const _,
510                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
511                    notify_auto_clamp_control_sources_trampoline::<Self, F> as *const (),
512                )),
513                Box_::into_raw(f),
514            )
515        }
516    }
517
518    #[cfg(feature = "v1_18")]
519    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
520    #[doc(alias = "has-internal-source")]
521    fn connect_has_internal_source_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
522        unsafe extern "C" fn notify_has_internal_source_trampoline<
523            P: IsA<TrackElement>,
524            F: Fn(&P) + 'static,
525        >(
526            this: *mut ffi::GESTrackElement,
527            _param_spec: glib::ffi::gpointer,
528            f: glib::ffi::gpointer,
529        ) {
530            let f: &F = &*(f as *const F);
531            f(TrackElement::from_glib_borrow(this).unsafe_cast_ref())
532        }
533        unsafe {
534            let f: Box_<F> = Box_::new(f);
535            connect_raw(
536                self.as_ptr() as *mut _,
537                b"notify::has-internal-source\0".as_ptr() as *const _,
538                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
539                    notify_has_internal_source_trampoline::<Self, F> as *const (),
540                )),
541                Box_::into_raw(f),
542            )
543        }
544    }
545
546    #[doc(alias = "track")]
547    fn connect_track_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
548        unsafe extern "C" fn notify_track_trampoline<P: IsA<TrackElement>, F: Fn(&P) + 'static>(
549            this: *mut ffi::GESTrackElement,
550            _param_spec: glib::ffi::gpointer,
551            f: glib::ffi::gpointer,
552        ) {
553            let f: &F = &*(f as *const F);
554            f(TrackElement::from_glib_borrow(this).unsafe_cast_ref())
555        }
556        unsafe {
557            let f: Box_<F> = Box_::new(f);
558            connect_raw(
559                self.as_ptr() as *mut _,
560                b"notify::track\0".as_ptr() as *const _,
561                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
562                    notify_track_trampoline::<Self, F> as *const (),
563                )),
564                Box_::into_raw(f),
565            )
566        }
567    }
568
569    #[doc(alias = "track-type")]
570    fn connect_track_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
571        unsafe extern "C" fn notify_track_type_trampoline<
572            P: IsA<TrackElement>,
573            F: Fn(&P) + 'static,
574        >(
575            this: *mut ffi::GESTrackElement,
576            _param_spec: glib::ffi::gpointer,
577            f: glib::ffi::gpointer,
578        ) {
579            let f: &F = &*(f as *const F);
580            f(TrackElement::from_glib_borrow(this).unsafe_cast_ref())
581        }
582        unsafe {
583            let f: Box_<F> = Box_::new(f);
584            connect_raw(
585                self.as_ptr() as *mut _,
586                b"notify::track-type\0".as_ptr() as *const _,
587                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
588                    notify_track_type_trampoline::<Self, F> as *const (),
589                )),
590                Box_::into_raw(f),
591            )
592        }
593    }
594}
595
596impl<O: IsA<TrackElement>> TrackElementExt for O {}