Skip to main content

gstreamer_editing_services/auto/
timeline.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    Asset, Extractable, Group, Layer, MetaContainer, TimelineElement, Track, TrackElement, ffi,
9};
10#[cfg(feature = "v1_18")]
11#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
12use crate::{Clip, FrameNumber};
13use glib::{
14    object::ObjectType as _,
15    prelude::*,
16    signal::{SignalHandlerId, connect_raw},
17    translate::*,
18};
19use std::boxed::Box as Box_;
20
21glib::wrapper! {
22    #[doc(alias = "GESTimeline")]
23    pub struct Timeline(Object<ffi::GESTimeline, ffi::GESTimelineClass>) @extends gst::Bin, gst::Element, gst::Object, @implements gst::ChildProxy, Extractable, MetaContainer;
24
25    match fn {
26        type_ => || ffi::ges_timeline_get_type(),
27    }
28}
29
30impl Timeline {
31    pub const NONE: Option<&'static Timeline> = None;
32
33    #[doc(alias = "ges_timeline_new")]
34    pub fn new() -> Timeline {
35        assert_initialized_main_thread!();
36        unsafe { from_glib_none(ffi::ges_timeline_new()) }
37    }
38
39    #[doc(alias = "ges_timeline_new_audio_video")]
40    pub fn new_audio_video() -> Timeline {
41        assert_initialized_main_thread!();
42        unsafe { from_glib_none(ffi::ges_timeline_new_audio_video()) }
43    }
44
45    #[doc(alias = "ges_timeline_new_from_uri")]
46    #[doc(alias = "new_from_uri")]
47    pub fn from_uri(uri: &str) -> Result<Timeline, glib::Error> {
48        assert_initialized_main_thread!();
49        unsafe {
50            let mut error = std::ptr::null_mut();
51            let ret = ffi::ges_timeline_new_from_uri(uri.to_glib_none().0, &mut error);
52            if error.is_null() {
53                Ok(from_glib_none(ret))
54            } else {
55                Err(from_glib_full(error))
56            }
57        }
58    }
59}
60
61impl Default for Timeline {
62    fn default() -> Self {
63        Self::new()
64    }
65}
66
67pub trait TimelineExt: IsA<Timeline> + 'static {
68    #[cfg_attr(feature = "v1_18", deprecated = "Since 1.18")]
69    #[allow(deprecated)]
70    #[doc(alias = "ges_timeline_add_layer")]
71    fn add_layer(&self, layer: &impl IsA<Layer>) -> Result<(), glib::error::BoolError> {
72        unsafe {
73            glib::result_from_gboolean!(
74                ffi::ges_timeline_add_layer(
75                    self.as_ref().to_glib_none().0,
76                    layer.as_ref().to_glib_none().0
77                ),
78                "Failed to add layer"
79            )
80        }
81    }
82
83    #[doc(alias = "ges_timeline_add_track")]
84    fn add_track(&self, track: &impl IsA<Track>) -> Result<(), glib::error::BoolError> {
85        unsafe {
86            glib::result_from_gboolean!(
87                ffi::ges_timeline_add_track(
88                    self.as_ref().to_glib_none().0,
89                    track.as_ref().to_glib_none().0
90                ),
91                "Failed to add track"
92            )
93        }
94    }
95
96    #[doc(alias = "ges_timeline_append_layer")]
97    fn append_layer(&self) -> Layer {
98        unsafe {
99            from_glib_none(ffi::ges_timeline_append_layer(
100                self.as_ref().to_glib_none().0,
101            ))
102        }
103    }
104
105    #[doc(alias = "ges_timeline_commit")]
106    fn commit(&self) -> bool {
107        unsafe { from_glib(ffi::ges_timeline_commit(self.as_ref().to_glib_none().0)) }
108    }
109
110    #[doc(alias = "ges_timeline_commit_sync")]
111    fn commit_sync(&self) -> bool {
112        unsafe {
113            from_glib(ffi::ges_timeline_commit_sync(
114                self.as_ref().to_glib_none().0,
115            ))
116        }
117    }
118
119    #[cfg(feature = "v1_22")]
120    #[cfg_attr(docsrs, doc(cfg(feature = "v1_22")))]
121    #[doc(alias = "ges_timeline_disable_edit_apis")]
122    fn disable_edit_apis(&self, disable_edit_apis: bool) {
123        unsafe {
124            ffi::ges_timeline_disable_edit_apis(
125                self.as_ref().to_glib_none().0,
126                disable_edit_apis.into_glib(),
127            );
128        }
129    }
130
131    #[cfg(feature = "v1_20")]
132    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
133    #[doc(alias = "ges_timeline_freeze_commit")]
134    fn freeze_commit(&self) {
135        unsafe {
136            ffi::ges_timeline_freeze_commit(self.as_ref().to_glib_none().0);
137        }
138    }
139
140    #[doc(alias = "ges_timeline_get_auto_transition")]
141    #[doc(alias = "get_auto_transition")]
142    #[doc(alias = "auto-transition")]
143    fn is_auto_transition(&self) -> bool {
144        unsafe {
145            from_glib(ffi::ges_timeline_get_auto_transition(
146                self.as_ref().to_glib_none().0,
147            ))
148        }
149    }
150
151    #[doc(alias = "ges_timeline_get_duration")]
152    #[doc(alias = "get_duration")]
153    fn duration(&self) -> gst::ClockTime {
154        unsafe {
155            try_from_glib(ffi::ges_timeline_get_duration(
156                self.as_ref().to_glib_none().0,
157            ))
158            .expect("mandatory glib value is None")
159        }
160    }
161
162    #[cfg(feature = "v1_22")]
163    #[cfg_attr(docsrs, doc(cfg(feature = "v1_22")))]
164    #[doc(alias = "ges_timeline_get_edit_apis_disabled")]
165    #[doc(alias = "get_edit_apis_disabled")]
166    fn is_edit_apis_disabled(&self) -> bool {
167        unsafe {
168            from_glib(ffi::ges_timeline_get_edit_apis_disabled(
169                self.as_ref().to_glib_none().0,
170            ))
171        }
172    }
173
174    #[doc(alias = "ges_timeline_get_element")]
175    #[doc(alias = "get_element")]
176    fn element(&self, name: &str) -> Option<TimelineElement> {
177        unsafe {
178            from_glib_full(ffi::ges_timeline_get_element(
179                self.as_ref().to_glib_none().0,
180                name.to_glib_none().0,
181            ))
182        }
183    }
184
185    #[cfg(feature = "v1_18")]
186    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
187    #[doc(alias = "ges_timeline_get_frame_at")]
188    #[doc(alias = "get_frame_at")]
189    fn frame_at(&self, timestamp: gst::ClockTime) -> FrameNumber {
190        unsafe {
191            ffi::ges_timeline_get_frame_at(self.as_ref().to_glib_none().0, timestamp.into_glib())
192        }
193    }
194
195    #[cfg(feature = "v1_18")]
196    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
197    #[doc(alias = "ges_timeline_get_frame_time")]
198    #[doc(alias = "get_frame_time")]
199    fn frame_time(&self, frame_number: FrameNumber) -> Option<gst::ClockTime> {
200        unsafe {
201            from_glib(ffi::ges_timeline_get_frame_time(
202                self.as_ref().to_glib_none().0,
203                frame_number,
204            ))
205        }
206    }
207
208    #[cfg_attr(feature = "v1_30", deprecated = "Since 1.30")]
209    #[allow(deprecated)]
210    #[doc(alias = "ges_timeline_get_groups")]
211    #[doc(alias = "get_groups")]
212    fn groups(&self) -> Vec<Group> {
213        unsafe {
214            FromGlibPtrContainer::from_glib_none(ffi::ges_timeline_get_groups(
215                self.as_ref().to_glib_none().0,
216            ))
217        }
218    }
219
220    #[cfg(feature = "v1_30")]
221    #[cfg_attr(docsrs, doc(cfg(feature = "v1_30")))]
222    #[doc(alias = "ges_timeline_get_groups_full")]
223    #[doc(alias = "get_groups_full")]
224    fn groups_full(&self) -> Vec<Group> {
225        unsafe {
226            FromGlibPtrContainer::from_glib_full(ffi::ges_timeline_get_groups_full(
227                self.as_ref().to_glib_none().0,
228            ))
229        }
230    }
231
232    #[doc(alias = "ges_timeline_get_layer")]
233    #[doc(alias = "get_layer")]
234    fn layer(&self, priority: u32) -> Option<Layer> {
235        unsafe {
236            from_glib_full(ffi::ges_timeline_get_layer(
237                self.as_ref().to_glib_none().0,
238                priority,
239            ))
240        }
241    }
242
243    #[doc(alias = "ges_timeline_get_layers")]
244    #[doc(alias = "get_layers")]
245    fn layers(&self) -> Vec<Layer> {
246        unsafe {
247            FromGlibPtrContainer::from_glib_full(ffi::ges_timeline_get_layers(
248                self.as_ref().to_glib_none().0,
249            ))
250        }
251    }
252
253    #[doc(alias = "ges_timeline_get_pad_for_track")]
254    #[doc(alias = "get_pad_for_track")]
255    fn pad_for_track(&self, track: &impl IsA<Track>) -> Option<gst::Pad> {
256        unsafe {
257            from_glib_none(ffi::ges_timeline_get_pad_for_track(
258                self.as_ref().to_glib_none().0,
259                track.as_ref().to_glib_none().0,
260            ))
261        }
262    }
263
264    #[doc(alias = "ges_timeline_get_snapping_distance")]
265    #[doc(alias = "get_snapping_distance")]
266    #[doc(alias = "snapping-distance")]
267    fn snapping_distance(&self) -> Option<gst::ClockTime> {
268        unsafe {
269            from_glib(ffi::ges_timeline_get_snapping_distance(
270                self.as_ref().to_glib_none().0,
271            ))
272        }
273    }
274
275    #[cfg_attr(feature = "v1_30", deprecated = "Since 1.30")]
276    #[allow(deprecated)]
277    #[doc(alias = "ges_timeline_get_track_for_pad")]
278    #[doc(alias = "get_track_for_pad")]
279    fn track_for_pad(&self, pad: &impl IsA<gst::Pad>) -> Option<Track> {
280        unsafe {
281            from_glib_none(ffi::ges_timeline_get_track_for_pad(
282                self.as_ref().to_glib_none().0,
283                pad.as_ref().to_glib_none().0,
284            ))
285        }
286    }
287
288    #[cfg(feature = "v1_30")]
289    #[cfg_attr(docsrs, doc(cfg(feature = "v1_30")))]
290    #[doc(alias = "ges_timeline_get_track_for_pad_full")]
291    #[doc(alias = "get_track_for_pad_full")]
292    fn track_for_pad_full(&self, pad: &impl IsA<gst::Pad>) -> Option<Track> {
293        unsafe {
294            from_glib_full(ffi::ges_timeline_get_track_for_pad_full(
295                self.as_ref().to_glib_none().0,
296                pad.as_ref().to_glib_none().0,
297            ))
298        }
299    }
300
301    #[doc(alias = "ges_timeline_get_tracks")]
302    #[doc(alias = "get_tracks")]
303    fn tracks(&self) -> Vec<Track> {
304        unsafe {
305            FromGlibPtrContainer::from_glib_full(ffi::ges_timeline_get_tracks(
306                self.as_ref().to_glib_none().0,
307            ))
308        }
309    }
310
311    #[doc(alias = "ges_timeline_is_empty")]
312    fn is_empty(&self) -> bool {
313        unsafe { from_glib(ffi::ges_timeline_is_empty(self.as_ref().to_glib_none().0)) }
314    }
315
316    #[doc(alias = "ges_timeline_load_from_uri")]
317    fn load_from_uri(&self, uri: &str) -> Result<(), glib::Error> {
318        unsafe {
319            let mut error = std::ptr::null_mut();
320            let is_ok = ffi::ges_timeline_load_from_uri(
321                self.as_ref().to_glib_none().0,
322                uri.to_glib_none().0,
323                &mut error,
324            );
325            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
326            if error.is_null() {
327                Ok(())
328            } else {
329                Err(from_glib_full(error))
330            }
331        }
332    }
333
334    #[cfg(feature = "v1_16")]
335    #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
336    #[doc(alias = "ges_timeline_move_layer")]
337    fn move_layer(
338        &self,
339        layer: &impl IsA<Layer>,
340        new_layer_priority: u32,
341    ) -> Result<(), glib::error::BoolError> {
342        unsafe {
343            glib::result_from_gboolean!(
344                ffi::ges_timeline_move_layer(
345                    self.as_ref().to_glib_none().0,
346                    layer.as_ref().to_glib_none().0,
347                    new_layer_priority
348                ),
349                "Failed to move layer"
350            )
351        }
352    }
353
354    #[doc(alias = "ges_timeline_paste_element")]
355    fn paste_element(
356        &self,
357        element: &impl IsA<TimelineElement>,
358        position: gst::ClockTime,
359        layer_priority: i32,
360    ) -> Option<TimelineElement> {
361        unsafe {
362            from_glib_full(ffi::ges_timeline_paste_element(
363                self.as_ref().to_glib_none().0,
364                element.as_ref().to_glib_none().0,
365                position.into_glib(),
366                layer_priority,
367            ))
368        }
369    }
370
371    #[doc(alias = "ges_timeline_remove_layer")]
372    fn remove_layer(&self, layer: &impl IsA<Layer>) -> Result<(), glib::error::BoolError> {
373        unsafe {
374            glib::result_from_gboolean!(
375                ffi::ges_timeline_remove_layer(
376                    self.as_ref().to_glib_none().0,
377                    layer.as_ref().to_glib_none().0
378                ),
379                "Failed to remove layer"
380            )
381        }
382    }
383
384    #[doc(alias = "ges_timeline_remove_track")]
385    fn remove_track(&self, track: &impl IsA<Track>) -> Result<(), glib::error::BoolError> {
386        unsafe {
387            glib::result_from_gboolean!(
388                ffi::ges_timeline_remove_track(
389                    self.as_ref().to_glib_none().0,
390                    track.as_ref().to_glib_none().0
391                ),
392                "Failed to remove track"
393            )
394        }
395    }
396
397    #[doc(alias = "ges_timeline_save_to_uri")]
398    fn save_to_uri(
399        &self,
400        uri: &str,
401        formatter_asset: Option<&impl IsA<Asset>>,
402        overwrite: bool,
403    ) -> Result<(), glib::Error> {
404        unsafe {
405            let mut error = std::ptr::null_mut();
406            let is_ok = ffi::ges_timeline_save_to_uri(
407                self.as_ref().to_glib_none().0,
408                uri.to_glib_none().0,
409                formatter_asset.map(|p| p.as_ref()).to_glib_none().0,
410                overwrite.into_glib(),
411                &mut error,
412            );
413            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
414            if error.is_null() {
415                Ok(())
416            } else {
417                Err(from_glib_full(error))
418            }
419        }
420    }
421
422    #[doc(alias = "ges_timeline_set_auto_transition")]
423    #[doc(alias = "auto-transition")]
424    fn set_auto_transition(&self, auto_transition: bool) {
425        unsafe {
426            ffi::ges_timeline_set_auto_transition(
427                self.as_ref().to_glib_none().0,
428                auto_transition.into_glib(),
429            );
430        }
431    }
432
433    #[doc(alias = "ges_timeline_set_snapping_distance")]
434    #[doc(alias = "snapping-distance")]
435    fn set_snapping_distance(&self, snapping_distance: gst::ClockTime) {
436        unsafe {
437            ffi::ges_timeline_set_snapping_distance(
438                self.as_ref().to_glib_none().0,
439                snapping_distance.into_glib(),
440            );
441        }
442    }
443
444    #[cfg(feature = "v1_20")]
445    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
446    #[doc(alias = "ges_timeline_thaw_commit")]
447    fn thaw_commit(&self) {
448        unsafe {
449            ffi::ges_timeline_thaw_commit(self.as_ref().to_glib_none().0);
450        }
451    }
452
453    #[doc(alias = "commited")]
454    fn connect_commited<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
455        unsafe extern "C" fn commited_trampoline<P: IsA<Timeline>, F: Fn(&P) + 'static>(
456            this: *mut ffi::GESTimeline,
457            f: glib::ffi::gpointer,
458        ) {
459            unsafe {
460                let f: &F = &*(f as *const F);
461                f(Timeline::from_glib_borrow(this).unsafe_cast_ref())
462            }
463        }
464        unsafe {
465            let f: Box_<F> = Box_::new(f);
466            connect_raw(
467                self.as_ptr() as *mut _,
468                c"commited".as_ptr(),
469                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
470                    commited_trampoline::<Self, F> as *const (),
471                )),
472                Box_::into_raw(f),
473            )
474        }
475    }
476
477    #[doc(alias = "group-added")]
478    fn connect_group_added<F: Fn(&Self, &Group) + 'static>(&self, f: F) -> SignalHandlerId {
479        unsafe extern "C" fn group_added_trampoline<
480            P: IsA<Timeline>,
481            F: Fn(&P, &Group) + 'static,
482        >(
483            this: *mut ffi::GESTimeline,
484            group: *mut ffi::GESGroup,
485            f: glib::ffi::gpointer,
486        ) {
487            unsafe {
488                let f: &F = &*(f as *const F);
489                f(
490                    Timeline::from_glib_borrow(this).unsafe_cast_ref(),
491                    &from_glib_borrow(group),
492                )
493            }
494        }
495        unsafe {
496            let f: Box_<F> = Box_::new(f);
497            connect_raw(
498                self.as_ptr() as *mut _,
499                c"group-added".as_ptr(),
500                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
501                    group_added_trampoline::<Self, F> as *const (),
502                )),
503                Box_::into_raw(f),
504            )
505        }
506    }
507
508    //#[doc(alias = "group-removed")]
509    //fn connect_group_removed<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
510    //    Empty ctype children: *.PtrArray TypeId { ns_id: 1, id: 54 }
511    //}
512
513    #[doc(alias = "layer-added")]
514    fn connect_layer_added<F: Fn(&Self, &Layer) + 'static>(&self, f: F) -> SignalHandlerId {
515        unsafe extern "C" fn layer_added_trampoline<
516            P: IsA<Timeline>,
517            F: Fn(&P, &Layer) + 'static,
518        >(
519            this: *mut ffi::GESTimeline,
520            layer: *mut ffi::GESLayer,
521            f: glib::ffi::gpointer,
522        ) {
523            unsafe {
524                let f: &F = &*(f as *const F);
525                f(
526                    Timeline::from_glib_borrow(this).unsafe_cast_ref(),
527                    &from_glib_borrow(layer),
528                )
529            }
530        }
531        unsafe {
532            let f: Box_<F> = Box_::new(f);
533            connect_raw(
534                self.as_ptr() as *mut _,
535                c"layer-added".as_ptr(),
536                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
537                    layer_added_trampoline::<Self, F> as *const (),
538                )),
539                Box_::into_raw(f),
540            )
541        }
542    }
543
544    #[doc(alias = "layer-removed")]
545    fn connect_layer_removed<F: Fn(&Self, &Layer) + 'static>(&self, f: F) -> SignalHandlerId {
546        unsafe extern "C" fn layer_removed_trampoline<
547            P: IsA<Timeline>,
548            F: Fn(&P, &Layer) + 'static,
549        >(
550            this: *mut ffi::GESTimeline,
551            layer: *mut ffi::GESLayer,
552            f: glib::ffi::gpointer,
553        ) {
554            unsafe {
555                let f: &F = &*(f as *const F);
556                f(
557                    Timeline::from_glib_borrow(this).unsafe_cast_ref(),
558                    &from_glib_borrow(layer),
559                )
560            }
561        }
562        unsafe {
563            let f: Box_<F> = Box_::new(f);
564            connect_raw(
565                self.as_ptr() as *mut _,
566                c"layer-removed".as_ptr(),
567                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
568                    layer_removed_trampoline::<Self, F> as *const (),
569                )),
570                Box_::into_raw(f),
571            )
572        }
573    }
574
575    #[cfg(feature = "v1_18")]
576    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
577    #[doc(alias = "select-element-track")]
578    fn connect_select_element_track<
579        F: Fn(&Self, &Clip, &TrackElement) -> Option<Track> + 'static,
580    >(
581        &self,
582        f: F,
583    ) -> SignalHandlerId {
584        unsafe extern "C" fn select_element_track_trampoline<
585            P: IsA<Timeline>,
586            F: Fn(&P, &Clip, &TrackElement) -> Option<Track> + 'static,
587        >(
588            this: *mut ffi::GESTimeline,
589            clip: *mut ffi::GESClip,
590            track_element: *mut ffi::GESTrackElement,
591            f: glib::ffi::gpointer,
592        ) -> *mut ffi::GESTrack {
593            unsafe {
594                let f: &F = &*(f as *const F);
595                f(
596                    Timeline::from_glib_borrow(this).unsafe_cast_ref(),
597                    &from_glib_borrow(clip),
598                    &from_glib_borrow(track_element),
599                )
600                .to_glib_full()
601            }
602        }
603        unsafe {
604            let f: Box_<F> = Box_::new(f);
605            connect_raw(
606                self.as_ptr() as *mut _,
607                c"select-element-track".as_ptr(),
608                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
609                    select_element_track_trampoline::<Self, F> as *const (),
610                )),
611                Box_::into_raw(f),
612            )
613        }
614    }
615
616    //#[doc(alias = "select-tracks-for-object")]
617    //fn connect_select_tracks_for_object<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
618    //    Empty ctype return value *.PtrArray TypeId { ns_id: 1, id: 17 }
619    //}
620
621    #[doc(alias = "snapping-ended")]
622    fn connect_snapping_ended<F: Fn(&Self, &TrackElement, &TrackElement, u64) + 'static>(
623        &self,
624        f: F,
625    ) -> SignalHandlerId {
626        unsafe extern "C" fn snapping_ended_trampoline<
627            P: IsA<Timeline>,
628            F: Fn(&P, &TrackElement, &TrackElement, u64) + 'static,
629        >(
630            this: *mut ffi::GESTimeline,
631            obj1: *mut ffi::GESTrackElement,
632            obj2: *mut ffi::GESTrackElement,
633            position: u64,
634            f: glib::ffi::gpointer,
635        ) {
636            unsafe {
637                let f: &F = &*(f as *const F);
638                f(
639                    Timeline::from_glib_borrow(this).unsafe_cast_ref(),
640                    &from_glib_borrow(obj1),
641                    &from_glib_borrow(obj2),
642                    position,
643                )
644            }
645        }
646        unsafe {
647            let f: Box_<F> = Box_::new(f);
648            connect_raw(
649                self.as_ptr() as *mut _,
650                c"snapping-ended".as_ptr(),
651                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
652                    snapping_ended_trampoline::<Self, F> as *const (),
653                )),
654                Box_::into_raw(f),
655            )
656        }
657    }
658
659    #[doc(alias = "snapping-started")]
660    fn connect_snapping_started<F: Fn(&Self, &TrackElement, &TrackElement, u64) + 'static>(
661        &self,
662        f: F,
663    ) -> SignalHandlerId {
664        unsafe extern "C" fn snapping_started_trampoline<
665            P: IsA<Timeline>,
666            F: Fn(&P, &TrackElement, &TrackElement, u64) + 'static,
667        >(
668            this: *mut ffi::GESTimeline,
669            obj1: *mut ffi::GESTrackElement,
670            obj2: *mut ffi::GESTrackElement,
671            position: u64,
672            f: glib::ffi::gpointer,
673        ) {
674            unsafe {
675                let f: &F = &*(f as *const F);
676                f(
677                    Timeline::from_glib_borrow(this).unsafe_cast_ref(),
678                    &from_glib_borrow(obj1),
679                    &from_glib_borrow(obj2),
680                    position,
681                )
682            }
683        }
684        unsafe {
685            let f: Box_<F> = Box_::new(f);
686            connect_raw(
687                self.as_ptr() as *mut _,
688                c"snapping-started".as_ptr(),
689                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
690                    snapping_started_trampoline::<Self, F> as *const (),
691                )),
692                Box_::into_raw(f),
693            )
694        }
695    }
696
697    #[doc(alias = "track-added")]
698    fn connect_track_added<F: Fn(&Self, &Track) + 'static>(&self, f: F) -> SignalHandlerId {
699        unsafe extern "C" fn track_added_trampoline<
700            P: IsA<Timeline>,
701            F: Fn(&P, &Track) + 'static,
702        >(
703            this: *mut ffi::GESTimeline,
704            track: *mut ffi::GESTrack,
705            f: glib::ffi::gpointer,
706        ) {
707            unsafe {
708                let f: &F = &*(f as *const F);
709                f(
710                    Timeline::from_glib_borrow(this).unsafe_cast_ref(),
711                    &from_glib_borrow(track),
712                )
713            }
714        }
715        unsafe {
716            let f: Box_<F> = Box_::new(f);
717            connect_raw(
718                self.as_ptr() as *mut _,
719                c"track-added".as_ptr(),
720                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
721                    track_added_trampoline::<Self, F> as *const (),
722                )),
723                Box_::into_raw(f),
724            )
725        }
726    }
727
728    #[doc(alias = "track-removed")]
729    fn connect_track_removed<F: Fn(&Self, &Track) + 'static>(&self, f: F) -> SignalHandlerId {
730        unsafe extern "C" fn track_removed_trampoline<
731            P: IsA<Timeline>,
732            F: Fn(&P, &Track) + 'static,
733        >(
734            this: *mut ffi::GESTimeline,
735            track: *mut ffi::GESTrack,
736            f: glib::ffi::gpointer,
737        ) {
738            unsafe {
739                let f: &F = &*(f as *const F);
740                f(
741                    Timeline::from_glib_borrow(this).unsafe_cast_ref(),
742                    &from_glib_borrow(track),
743                )
744            }
745        }
746        unsafe {
747            let f: Box_<F> = Box_::new(f);
748            connect_raw(
749                self.as_ptr() as *mut _,
750                c"track-removed".as_ptr(),
751                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
752                    track_removed_trampoline::<Self, F> as *const (),
753                )),
754                Box_::into_raw(f),
755            )
756        }
757    }
758
759    #[doc(alias = "auto-transition")]
760    fn connect_auto_transition_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
761        unsafe extern "C" fn notify_auto_transition_trampoline<
762            P: IsA<Timeline>,
763            F: Fn(&P) + 'static,
764        >(
765            this: *mut ffi::GESTimeline,
766            _param_spec: glib::ffi::gpointer,
767            f: glib::ffi::gpointer,
768        ) {
769            unsafe {
770                let f: &F = &*(f as *const F);
771                f(Timeline::from_glib_borrow(this).unsafe_cast_ref())
772            }
773        }
774        unsafe {
775            let f: Box_<F> = Box_::new(f);
776            connect_raw(
777                self.as_ptr() as *mut _,
778                c"notify::auto-transition".as_ptr(),
779                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
780                    notify_auto_transition_trampoline::<Self, F> as *const (),
781                )),
782                Box_::into_raw(f),
783            )
784        }
785    }
786
787    #[doc(alias = "duration")]
788    fn connect_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
789        unsafe extern "C" fn notify_duration_trampoline<P: IsA<Timeline>, F: Fn(&P) + 'static>(
790            this: *mut ffi::GESTimeline,
791            _param_spec: glib::ffi::gpointer,
792            f: glib::ffi::gpointer,
793        ) {
794            unsafe {
795                let f: &F = &*(f as *const F);
796                f(Timeline::from_glib_borrow(this).unsafe_cast_ref())
797            }
798        }
799        unsafe {
800            let f: Box_<F> = Box_::new(f);
801            connect_raw(
802                self.as_ptr() as *mut _,
803                c"notify::duration".as_ptr(),
804                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
805                    notify_duration_trampoline::<Self, F> as *const (),
806                )),
807                Box_::into_raw(f),
808            )
809        }
810    }
811
812    #[doc(alias = "snapping-distance")]
813    fn connect_snapping_distance_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
814        unsafe extern "C" fn notify_snapping_distance_trampoline<
815            P: IsA<Timeline>,
816            F: Fn(&P) + 'static,
817        >(
818            this: *mut ffi::GESTimeline,
819            _param_spec: glib::ffi::gpointer,
820            f: glib::ffi::gpointer,
821        ) {
822            unsafe {
823                let f: &F = &*(f as *const F);
824                f(Timeline::from_glib_borrow(this).unsafe_cast_ref())
825            }
826        }
827        unsafe {
828            let f: Box_<F> = Box_::new(f);
829            connect_raw(
830                self.as_ptr() as *mut _,
831                c"notify::snapping-distance".as_ptr(),
832                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
833                    notify_snapping_distance_trampoline::<Self, F> as *const (),
834                )),
835                Box_::into_raw(f),
836            )
837        }
838    }
839}
840
841impl<O: IsA<Timeline>> TimelineExt for O {}