gstreamer_controller/
control_point.rs

1// Take a look at the license at the top of the repository in the LICENSE file.
2
3use glib::translate::*;
4
5use crate::ffi;
6
7glib::wrapper! {
8    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
9    #[doc(alias = "GstControlPoint")]
10    pub struct ControlPoint(Boxed<ffi::GstControlPoint>);
11
12    match fn {
13        copy => |ptr| ffi::gst_control_point_copy(mut_override(ptr)),
14        free => |ptr| ffi::gst_control_point_free(ptr),
15        type_ => || ffi::gst_control_point_get_type(),
16    }
17}
18
19impl ControlPoint {
20    pub fn timestamp(&self) -> gst::ClockTime {
21        unsafe { try_from_glib((*self.as_ptr()).timestamp).expect("undefined timestamp") }
22    }
23
24    pub fn value(&self) -> f64 {
25        unsafe { (*self.as_ptr()).value }
26    }
27}
28
29unsafe impl Send for ControlPoint {}
30unsafe impl Sync for ControlPoint {}