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