1#![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 #[doc(alias = "ges_timeline_get_groups")]
209 #[doc(alias = "get_groups")]
210 fn groups(&self) -> Vec<Group> {
211 unsafe {
212 FromGlibPtrContainer::from_glib_none(ffi::ges_timeline_get_groups(
213 self.as_ref().to_glib_none().0,
214 ))
215 }
216 }
217
218 #[doc(alias = "ges_timeline_get_layer")]
219 #[doc(alias = "get_layer")]
220 fn layer(&self, priority: u32) -> Option<Layer> {
221 unsafe {
222 from_glib_full(ffi::ges_timeline_get_layer(
223 self.as_ref().to_glib_none().0,
224 priority,
225 ))
226 }
227 }
228
229 #[doc(alias = "ges_timeline_get_layers")]
230 #[doc(alias = "get_layers")]
231 fn layers(&self) -> Vec<Layer> {
232 unsafe {
233 FromGlibPtrContainer::from_glib_full(ffi::ges_timeline_get_layers(
234 self.as_ref().to_glib_none().0,
235 ))
236 }
237 }
238
239 #[doc(alias = "ges_timeline_get_pad_for_track")]
240 #[doc(alias = "get_pad_for_track")]
241 fn pad_for_track(&self, track: &impl IsA<Track>) -> Option<gst::Pad> {
242 unsafe {
243 from_glib_none(ffi::ges_timeline_get_pad_for_track(
244 self.as_ref().to_glib_none().0,
245 track.as_ref().to_glib_none().0,
246 ))
247 }
248 }
249
250 #[doc(alias = "ges_timeline_get_snapping_distance")]
251 #[doc(alias = "get_snapping_distance")]
252 #[doc(alias = "snapping-distance")]
253 fn snapping_distance(&self) -> Option<gst::ClockTime> {
254 unsafe {
255 from_glib(ffi::ges_timeline_get_snapping_distance(
256 self.as_ref().to_glib_none().0,
257 ))
258 }
259 }
260
261 #[doc(alias = "ges_timeline_get_track_for_pad")]
262 #[doc(alias = "get_track_for_pad")]
263 fn track_for_pad(&self, pad: &impl IsA<gst::Pad>) -> Option<Track> {
264 unsafe {
265 from_glib_none(ffi::ges_timeline_get_track_for_pad(
266 self.as_ref().to_glib_none().0,
267 pad.as_ref().to_glib_none().0,
268 ))
269 }
270 }
271
272 #[doc(alias = "ges_timeline_get_tracks")]
273 #[doc(alias = "get_tracks")]
274 fn tracks(&self) -> Vec<Track> {
275 unsafe {
276 FromGlibPtrContainer::from_glib_full(ffi::ges_timeline_get_tracks(
277 self.as_ref().to_glib_none().0,
278 ))
279 }
280 }
281
282 #[doc(alias = "ges_timeline_is_empty")]
283 fn is_empty(&self) -> bool {
284 unsafe { from_glib(ffi::ges_timeline_is_empty(self.as_ref().to_glib_none().0)) }
285 }
286
287 #[doc(alias = "ges_timeline_load_from_uri")]
288 fn load_from_uri(&self, uri: &str) -> Result<(), glib::Error> {
289 unsafe {
290 let mut error = std::ptr::null_mut();
291 let is_ok = ffi::ges_timeline_load_from_uri(
292 self.as_ref().to_glib_none().0,
293 uri.to_glib_none().0,
294 &mut error,
295 );
296 debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
297 if error.is_null() {
298 Ok(())
299 } else {
300 Err(from_glib_full(error))
301 }
302 }
303 }
304
305 #[cfg(feature = "v1_16")]
306 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
307 #[doc(alias = "ges_timeline_move_layer")]
308 fn move_layer(
309 &self,
310 layer: &impl IsA<Layer>,
311 new_layer_priority: u32,
312 ) -> Result<(), glib::error::BoolError> {
313 unsafe {
314 glib::result_from_gboolean!(
315 ffi::ges_timeline_move_layer(
316 self.as_ref().to_glib_none().0,
317 layer.as_ref().to_glib_none().0,
318 new_layer_priority
319 ),
320 "Failed to move layer"
321 )
322 }
323 }
324
325 #[doc(alias = "ges_timeline_paste_element")]
326 fn paste_element(
327 &self,
328 element: &impl IsA<TimelineElement>,
329 position: gst::ClockTime,
330 layer_priority: i32,
331 ) -> Option<TimelineElement> {
332 unsafe {
333 from_glib_full(ffi::ges_timeline_paste_element(
334 self.as_ref().to_glib_none().0,
335 element.as_ref().to_glib_none().0,
336 position.into_glib(),
337 layer_priority,
338 ))
339 }
340 }
341
342 #[doc(alias = "ges_timeline_remove_layer")]
343 fn remove_layer(&self, layer: &impl IsA<Layer>) -> Result<(), glib::error::BoolError> {
344 unsafe {
345 glib::result_from_gboolean!(
346 ffi::ges_timeline_remove_layer(
347 self.as_ref().to_glib_none().0,
348 layer.as_ref().to_glib_none().0
349 ),
350 "Failed to remove layer"
351 )
352 }
353 }
354
355 #[doc(alias = "ges_timeline_remove_track")]
356 fn remove_track(&self, track: &impl IsA<Track>) -> Result<(), glib::error::BoolError> {
357 unsafe {
358 glib::result_from_gboolean!(
359 ffi::ges_timeline_remove_track(
360 self.as_ref().to_glib_none().0,
361 track.as_ref().to_glib_none().0
362 ),
363 "Failed to remove track"
364 )
365 }
366 }
367
368 #[doc(alias = "ges_timeline_save_to_uri")]
369 fn save_to_uri(
370 &self,
371 uri: &str,
372 formatter_asset: Option<&impl IsA<Asset>>,
373 overwrite: bool,
374 ) -> Result<(), glib::Error> {
375 unsafe {
376 let mut error = std::ptr::null_mut();
377 let is_ok = ffi::ges_timeline_save_to_uri(
378 self.as_ref().to_glib_none().0,
379 uri.to_glib_none().0,
380 formatter_asset.map(|p| p.as_ref()).to_glib_none().0,
381 overwrite.into_glib(),
382 &mut error,
383 );
384 debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
385 if error.is_null() {
386 Ok(())
387 } else {
388 Err(from_glib_full(error))
389 }
390 }
391 }
392
393 #[doc(alias = "ges_timeline_set_auto_transition")]
394 #[doc(alias = "auto-transition")]
395 fn set_auto_transition(&self, auto_transition: bool) {
396 unsafe {
397 ffi::ges_timeline_set_auto_transition(
398 self.as_ref().to_glib_none().0,
399 auto_transition.into_glib(),
400 );
401 }
402 }
403
404 #[doc(alias = "ges_timeline_set_snapping_distance")]
405 #[doc(alias = "snapping-distance")]
406 fn set_snapping_distance(&self, snapping_distance: gst::ClockTime) {
407 unsafe {
408 ffi::ges_timeline_set_snapping_distance(
409 self.as_ref().to_glib_none().0,
410 snapping_distance.into_glib(),
411 );
412 }
413 }
414
415 #[cfg(feature = "v1_20")]
416 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
417 #[doc(alias = "ges_timeline_thaw_commit")]
418 fn thaw_commit(&self) {
419 unsafe {
420 ffi::ges_timeline_thaw_commit(self.as_ref().to_glib_none().0);
421 }
422 }
423
424 #[doc(alias = "commited")]
425 fn connect_commited<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
426 unsafe extern "C" fn commited_trampoline<P: IsA<Timeline>, F: Fn(&P) + 'static>(
427 this: *mut ffi::GESTimeline,
428 f: glib::ffi::gpointer,
429 ) {
430 unsafe {
431 let f: &F = &*(f as *const F);
432 f(Timeline::from_glib_borrow(this).unsafe_cast_ref())
433 }
434 }
435 unsafe {
436 let f: Box_<F> = Box_::new(f);
437 connect_raw(
438 self.as_ptr() as *mut _,
439 c"commited".as_ptr(),
440 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
441 commited_trampoline::<Self, F> as *const (),
442 )),
443 Box_::into_raw(f),
444 )
445 }
446 }
447
448 #[doc(alias = "group-added")]
449 fn connect_group_added<F: Fn(&Self, &Group) + 'static>(&self, f: F) -> SignalHandlerId {
450 unsafe extern "C" fn group_added_trampoline<
451 P: IsA<Timeline>,
452 F: Fn(&P, &Group) + 'static,
453 >(
454 this: *mut ffi::GESTimeline,
455 group: *mut ffi::GESGroup,
456 f: glib::ffi::gpointer,
457 ) {
458 unsafe {
459 let f: &F = &*(f as *const F);
460 f(
461 Timeline::from_glib_borrow(this).unsafe_cast_ref(),
462 &from_glib_borrow(group),
463 )
464 }
465 }
466 unsafe {
467 let f: Box_<F> = Box_::new(f);
468 connect_raw(
469 self.as_ptr() as *mut _,
470 c"group-added".as_ptr(),
471 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
472 group_added_trampoline::<Self, F> as *const (),
473 )),
474 Box_::into_raw(f),
475 )
476 }
477 }
478
479 #[doc(alias = "layer-added")]
485 fn connect_layer_added<F: Fn(&Self, &Layer) + 'static>(&self, f: F) -> SignalHandlerId {
486 unsafe extern "C" fn layer_added_trampoline<
487 P: IsA<Timeline>,
488 F: Fn(&P, &Layer) + 'static,
489 >(
490 this: *mut ffi::GESTimeline,
491 layer: *mut ffi::GESLayer,
492 f: glib::ffi::gpointer,
493 ) {
494 unsafe {
495 let f: &F = &*(f as *const F);
496 f(
497 Timeline::from_glib_borrow(this).unsafe_cast_ref(),
498 &from_glib_borrow(layer),
499 )
500 }
501 }
502 unsafe {
503 let f: Box_<F> = Box_::new(f);
504 connect_raw(
505 self.as_ptr() as *mut _,
506 c"layer-added".as_ptr(),
507 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
508 layer_added_trampoline::<Self, F> as *const (),
509 )),
510 Box_::into_raw(f),
511 )
512 }
513 }
514
515 #[doc(alias = "layer-removed")]
516 fn connect_layer_removed<F: Fn(&Self, &Layer) + 'static>(&self, f: F) -> SignalHandlerId {
517 unsafe extern "C" fn layer_removed_trampoline<
518 P: IsA<Timeline>,
519 F: Fn(&P, &Layer) + 'static,
520 >(
521 this: *mut ffi::GESTimeline,
522 layer: *mut ffi::GESLayer,
523 f: glib::ffi::gpointer,
524 ) {
525 unsafe {
526 let f: &F = &*(f as *const F);
527 f(
528 Timeline::from_glib_borrow(this).unsafe_cast_ref(),
529 &from_glib_borrow(layer),
530 )
531 }
532 }
533 unsafe {
534 let f: Box_<F> = Box_::new(f);
535 connect_raw(
536 self.as_ptr() as *mut _,
537 c"layer-removed".as_ptr(),
538 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
539 layer_removed_trampoline::<Self, F> as *const (),
540 )),
541 Box_::into_raw(f),
542 )
543 }
544 }
545
546 #[cfg(feature = "v1_18")]
547 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
548 #[doc(alias = "select-element-track")]
549 fn connect_select_element_track<
550 F: Fn(&Self, &Clip, &TrackElement) -> Option<Track> + 'static,
551 >(
552 &self,
553 f: F,
554 ) -> SignalHandlerId {
555 unsafe extern "C" fn select_element_track_trampoline<
556 P: IsA<Timeline>,
557 F: Fn(&P, &Clip, &TrackElement) -> Option<Track> + 'static,
558 >(
559 this: *mut ffi::GESTimeline,
560 clip: *mut ffi::GESClip,
561 track_element: *mut ffi::GESTrackElement,
562 f: glib::ffi::gpointer,
563 ) -> *mut ffi::GESTrack {
564 unsafe {
565 let f: &F = &*(f as *const F);
566 f(
567 Timeline::from_glib_borrow(this).unsafe_cast_ref(),
568 &from_glib_borrow(clip),
569 &from_glib_borrow(track_element),
570 )
571 .to_glib_full()
572 }
573 }
574 unsafe {
575 let f: Box_<F> = Box_::new(f);
576 connect_raw(
577 self.as_ptr() as *mut _,
578 c"select-element-track".as_ptr(),
579 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
580 select_element_track_trampoline::<Self, F> as *const (),
581 )),
582 Box_::into_raw(f),
583 )
584 }
585 }
586
587 #[doc(alias = "snapping-ended")]
593 fn connect_snapping_ended<F: Fn(&Self, &TrackElement, &TrackElement, u64) + 'static>(
594 &self,
595 f: F,
596 ) -> SignalHandlerId {
597 unsafe extern "C" fn snapping_ended_trampoline<
598 P: IsA<Timeline>,
599 F: Fn(&P, &TrackElement, &TrackElement, u64) + 'static,
600 >(
601 this: *mut ffi::GESTimeline,
602 obj1: *mut ffi::GESTrackElement,
603 obj2: *mut ffi::GESTrackElement,
604 position: u64,
605 f: glib::ffi::gpointer,
606 ) {
607 unsafe {
608 let f: &F = &*(f as *const F);
609 f(
610 Timeline::from_glib_borrow(this).unsafe_cast_ref(),
611 &from_glib_borrow(obj1),
612 &from_glib_borrow(obj2),
613 position,
614 )
615 }
616 }
617 unsafe {
618 let f: Box_<F> = Box_::new(f);
619 connect_raw(
620 self.as_ptr() as *mut _,
621 c"snapping-ended".as_ptr(),
622 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
623 snapping_ended_trampoline::<Self, F> as *const (),
624 )),
625 Box_::into_raw(f),
626 )
627 }
628 }
629
630 #[doc(alias = "snapping-started")]
631 fn connect_snapping_started<F: Fn(&Self, &TrackElement, &TrackElement, u64) + 'static>(
632 &self,
633 f: F,
634 ) -> SignalHandlerId {
635 unsafe extern "C" fn snapping_started_trampoline<
636 P: IsA<Timeline>,
637 F: Fn(&P, &TrackElement, &TrackElement, u64) + 'static,
638 >(
639 this: *mut ffi::GESTimeline,
640 obj1: *mut ffi::GESTrackElement,
641 obj2: *mut ffi::GESTrackElement,
642 position: u64,
643 f: glib::ffi::gpointer,
644 ) {
645 unsafe {
646 let f: &F = &*(f as *const F);
647 f(
648 Timeline::from_glib_borrow(this).unsafe_cast_ref(),
649 &from_glib_borrow(obj1),
650 &from_glib_borrow(obj2),
651 position,
652 )
653 }
654 }
655 unsafe {
656 let f: Box_<F> = Box_::new(f);
657 connect_raw(
658 self.as_ptr() as *mut _,
659 c"snapping-started".as_ptr(),
660 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
661 snapping_started_trampoline::<Self, F> as *const (),
662 )),
663 Box_::into_raw(f),
664 )
665 }
666 }
667
668 #[doc(alias = "track-added")]
669 fn connect_track_added<F: Fn(&Self, &Track) + 'static>(&self, f: F) -> SignalHandlerId {
670 unsafe extern "C" fn track_added_trampoline<
671 P: IsA<Timeline>,
672 F: Fn(&P, &Track) + 'static,
673 >(
674 this: *mut ffi::GESTimeline,
675 track: *mut ffi::GESTrack,
676 f: glib::ffi::gpointer,
677 ) {
678 unsafe {
679 let f: &F = &*(f as *const F);
680 f(
681 Timeline::from_glib_borrow(this).unsafe_cast_ref(),
682 &from_glib_borrow(track),
683 )
684 }
685 }
686 unsafe {
687 let f: Box_<F> = Box_::new(f);
688 connect_raw(
689 self.as_ptr() as *mut _,
690 c"track-added".as_ptr(),
691 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
692 track_added_trampoline::<Self, F> as *const (),
693 )),
694 Box_::into_raw(f),
695 )
696 }
697 }
698
699 #[doc(alias = "track-removed")]
700 fn connect_track_removed<F: Fn(&Self, &Track) + 'static>(&self, f: F) -> SignalHandlerId {
701 unsafe extern "C" fn track_removed_trampoline<
702 P: IsA<Timeline>,
703 F: Fn(&P, &Track) + 'static,
704 >(
705 this: *mut ffi::GESTimeline,
706 track: *mut ffi::GESTrack,
707 f: glib::ffi::gpointer,
708 ) {
709 unsafe {
710 let f: &F = &*(f as *const F);
711 f(
712 Timeline::from_glib_borrow(this).unsafe_cast_ref(),
713 &from_glib_borrow(track),
714 )
715 }
716 }
717 unsafe {
718 let f: Box_<F> = Box_::new(f);
719 connect_raw(
720 self.as_ptr() as *mut _,
721 c"track-removed".as_ptr(),
722 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
723 track_removed_trampoline::<Self, F> as *const (),
724 )),
725 Box_::into_raw(f),
726 )
727 }
728 }
729
730 #[doc(alias = "auto-transition")]
731 fn connect_auto_transition_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
732 unsafe extern "C" fn notify_auto_transition_trampoline<
733 P: IsA<Timeline>,
734 F: Fn(&P) + 'static,
735 >(
736 this: *mut ffi::GESTimeline,
737 _param_spec: glib::ffi::gpointer,
738 f: glib::ffi::gpointer,
739 ) {
740 unsafe {
741 let f: &F = &*(f as *const F);
742 f(Timeline::from_glib_borrow(this).unsafe_cast_ref())
743 }
744 }
745 unsafe {
746 let f: Box_<F> = Box_::new(f);
747 connect_raw(
748 self.as_ptr() as *mut _,
749 c"notify::auto-transition".as_ptr(),
750 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
751 notify_auto_transition_trampoline::<Self, F> as *const (),
752 )),
753 Box_::into_raw(f),
754 )
755 }
756 }
757
758 #[doc(alias = "duration")]
759 fn connect_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
760 unsafe extern "C" fn notify_duration_trampoline<P: IsA<Timeline>, F: Fn(&P) + 'static>(
761 this: *mut ffi::GESTimeline,
762 _param_spec: glib::ffi::gpointer,
763 f: glib::ffi::gpointer,
764 ) {
765 unsafe {
766 let f: &F = &*(f as *const F);
767 f(Timeline::from_glib_borrow(this).unsafe_cast_ref())
768 }
769 }
770 unsafe {
771 let f: Box_<F> = Box_::new(f);
772 connect_raw(
773 self.as_ptr() as *mut _,
774 c"notify::duration".as_ptr(),
775 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
776 notify_duration_trampoline::<Self, F> as *const (),
777 )),
778 Box_::into_raw(f),
779 )
780 }
781 }
782
783 #[doc(alias = "snapping-distance")]
784 fn connect_snapping_distance_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
785 unsafe extern "C" fn notify_snapping_distance_trampoline<
786 P: IsA<Timeline>,
787 F: Fn(&P) + 'static,
788 >(
789 this: *mut ffi::GESTimeline,
790 _param_spec: glib::ffi::gpointer,
791 f: glib::ffi::gpointer,
792 ) {
793 unsafe {
794 let f: &F = &*(f as *const F);
795 f(Timeline::from_glib_borrow(this).unsafe_cast_ref())
796 }
797 }
798 unsafe {
799 let f: Box_<F> = Box_::new(f);
800 connect_raw(
801 self.as_ptr() as *mut _,
802 c"notify::snapping-distance".as_ptr(),
803 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
804 notify_snapping_distance_trampoline::<Self, F> as *const (),
805 )),
806 Box_::into_raw(f),
807 )
808 }
809 }
810}
811
812impl<O: IsA<Timeline>> TimelineExt for O {}