gstreamer/auto/
control_source.rs1use crate::{ffi, ClockTime, Object};
7use glib::{prelude::*, translate::*};
8
9glib::wrapper! {
10 #[doc(alias = "GstControlSource")]
11 pub struct ControlSource(Object<ffi::GstControlSource, ffi::GstControlSourceClass>) @extends Object;
12
13 match fn {
14 type_ => || ffi::gst_control_source_get_type(),
15 }
16}
17
18impl ControlSource {
19 pub const NONE: Option<&'static ControlSource> = None;
20}
21
22unsafe impl Send for ControlSource {}
23unsafe impl Sync for ControlSource {}
24
25pub trait ControlSourceExt: IsA<ControlSource> + 'static {
26 #[doc(alias = "gst_control_source_get_value")]
27 #[doc(alias = "control_source_get_value")]
28 fn value(&self, timestamp: ClockTime) -> Option<f64> {
29 unsafe {
30 let mut value = std::mem::MaybeUninit::uninit();
31 let ret = from_glib(ffi::gst_control_source_get_value(
32 self.as_ref().to_glib_none().0,
33 timestamp.into_glib(),
34 value.as_mut_ptr(),
35 ));
36 if ret {
37 Some(value.assume_init())
38 } else {
39 None
40 }
41 }
42 }
43}
44
45impl<O: IsA<ControlSource>> ControlSourceExt for O {}