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    /// An internal structure for value+time and various temporary
9    /// values used for interpolation. This "inherits" from
10    /// GstTimedValue.
11    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
12    #[doc(alias = "GstControlPoint")]
13    pub struct ControlPoint(Boxed<ffi::GstControlPoint>);
14
15    match fn {
16        copy => |ptr| ffi::gst_control_point_copy(mut_override(ptr)),
17        free => |ptr| ffi::gst_control_point_free(ptr),
18        type_ => || ffi::gst_control_point_get_type(),
19    }
20}
21
22impl ControlPoint {
23    pub fn timestamp(&self) -> gst::ClockTime {
24        unsafe { try_from_glib((*self.as_ptr()).timestamp).expect("undefined timestamp") }
25    }
26
27    pub fn value(&self) -> f64 {
28        unsafe { (*self.as_ptr()).value }
29    }
30}
31
32unsafe impl Send for ControlPoint {}
33unsafe impl Sync for ControlPoint {}