1#![allow(deprecated)]
6
7use crate::{ffi, Extractable, MetaContainer, Timeline, TrackType};
8#[cfg(feature = "v1_18")]
9#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
10use crate::{Edge, EditMode, Layer};
11use glib::{
12 object::ObjectType as _,
13 prelude::*,
14 signal::{connect_raw, SignalHandlerId},
15 translate::*,
16};
17use std::boxed::Box as Box_;
18
19glib::wrapper! {
20 #[doc(alias = "GESTimelineElement")]
21 pub struct TimelineElement(Object<ffi::GESTimelineElement, ffi::GESTimelineElementClass>) @implements Extractable, MetaContainer;
22
23 match fn {
24 type_ => || ffi::ges_timeline_element_get_type(),
25 }
26}
27
28impl TimelineElement {
29 pub const NONE: Option<&'static TimelineElement> = None;
30}
31
32pub trait TimelineElementExt: IsA<TimelineElement> + 'static {
33 #[doc(alias = "ges_timeline_element_add_child_property")]
34 fn add_child_property(
35 &self,
36 pspec: impl AsRef<glib::ParamSpec>,
37 child: &impl IsA<glib::Object>,
38 ) -> Result<(), glib::error::BoolError> {
39 unsafe {
40 glib::result_from_gboolean!(
41 ffi::ges_timeline_element_add_child_property(
42 self.as_ref().to_glib_none().0,
43 pspec.as_ref().to_glib_none().0,
44 child.as_ref().to_glib_none().0
45 ),
46 "Failed to add child property"
47 )
48 }
49 }
50
51 #[doc(alias = "ges_timeline_element_copy")]
52 #[must_use]
53 fn copy(&self, deep: bool) -> TimelineElement {
54 unsafe {
55 from_glib_none(ffi::ges_timeline_element_copy(
56 self.as_ref().to_glib_none().0,
57 deep.into_glib(),
58 ))
59 }
60 }
61
62 #[cfg(feature = "v1_18")]
63 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
64 #[doc(alias = "ges_timeline_element_edit")]
65 fn edit(
66 &self,
67 layers: &[Layer],
68 new_layer_priority: i64,
69 mode: EditMode,
70 edge: Edge,
71 position: u64,
72 ) -> bool {
73 unsafe {
74 from_glib(ffi::ges_timeline_element_edit(
75 self.as_ref().to_glib_none().0,
76 layers.to_glib_none().0,
77 new_layer_priority,
78 mode.into_glib(),
79 edge.into_glib(),
80 position,
81 ))
82 }
83 }
84
85 #[cfg(feature = "v1_18")]
86 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
87 #[doc(alias = "ges_timeline_element_edit_full")]
88 fn edit_full(
89 &self,
90 new_layer_priority: i64,
91 mode: EditMode,
92 edge: Edge,
93 position: u64,
94 ) -> Result<(), glib::Error> {
95 unsafe {
96 let mut error = std::ptr::null_mut();
97 let is_ok = ffi::ges_timeline_element_edit_full(
98 self.as_ref().to_glib_none().0,
99 new_layer_priority,
100 mode.into_glib(),
101 edge.into_glib(),
102 position,
103 &mut error,
104 );
105 debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
106 if error.is_null() {
107 Ok(())
108 } else {
109 Err(from_glib_full(error))
110 }
111 }
112 }
113
114 #[doc(alias = "ges_timeline_element_get_child_property")]
121 #[doc(alias = "get_child_property")]
122 fn child_property(&self, property_name: &str) -> Option<glib::Value> {
123 unsafe {
124 let mut value = glib::Value::uninitialized();
125 let ret = from_glib(ffi::ges_timeline_element_get_child_property(
126 self.as_ref().to_glib_none().0,
127 property_name.to_glib_none().0,
128 value.to_glib_none_mut().0,
129 ));
130 if ret {
131 Some(value)
132 } else {
133 None
134 }
135 }
136 }
137
138 #[doc(alias = "ges_timeline_element_get_child_property_by_pspec")]
139 #[doc(alias = "get_child_property_by_pspec")]
140 fn child_property_by_pspec(&self, pspec: impl AsRef<glib::ParamSpec>) -> glib::Value {
141 unsafe {
142 let mut value = glib::Value::uninitialized();
143 ffi::ges_timeline_element_get_child_property_by_pspec(
144 self.as_ref().to_glib_none().0,
145 pspec.as_ref().to_glib_none().0,
146 value.to_glib_none_mut().0,
147 );
148 value
149 }
150 }
151
152 #[doc(alias = "ges_timeline_element_get_duration")]
159 #[doc(alias = "get_duration")]
160 fn duration(&self) -> gst::ClockTime {
161 unsafe {
162 try_from_glib(ffi::ges_timeline_element_get_duration(
163 self.as_ref().to_glib_none().0,
164 ))
165 .expect("mandatory glib value is None")
166 }
167 }
168
169 #[doc(alias = "ges_timeline_element_get_inpoint")]
170 #[doc(alias = "get_inpoint")]
171 #[doc(alias = "in-point")]
172 fn inpoint(&self) -> gst::ClockTime {
173 unsafe {
174 try_from_glib(ffi::ges_timeline_element_get_inpoint(
175 self.as_ref().to_glib_none().0,
176 ))
177 .expect("mandatory glib value is None")
178 }
179 }
180
181 #[cfg(feature = "v1_16")]
182 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
183 #[doc(alias = "ges_timeline_element_get_layer_priority")]
184 #[doc(alias = "get_layer_priority")]
185 fn layer_priority(&self) -> u32 {
186 unsafe { ffi::ges_timeline_element_get_layer_priority(self.as_ref().to_glib_none().0) }
187 }
188
189 #[doc(alias = "ges_timeline_element_get_max_duration")]
190 #[doc(alias = "get_max_duration")]
191 #[doc(alias = "max-duration")]
192 fn max_duration(&self) -> Option<gst::ClockTime> {
193 unsafe {
194 from_glib(ffi::ges_timeline_element_get_max_duration(
195 self.as_ref().to_glib_none().0,
196 ))
197 }
198 }
199
200 #[doc(alias = "ges_timeline_element_get_name")]
201 #[doc(alias = "get_name")]
202 fn name(&self) -> Option<glib::GString> {
203 unsafe {
204 from_glib_full(ffi::ges_timeline_element_get_name(
205 self.as_ref().to_glib_none().0,
206 ))
207 }
208 }
209
210 #[cfg(feature = "v1_18")]
211 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
212 #[doc(alias = "ges_timeline_element_get_natural_framerate")]
213 #[doc(alias = "get_natural_framerate")]
214 fn natural_framerate(&self) -> Option<(i32, i32)> {
215 unsafe {
216 let mut framerate_n = std::mem::MaybeUninit::uninit();
217 let mut framerate_d = std::mem::MaybeUninit::uninit();
218 let ret = from_glib(ffi::ges_timeline_element_get_natural_framerate(
219 self.as_ref().to_glib_none().0,
220 framerate_n.as_mut_ptr(),
221 framerate_d.as_mut_ptr(),
222 ));
223 if ret {
224 Some((framerate_n.assume_init(), framerate_d.assume_init()))
225 } else {
226 None
227 }
228 }
229 }
230
231 #[doc(alias = "ges_timeline_element_get_parent")]
232 #[doc(alias = "get_parent")]
233 #[must_use]
234 fn parent(&self) -> Option<TimelineElement> {
235 unsafe {
236 from_glib_full(ffi::ges_timeline_element_get_parent(
237 self.as_ref().to_glib_none().0,
238 ))
239 }
240 }
241
242 #[doc(alias = "ges_timeline_element_get_priority")]
243 #[doc(alias = "get_priority")]
244 fn priority(&self) -> u32 {
245 unsafe { ffi::ges_timeline_element_get_priority(self.as_ref().to_glib_none().0) }
246 }
247
248 #[doc(alias = "ges_timeline_element_get_start")]
249 #[doc(alias = "get_start")]
250 fn start(&self) -> gst::ClockTime {
251 unsafe {
252 try_from_glib(ffi::ges_timeline_element_get_start(
253 self.as_ref().to_glib_none().0,
254 ))
255 .expect("mandatory glib value is None")
256 }
257 }
258
259 #[doc(alias = "ges_timeline_element_get_timeline")]
260 #[doc(alias = "get_timeline")]
261 fn timeline(&self) -> Option<Timeline> {
262 unsafe {
263 from_glib_full(ffi::ges_timeline_element_get_timeline(
264 self.as_ref().to_glib_none().0,
265 ))
266 }
267 }
268
269 #[doc(alias = "ges_timeline_element_get_toplevel_parent")]
270 #[doc(alias = "get_toplevel_parent")]
271 #[must_use]
272 fn toplevel_parent(&self) -> TimelineElement {
273 unsafe {
274 from_glib_full(ffi::ges_timeline_element_get_toplevel_parent(
275 self.as_ref().to_glib_none().0,
276 ))
277 }
278 }
279
280 #[doc(alias = "ges_timeline_element_get_track_types")]
281 #[doc(alias = "get_track_types")]
282 fn track_types(&self) -> TrackType {
283 unsafe {
284 from_glib(ffi::ges_timeline_element_get_track_types(
285 self.as_ref().to_glib_none().0,
286 ))
287 }
288 }
289
290 #[doc(alias = "ges_timeline_element_list_children_properties")]
291 fn list_children_properties(&self) -> Vec<glib::ParamSpec> {
292 unsafe {
293 let mut n_properties = std::mem::MaybeUninit::uninit();
294 let ret = FromGlibContainer::from_glib_full_num(
295 ffi::ges_timeline_element_list_children_properties(
296 self.as_ref().to_glib_none().0,
297 n_properties.as_mut_ptr(),
298 ),
299 n_properties.assume_init() as _,
300 );
301 ret
302 }
303 }
304
305 #[doc(alias = "ges_timeline_element_lookup_child")]
306 fn lookup_child(&self, prop_name: &str) -> Option<(glib::Object, glib::ParamSpec)> {
307 unsafe {
308 let mut child = std::ptr::null_mut();
309 let mut pspec = std::ptr::null_mut();
310 let ret = from_glib(ffi::ges_timeline_element_lookup_child(
311 self.as_ref().to_glib_none().0,
312 prop_name.to_glib_none().0,
313 &mut child,
314 &mut pspec,
315 ));
316 if ret {
317 Some((from_glib_full(child), from_glib_full(pspec)))
318 } else {
319 None
320 }
321 }
322 }
323
324 #[doc(alias = "ges_timeline_element_paste")]
325 fn paste(&self, paste_position: gst::ClockTime) -> Result<TimelineElement, glib::BoolError> {
326 unsafe {
327 Option::<_>::from_glib_full(ffi::ges_timeline_element_paste(
328 self.as_ref().to_glib_none().0,
329 paste_position.into_glib(),
330 ))
331 .ok_or_else(|| glib::bool_error!("Failed to paste timeline element"))
332 }
333 }
334
335 #[doc(alias = "ges_timeline_element_remove_child_property")]
336 fn remove_child_property(
337 &self,
338 pspec: impl AsRef<glib::ParamSpec>,
339 ) -> Result<(), glib::error::BoolError> {
340 unsafe {
341 glib::result_from_gboolean!(
342 ffi::ges_timeline_element_remove_child_property(
343 self.as_ref().to_glib_none().0,
344 pspec.as_ref().to_glib_none().0
345 ),
346 "Failed to remove child property"
347 )
348 }
349 }
350
351 #[doc(alias = "ges_timeline_element_ripple")]
352 fn ripple(&self, start: gst::ClockTime) -> Result<(), glib::error::BoolError> {
353 unsafe {
354 glib::result_from_gboolean!(
355 ffi::ges_timeline_element_ripple(self.as_ref().to_glib_none().0, start.into_glib()),
356 "Failed to ripple"
357 )
358 }
359 }
360
361 #[doc(alias = "ges_timeline_element_ripple_end")]
362 fn ripple_end(&self, end: gst::ClockTime) -> Result<(), glib::error::BoolError> {
363 unsafe {
364 glib::result_from_gboolean!(
365 ffi::ges_timeline_element_ripple_end(
366 self.as_ref().to_glib_none().0,
367 end.into_glib()
368 ),
369 "Failed to ripple"
370 )
371 }
372 }
373
374 #[doc(alias = "ges_timeline_element_roll_end")]
375 fn roll_end(&self, end: gst::ClockTime) -> Result<(), glib::error::BoolError> {
376 unsafe {
377 glib::result_from_gboolean!(
378 ffi::ges_timeline_element_roll_end(self.as_ref().to_glib_none().0, end.into_glib()),
379 "Failed to roll"
380 )
381 }
382 }
383
384 #[doc(alias = "ges_timeline_element_roll_start")]
385 fn roll_start(&self, start: gst::ClockTime) -> Result<(), glib::error::BoolError> {
386 unsafe {
387 glib::result_from_gboolean!(
388 ffi::ges_timeline_element_roll_start(
389 self.as_ref().to_glib_none().0,
390 start.into_glib()
391 ),
392 "Failed to roll"
393 )
394 }
395 }
396
397 #[doc(alias = "ges_timeline_element_set_child_property")]
403 fn set_child_property(
404 &self,
405 property_name: &str,
406 value: &glib::Value,
407 ) -> Result<(), glib::error::BoolError> {
408 unsafe {
409 glib::result_from_gboolean!(
410 ffi::ges_timeline_element_set_child_property(
411 self.as_ref().to_glib_none().0,
412 property_name.to_glib_none().0,
413 value.to_glib_none().0
414 ),
415 "Failed to set child property"
416 )
417 }
418 }
419
420 #[doc(alias = "ges_timeline_element_set_child_property_by_pspec")]
421 fn set_child_property_by_pspec(&self, pspec: impl AsRef<glib::ParamSpec>, value: &glib::Value) {
422 unsafe {
423 ffi::ges_timeline_element_set_child_property_by_pspec(
424 self.as_ref().to_glib_none().0,
425 pspec.as_ref().to_glib_none().0,
426 value.to_glib_none().0,
427 );
428 }
429 }
430
431 #[cfg(feature = "v1_18")]
432 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
433 #[doc(alias = "ges_timeline_element_set_child_property_full")]
434 fn set_child_property_full(
435 &self,
436 property_name: &str,
437 value: &glib::Value,
438 ) -> Result<(), glib::Error> {
439 unsafe {
440 let mut error = std::ptr::null_mut();
441 let is_ok = ffi::ges_timeline_element_set_child_property_full(
442 self.as_ref().to_glib_none().0,
443 property_name.to_glib_none().0,
444 value.to_glib_none().0,
445 &mut error,
446 );
447 debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
448 if error.is_null() {
449 Ok(())
450 } else {
451 Err(from_glib_full(error))
452 }
453 }
454 }
455
456 #[doc(alias = "ges_timeline_element_set_duration")]
462 #[doc(alias = "duration")]
463 fn set_duration(&self, duration: impl Into<Option<gst::ClockTime>>) -> bool {
464 unsafe {
465 from_glib(ffi::ges_timeline_element_set_duration(
466 self.as_ref().to_glib_none().0,
467 duration.into().into_glib(),
468 ))
469 }
470 }
471
472 #[doc(alias = "ges_timeline_element_set_inpoint")]
473 #[doc(alias = "in-point")]
474 fn set_inpoint(&self, inpoint: gst::ClockTime) -> bool {
475 unsafe {
476 from_glib(ffi::ges_timeline_element_set_inpoint(
477 self.as_ref().to_glib_none().0,
478 inpoint.into_glib(),
479 ))
480 }
481 }
482
483 #[doc(alias = "ges_timeline_element_set_max_duration")]
484 #[doc(alias = "max-duration")]
485 fn set_max_duration(&self, maxduration: impl Into<Option<gst::ClockTime>>) -> bool {
486 unsafe {
487 from_glib(ffi::ges_timeline_element_set_max_duration(
488 self.as_ref().to_glib_none().0,
489 maxduration.into().into_glib(),
490 ))
491 }
492 }
493
494 #[doc(alias = "ges_timeline_element_set_name")]
495 #[doc(alias = "name")]
496 fn set_name(&self, name: Option<&str>) -> Result<(), glib::error::BoolError> {
497 unsafe {
498 glib::result_from_gboolean!(
499 ffi::ges_timeline_element_set_name(
500 self.as_ref().to_glib_none().0,
501 name.to_glib_none().0
502 ),
503 "Failed to set name"
504 )
505 }
506 }
507
508 #[doc(alias = "ges_timeline_element_set_parent")]
509 #[doc(alias = "parent")]
510 fn set_parent(&self, parent: &impl IsA<TimelineElement>) -> Result<(), glib::error::BoolError> {
511 unsafe {
512 glib::result_from_gboolean!(
513 ffi::ges_timeline_element_set_parent(
514 self.as_ref().to_glib_none().0,
515 parent.as_ref().to_glib_none().0
516 ),
517 "`TimelineElement` already had a parent or its parent was the same as specified"
518 )
519 }
520 }
521
522 #[deprecated = "Since 1.10"]
523 #[allow(deprecated)]
524 #[doc(alias = "ges_timeline_element_set_priority")]
525 #[doc(alias = "priority")]
526 fn set_priority(&self, priority: u32) -> bool {
527 unsafe {
528 from_glib(ffi::ges_timeline_element_set_priority(
529 self.as_ref().to_glib_none().0,
530 priority,
531 ))
532 }
533 }
534
535 #[doc(alias = "ges_timeline_element_set_start")]
536 #[doc(alias = "start")]
537 fn set_start(&self, start: gst::ClockTime) -> bool {
538 unsafe {
539 from_glib(ffi::ges_timeline_element_set_start(
540 self.as_ref().to_glib_none().0,
541 start.into_glib(),
542 ))
543 }
544 }
545
546 #[doc(alias = "ges_timeline_element_set_timeline")]
547 #[doc(alias = "timeline")]
548 fn set_timeline(&self, timeline: &impl IsA<Timeline>) -> Result<(), glib::error::BoolError> {
549 unsafe {
550 glib::result_from_gboolean!(
551 ffi::ges_timeline_element_set_timeline(
552 self.as_ref().to_glib_none().0,
553 timeline.as_ref().to_glib_none().0
554 ),
555 "`Failed to set timeline"
556 )
557 }
558 }
559
560 #[doc(alias = "ges_timeline_element_trim")]
561 fn trim(&self, start: gst::ClockTime) -> Result<(), glib::error::BoolError> {
562 unsafe {
563 glib::result_from_gboolean!(
564 ffi::ges_timeline_element_trim(self.as_ref().to_glib_none().0, start.into_glib()),
565 "Failed to trim"
566 )
567 }
568 }
569
570 fn is_serialize(&self) -> bool {
571 ObjectExt::property(self.as_ref(), "serialize")
572 }
573
574 fn set_serialize(&self, serialize: bool) {
575 ObjectExt::set_property(self.as_ref(), "serialize", serialize)
576 }
577
578 #[cfg(feature = "v1_18")]
579 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
580 #[doc(alias = "child-property-added")]
581 fn connect_child_property_added<F: Fn(&Self, &glib::Object, &glib::ParamSpec) + 'static>(
582 &self,
583 f: F,
584 ) -> SignalHandlerId {
585 unsafe extern "C" fn child_property_added_trampoline<
586 P: IsA<TimelineElement>,
587 F: Fn(&P, &glib::Object, &glib::ParamSpec) + 'static,
588 >(
589 this: *mut ffi::GESTimelineElement,
590 prop_object: *mut glib::gobject_ffi::GObject,
591 prop: *mut glib::gobject_ffi::GParamSpec,
592 f: glib::ffi::gpointer,
593 ) {
594 let f: &F = &*(f as *const F);
595 f(
596 TimelineElement::from_glib_borrow(this).unsafe_cast_ref(),
597 &from_glib_borrow(prop_object),
598 &from_glib_borrow(prop),
599 )
600 }
601 unsafe {
602 let f: Box_<F> = Box_::new(f);
603 connect_raw(
604 self.as_ptr() as *mut _,
605 c"child-property-added".as_ptr() as *const _,
606 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
607 child_property_added_trampoline::<Self, F> as *const (),
608 )),
609 Box_::into_raw(f),
610 )
611 }
612 }
613
614 #[cfg(feature = "v1_18")]
615 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
616 #[doc(alias = "child-property-removed")]
617 fn connect_child_property_removed<F: Fn(&Self, &glib::Object, &glib::ParamSpec) + 'static>(
618 &self,
619 f: F,
620 ) -> SignalHandlerId {
621 unsafe extern "C" fn child_property_removed_trampoline<
622 P: IsA<TimelineElement>,
623 F: Fn(&P, &glib::Object, &glib::ParamSpec) + 'static,
624 >(
625 this: *mut ffi::GESTimelineElement,
626 prop_object: *mut glib::gobject_ffi::GObject,
627 prop: *mut glib::gobject_ffi::GParamSpec,
628 f: glib::ffi::gpointer,
629 ) {
630 let f: &F = &*(f as *const F);
631 f(
632 TimelineElement::from_glib_borrow(this).unsafe_cast_ref(),
633 &from_glib_borrow(prop_object),
634 &from_glib_borrow(prop),
635 )
636 }
637 unsafe {
638 let f: Box_<F> = Box_::new(f);
639 connect_raw(
640 self.as_ptr() as *mut _,
641 c"child-property-removed".as_ptr() as *const _,
642 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
643 child_property_removed_trampoline::<Self, F> as *const (),
644 )),
645 Box_::into_raw(f),
646 )
647 }
648 }
649
650 #[doc(alias = "deep-notify")]
651 fn connect_deep_notify<F: Fn(&Self, &glib::Object, &glib::ParamSpec) + 'static>(
652 &self,
653 detail: Option<&str>,
654 f: F,
655 ) -> SignalHandlerId {
656 unsafe extern "C" fn deep_notify_trampoline<
657 P: IsA<TimelineElement>,
658 F: Fn(&P, &glib::Object, &glib::ParamSpec) + 'static,
659 >(
660 this: *mut ffi::GESTimelineElement,
661 prop_object: *mut glib::gobject_ffi::GObject,
662 prop: *mut glib::gobject_ffi::GParamSpec,
663 f: glib::ffi::gpointer,
664 ) {
665 let f: &F = &*(f as *const F);
666 f(
667 TimelineElement::from_glib_borrow(this).unsafe_cast_ref(),
668 &from_glib_borrow(prop_object),
669 &from_glib_borrow(prop),
670 )
671 }
672 unsafe {
673 let f: Box_<F> = Box_::new(f);
674 let detailed_signal_name = detail.map(|name| format!("deep-notify::{name}\0"));
675 let signal_name: &[u8] = detailed_signal_name
676 .as_ref()
677 .map_or(c"deep-notify".to_bytes(), |n| n.as_bytes());
678 connect_raw(
679 self.as_ptr() as *mut _,
680 signal_name.as_ptr() as *const _,
681 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
682 deep_notify_trampoline::<Self, F> as *const (),
683 )),
684 Box_::into_raw(f),
685 )
686 }
687 }
688
689 #[doc(alias = "duration")]
690 fn connect_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
691 unsafe extern "C" fn notify_duration_trampoline<
692 P: IsA<TimelineElement>,
693 F: Fn(&P) + 'static,
694 >(
695 this: *mut ffi::GESTimelineElement,
696 _param_spec: glib::ffi::gpointer,
697 f: glib::ffi::gpointer,
698 ) {
699 let f: &F = &*(f as *const F);
700 f(TimelineElement::from_glib_borrow(this).unsafe_cast_ref())
701 }
702 unsafe {
703 let f: Box_<F> = Box_::new(f);
704 connect_raw(
705 self.as_ptr() as *mut _,
706 c"notify::duration".as_ptr() as *const _,
707 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
708 notify_duration_trampoline::<Self, F> as *const (),
709 )),
710 Box_::into_raw(f),
711 )
712 }
713 }
714
715 #[doc(alias = "in-point")]
716 fn connect_in_point_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
717 unsafe extern "C" fn notify_in_point_trampoline<
718 P: IsA<TimelineElement>,
719 F: Fn(&P) + 'static,
720 >(
721 this: *mut ffi::GESTimelineElement,
722 _param_spec: glib::ffi::gpointer,
723 f: glib::ffi::gpointer,
724 ) {
725 let f: &F = &*(f as *const F);
726 f(TimelineElement::from_glib_borrow(this).unsafe_cast_ref())
727 }
728 unsafe {
729 let f: Box_<F> = Box_::new(f);
730 connect_raw(
731 self.as_ptr() as *mut _,
732 c"notify::in-point".as_ptr() as *const _,
733 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
734 notify_in_point_trampoline::<Self, F> as *const (),
735 )),
736 Box_::into_raw(f),
737 )
738 }
739 }
740
741 #[doc(alias = "max-duration")]
742 fn connect_max_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
743 unsafe extern "C" fn notify_max_duration_trampoline<
744 P: IsA<TimelineElement>,
745 F: Fn(&P) + 'static,
746 >(
747 this: *mut ffi::GESTimelineElement,
748 _param_spec: glib::ffi::gpointer,
749 f: glib::ffi::gpointer,
750 ) {
751 let f: &F = &*(f as *const F);
752 f(TimelineElement::from_glib_borrow(this).unsafe_cast_ref())
753 }
754 unsafe {
755 let f: Box_<F> = Box_::new(f);
756 connect_raw(
757 self.as_ptr() as *mut _,
758 c"notify::max-duration".as_ptr() as *const _,
759 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
760 notify_max_duration_trampoline::<Self, F> as *const (),
761 )),
762 Box_::into_raw(f),
763 )
764 }
765 }
766
767 #[doc(alias = "name")]
768 fn connect_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
769 unsafe extern "C" fn notify_name_trampoline<
770 P: IsA<TimelineElement>,
771 F: Fn(&P) + 'static,
772 >(
773 this: *mut ffi::GESTimelineElement,
774 _param_spec: glib::ffi::gpointer,
775 f: glib::ffi::gpointer,
776 ) {
777 let f: &F = &*(f as *const F);
778 f(TimelineElement::from_glib_borrow(this).unsafe_cast_ref())
779 }
780 unsafe {
781 let f: Box_<F> = Box_::new(f);
782 connect_raw(
783 self.as_ptr() as *mut _,
784 c"notify::name".as_ptr() as *const _,
785 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
786 notify_name_trampoline::<Self, F> as *const (),
787 )),
788 Box_::into_raw(f),
789 )
790 }
791 }
792
793 #[doc(alias = "parent")]
794 fn connect_parent_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
795 unsafe extern "C" fn notify_parent_trampoline<
796 P: IsA<TimelineElement>,
797 F: Fn(&P) + 'static,
798 >(
799 this: *mut ffi::GESTimelineElement,
800 _param_spec: glib::ffi::gpointer,
801 f: glib::ffi::gpointer,
802 ) {
803 let f: &F = &*(f as *const F);
804 f(TimelineElement::from_glib_borrow(this).unsafe_cast_ref())
805 }
806 unsafe {
807 let f: Box_<F> = Box_::new(f);
808 connect_raw(
809 self.as_ptr() as *mut _,
810 c"notify::parent".as_ptr() as *const _,
811 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
812 notify_parent_trampoline::<Self, F> as *const (),
813 )),
814 Box_::into_raw(f),
815 )
816 }
817 }
818
819 #[deprecated = "Since 1.10"]
820 #[doc(alias = "priority")]
821 fn connect_priority_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
822 unsafe extern "C" fn notify_priority_trampoline<
823 P: IsA<TimelineElement>,
824 F: Fn(&P) + 'static,
825 >(
826 this: *mut ffi::GESTimelineElement,
827 _param_spec: glib::ffi::gpointer,
828 f: glib::ffi::gpointer,
829 ) {
830 let f: &F = &*(f as *const F);
831 f(TimelineElement::from_glib_borrow(this).unsafe_cast_ref())
832 }
833 unsafe {
834 let f: Box_<F> = Box_::new(f);
835 connect_raw(
836 self.as_ptr() as *mut _,
837 c"notify::priority".as_ptr() as *const _,
838 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
839 notify_priority_trampoline::<Self, F> as *const (),
840 )),
841 Box_::into_raw(f),
842 )
843 }
844 }
845
846 #[doc(alias = "serialize")]
847 fn connect_serialize_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
848 unsafe extern "C" fn notify_serialize_trampoline<
849 P: IsA<TimelineElement>,
850 F: Fn(&P) + 'static,
851 >(
852 this: *mut ffi::GESTimelineElement,
853 _param_spec: glib::ffi::gpointer,
854 f: glib::ffi::gpointer,
855 ) {
856 let f: &F = &*(f as *const F);
857 f(TimelineElement::from_glib_borrow(this).unsafe_cast_ref())
858 }
859 unsafe {
860 let f: Box_<F> = Box_::new(f);
861 connect_raw(
862 self.as_ptr() as *mut _,
863 c"notify::serialize".as_ptr() as *const _,
864 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
865 notify_serialize_trampoline::<Self, F> as *const (),
866 )),
867 Box_::into_raw(f),
868 )
869 }
870 }
871
872 #[doc(alias = "start")]
873 fn connect_start_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
874 unsafe extern "C" fn notify_start_trampoline<
875 P: IsA<TimelineElement>,
876 F: Fn(&P) + 'static,
877 >(
878 this: *mut ffi::GESTimelineElement,
879 _param_spec: glib::ffi::gpointer,
880 f: glib::ffi::gpointer,
881 ) {
882 let f: &F = &*(f as *const F);
883 f(TimelineElement::from_glib_borrow(this).unsafe_cast_ref())
884 }
885 unsafe {
886 let f: Box_<F> = Box_::new(f);
887 connect_raw(
888 self.as_ptr() as *mut _,
889 c"notify::start".as_ptr() as *const _,
890 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
891 notify_start_trampoline::<Self, F> as *const (),
892 )),
893 Box_::into_raw(f),
894 )
895 }
896 }
897
898 #[doc(alias = "timeline")]
899 fn connect_timeline_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
900 unsafe extern "C" fn notify_timeline_trampoline<
901 P: IsA<TimelineElement>,
902 F: Fn(&P) + 'static,
903 >(
904 this: *mut ffi::GESTimelineElement,
905 _param_spec: glib::ffi::gpointer,
906 f: glib::ffi::gpointer,
907 ) {
908 let f: &F = &*(f as *const F);
909 f(TimelineElement::from_glib_borrow(this).unsafe_cast_ref())
910 }
911 unsafe {
912 let f: Box_<F> = Box_::new(f);
913 connect_raw(
914 self.as_ptr() as *mut _,
915 c"notify::timeline".as_ptr() as *const _,
916 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
917 notify_timeline_trampoline::<Self, F> as *const (),
918 )),
919 Box_::into_raw(f),
920 )
921 }
922 }
923}
924
925impl<O: IsA<TimelineElement>> TimelineElementExt for O {}