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