1#![allow(deprecated)]
6
7use crate::{
8 ffi, Asset, Extractable, Group, Layer, MetaContainer, TimelineElement, Track, TrackElement,
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::{connect_raw, SignalHandlerId},
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 let f: &F = &*(f as *const F);
431 f(Timeline::from_glib_borrow(this).unsafe_cast_ref())
432 }
433 unsafe {
434 let f: Box_<F> = Box_::new(f);
435 connect_raw(
436 self.as_ptr() as *mut _,
437 c"commited".as_ptr() as *const _,
438 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
439 commited_trampoline::<Self, F> as *const (),
440 )),
441 Box_::into_raw(f),
442 )
443 }
444 }
445
446 #[doc(alias = "group-added")]
447 fn connect_group_added<F: Fn(&Self, &Group) + 'static>(&self, f: F) -> SignalHandlerId {
448 unsafe extern "C" fn group_added_trampoline<
449 P: IsA<Timeline>,
450 F: Fn(&P, &Group) + 'static,
451 >(
452 this: *mut ffi::GESTimeline,
453 group: *mut ffi::GESGroup,
454 f: glib::ffi::gpointer,
455 ) {
456 let f: &F = &*(f as *const F);
457 f(
458 Timeline::from_glib_borrow(this).unsafe_cast_ref(),
459 &from_glib_borrow(group),
460 )
461 }
462 unsafe {
463 let f: Box_<F> = Box_::new(f);
464 connect_raw(
465 self.as_ptr() as *mut _,
466 c"group-added".as_ptr() as *const _,
467 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
468 group_added_trampoline::<Self, F> as *const (),
469 )),
470 Box_::into_raw(f),
471 )
472 }
473 }
474
475 #[doc(alias = "layer-added")]
481 fn connect_layer_added<F: Fn(&Self, &Layer) + 'static>(&self, f: F) -> SignalHandlerId {
482 unsafe extern "C" fn layer_added_trampoline<
483 P: IsA<Timeline>,
484 F: Fn(&P, &Layer) + 'static,
485 >(
486 this: *mut ffi::GESTimeline,
487 layer: *mut ffi::GESLayer,
488 f: glib::ffi::gpointer,
489 ) {
490 let f: &F = &*(f as *const F);
491 f(
492 Timeline::from_glib_borrow(this).unsafe_cast_ref(),
493 &from_glib_borrow(layer),
494 )
495 }
496 unsafe {
497 let f: Box_<F> = Box_::new(f);
498 connect_raw(
499 self.as_ptr() as *mut _,
500 c"layer-added".as_ptr() as *const _,
501 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
502 layer_added_trampoline::<Self, F> as *const (),
503 )),
504 Box_::into_raw(f),
505 )
506 }
507 }
508
509 #[doc(alias = "layer-removed")]
510 fn connect_layer_removed<F: Fn(&Self, &Layer) + 'static>(&self, f: F) -> SignalHandlerId {
511 unsafe extern "C" fn layer_removed_trampoline<
512 P: IsA<Timeline>,
513 F: Fn(&P, &Layer) + 'static,
514 >(
515 this: *mut ffi::GESTimeline,
516 layer: *mut ffi::GESLayer,
517 f: glib::ffi::gpointer,
518 ) {
519 let f: &F = &*(f as *const F);
520 f(
521 Timeline::from_glib_borrow(this).unsafe_cast_ref(),
522 &from_glib_borrow(layer),
523 )
524 }
525 unsafe {
526 let f: Box_<F> = Box_::new(f);
527 connect_raw(
528 self.as_ptr() as *mut _,
529 c"layer-removed".as_ptr() as *const _,
530 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
531 layer_removed_trampoline::<Self, F> as *const (),
532 )),
533 Box_::into_raw(f),
534 )
535 }
536 }
537
538 #[cfg(feature = "v1_18")]
539 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
540 #[doc(alias = "select-element-track")]
541 fn connect_select_element_track<
542 F: Fn(&Self, &Clip, &TrackElement) -> Option<Track> + 'static,
543 >(
544 &self,
545 f: F,
546 ) -> SignalHandlerId {
547 unsafe extern "C" fn select_element_track_trampoline<
548 P: IsA<Timeline>,
549 F: Fn(&P, &Clip, &TrackElement) -> Option<Track> + 'static,
550 >(
551 this: *mut ffi::GESTimeline,
552 clip: *mut ffi::GESClip,
553 track_element: *mut ffi::GESTrackElement,
554 f: glib::ffi::gpointer,
555 ) -> *mut ffi::GESTrack {
556 let f: &F = &*(f as *const F);
557 f(
558 Timeline::from_glib_borrow(this).unsafe_cast_ref(),
559 &from_glib_borrow(clip),
560 &from_glib_borrow(track_element),
561 )
562 .to_glib_full()
563 }
564 unsafe {
565 let f: Box_<F> = Box_::new(f);
566 connect_raw(
567 self.as_ptr() as *mut _,
568 c"select-element-track".as_ptr() as *const _,
569 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
570 select_element_track_trampoline::<Self, F> as *const (),
571 )),
572 Box_::into_raw(f),
573 )
574 }
575 }
576
577 #[doc(alias = "snapping-ended")]
583 fn connect_snapping_ended<F: Fn(&Self, &TrackElement, &TrackElement, u64) + 'static>(
584 &self,
585 f: F,
586 ) -> SignalHandlerId {
587 unsafe extern "C" fn snapping_ended_trampoline<
588 P: IsA<Timeline>,
589 F: Fn(&P, &TrackElement, &TrackElement, u64) + 'static,
590 >(
591 this: *mut ffi::GESTimeline,
592 obj1: *mut ffi::GESTrackElement,
593 obj2: *mut ffi::GESTrackElement,
594 position: u64,
595 f: glib::ffi::gpointer,
596 ) {
597 let f: &F = &*(f as *const F);
598 f(
599 Timeline::from_glib_borrow(this).unsafe_cast_ref(),
600 &from_glib_borrow(obj1),
601 &from_glib_borrow(obj2),
602 position,
603 )
604 }
605 unsafe {
606 let f: Box_<F> = Box_::new(f);
607 connect_raw(
608 self.as_ptr() as *mut _,
609 c"snapping-ended".as_ptr() as *const _,
610 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
611 snapping_ended_trampoline::<Self, F> as *const (),
612 )),
613 Box_::into_raw(f),
614 )
615 }
616 }
617
618 #[doc(alias = "snapping-started")]
619 fn connect_snapping_started<F: Fn(&Self, &TrackElement, &TrackElement, u64) + 'static>(
620 &self,
621 f: F,
622 ) -> SignalHandlerId {
623 unsafe extern "C" fn snapping_started_trampoline<
624 P: IsA<Timeline>,
625 F: Fn(&P, &TrackElement, &TrackElement, u64) + 'static,
626 >(
627 this: *mut ffi::GESTimeline,
628 obj1: *mut ffi::GESTrackElement,
629 obj2: *mut ffi::GESTrackElement,
630 position: u64,
631 f: glib::ffi::gpointer,
632 ) {
633 let f: &F = &*(f as *const F);
634 f(
635 Timeline::from_glib_borrow(this).unsafe_cast_ref(),
636 &from_glib_borrow(obj1),
637 &from_glib_borrow(obj2),
638 position,
639 )
640 }
641 unsafe {
642 let f: Box_<F> = Box_::new(f);
643 connect_raw(
644 self.as_ptr() as *mut _,
645 c"snapping-started".as_ptr() as *const _,
646 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
647 snapping_started_trampoline::<Self, F> as *const (),
648 )),
649 Box_::into_raw(f),
650 )
651 }
652 }
653
654 #[doc(alias = "track-added")]
655 fn connect_track_added<F: Fn(&Self, &Track) + 'static>(&self, f: F) -> SignalHandlerId {
656 unsafe extern "C" fn track_added_trampoline<
657 P: IsA<Timeline>,
658 F: Fn(&P, &Track) + 'static,
659 >(
660 this: *mut ffi::GESTimeline,
661 track: *mut ffi::GESTrack,
662 f: glib::ffi::gpointer,
663 ) {
664 let f: &F = &*(f as *const F);
665 f(
666 Timeline::from_glib_borrow(this).unsafe_cast_ref(),
667 &from_glib_borrow(track),
668 )
669 }
670 unsafe {
671 let f: Box_<F> = Box_::new(f);
672 connect_raw(
673 self.as_ptr() as *mut _,
674 c"track-added".as_ptr() as *const _,
675 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
676 track_added_trampoline::<Self, F> as *const (),
677 )),
678 Box_::into_raw(f),
679 )
680 }
681 }
682
683 #[doc(alias = "track-removed")]
684 fn connect_track_removed<F: Fn(&Self, &Track) + 'static>(&self, f: F) -> SignalHandlerId {
685 unsafe extern "C" fn track_removed_trampoline<
686 P: IsA<Timeline>,
687 F: Fn(&P, &Track) + 'static,
688 >(
689 this: *mut ffi::GESTimeline,
690 track: *mut ffi::GESTrack,
691 f: glib::ffi::gpointer,
692 ) {
693 let f: &F = &*(f as *const F);
694 f(
695 Timeline::from_glib_borrow(this).unsafe_cast_ref(),
696 &from_glib_borrow(track),
697 )
698 }
699 unsafe {
700 let f: Box_<F> = Box_::new(f);
701 connect_raw(
702 self.as_ptr() as *mut _,
703 c"track-removed".as_ptr() as *const _,
704 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
705 track_removed_trampoline::<Self, F> as *const (),
706 )),
707 Box_::into_raw(f),
708 )
709 }
710 }
711
712 #[doc(alias = "auto-transition")]
713 fn connect_auto_transition_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
714 unsafe extern "C" fn notify_auto_transition_trampoline<
715 P: IsA<Timeline>,
716 F: Fn(&P) + 'static,
717 >(
718 this: *mut ffi::GESTimeline,
719 _param_spec: glib::ffi::gpointer,
720 f: glib::ffi::gpointer,
721 ) {
722 let f: &F = &*(f as *const F);
723 f(Timeline::from_glib_borrow(this).unsafe_cast_ref())
724 }
725 unsafe {
726 let f: Box_<F> = Box_::new(f);
727 connect_raw(
728 self.as_ptr() as *mut _,
729 c"notify::auto-transition".as_ptr() as *const _,
730 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
731 notify_auto_transition_trampoline::<Self, F> as *const (),
732 )),
733 Box_::into_raw(f),
734 )
735 }
736 }
737
738 #[doc(alias = "duration")]
739 fn connect_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
740 unsafe extern "C" fn notify_duration_trampoline<P: IsA<Timeline>, F: Fn(&P) + 'static>(
741 this: *mut ffi::GESTimeline,
742 _param_spec: glib::ffi::gpointer,
743 f: glib::ffi::gpointer,
744 ) {
745 let f: &F = &*(f as *const F);
746 f(Timeline::from_glib_borrow(this).unsafe_cast_ref())
747 }
748 unsafe {
749 let f: Box_<F> = Box_::new(f);
750 connect_raw(
751 self.as_ptr() as *mut _,
752 c"notify::duration".as_ptr() as *const _,
753 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
754 notify_duration_trampoline::<Self, F> as *const (),
755 )),
756 Box_::into_raw(f),
757 )
758 }
759 }
760
761 #[doc(alias = "snapping-distance")]
762 fn connect_snapping_distance_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
763 unsafe extern "C" fn notify_snapping_distance_trampoline<
764 P: IsA<Timeline>,
765 F: Fn(&P) + 'static,
766 >(
767 this: *mut ffi::GESTimeline,
768 _param_spec: glib::ffi::gpointer,
769 f: glib::ffi::gpointer,
770 ) {
771 let f: &F = &*(f as *const F);
772 f(Timeline::from_glib_borrow(this).unsafe_cast_ref())
773 }
774 unsafe {
775 let f: Box_<F> = Box_::new(f);
776 connect_raw(
777 self.as_ptr() as *mut _,
778 c"notify::snapping-distance".as_ptr() as *const _,
779 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
780 notify_snapping_distance_trampoline::<Self, F> as *const (),
781 )),
782 Box_::into_raw(f),
783 )
784 }
785 }
786}
787
788impl<O: IsA<Timeline>> TimelineExt for O {}