gstreamer/auto/
control_source.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
4// DO NOT EDIT
5
6use 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
25mod sealed {
26    pub trait Sealed {}
27    impl<T: super::IsA<super::ControlSource>> Sealed for T {}
28}
29
30pub trait ControlSourceExt: IsA<ControlSource> + sealed::Sealed + 'static {
31    #[doc(alias = "gst_control_source_get_value")]
32    #[doc(alias = "control_source_get_value")]
33    fn value(&self, timestamp: ClockTime) -> Option<f64> {
34        unsafe {
35            let mut value = std::mem::MaybeUninit::uninit();
36            let ret = from_glib(ffi::gst_control_source_get_value(
37                self.as_ref().to_glib_none().0,
38                timestamp.into_glib(),
39                value.as_mut_ptr(),
40            ));
41            if ret {
42                Some(value.assume_init())
43            } else {
44                None
45            }
46        }
47    }
48}
49
50impl<O: IsA<ControlSource>> ControlSourceExt for O {}