Skip to main content

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