Skip to main content

gstreamer_editing_services/
timeline_element.rs

1use glib::translate::*;
2
3use crate::prelude::*;
4use crate::{TimelineElement, ffi};
5
6pub trait TimelineElementExtManual: IsA<TimelineElement> + 'static {
7    #[doc(alias = "ges_timeline_element_set_child_property")]
8    fn set_child_property(
9        &self,
10        property_name: &str,
11        value: impl Into<glib::Value>,
12    ) -> Result<(), glib::error::BoolError> {
13        self.set_child_property_by_pspec(
14            self.as_ref()
15                .lookup_child(property_name)
16                .ok_or_else(|| glib::bool_error!("No such child property: {property_name}"))?
17                .1,
18            value,
19        );
20
21        Ok(())
22    }
23
24    #[doc(alias = "ges_timeline_element_set_child_property_by_pspec")]
25    fn set_child_property_by_pspec(
26        &self,
27        pspec: impl AsRef<glib::ParamSpec>,
28        value: impl Into<glib::Value>,
29    ) {
30        unsafe {
31            ffi::ges_timeline_element_set_child_property_by_pspec(
32                self.as_ref().to_glib_none().0,
33                pspec.as_ref().to_glib_none().0,
34                value.into().to_glib_none().0,
35            );
36        }
37    }
38}
39
40impl<O: IsA<TimelineElement>> TimelineElementExtManual for O {}