gstreamer-rs/gstreamer/src/auto/control_source.rs

47 lines
1.3 KiB
Rust
Raw Normal View History

2020-06-09 01:06:49 +00:00
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use glib::object::IsA;
use glib::translate::*;
use gst_sys;
use std::mem;
use ClockTime;
use Object;
glib_wrapper! {
pub struct ControlSource(Object<gst_sys::GstControlSource, gst_sys::GstControlSourceClass, ControlSourceClass>) @extends Object;
match fn {
get_type => || gst_sys::gst_control_source_get_type(),
}
}
unsafe impl Send for ControlSource {}
unsafe impl Sync for ControlSource {}
pub const NONE_CONTROL_SOURCE: Option<&ControlSource> = None;
pub trait ControlSourceExt: 'static {
fn get_value(&self, timestamp: ClockTime) -> Option<f64>;
}
impl<O: IsA<ControlSource>> ControlSourceExt for O {
fn get_value(&self, timestamp: ClockTime) -> Option<f64> {
unsafe {
let mut value = mem::MaybeUninit::uninit();
let ret = from_glib(gst_sys::gst_control_source_get_value(
self.as_ref().to_glib_none().0,
timestamp.to_glib(),
value.as_mut_ptr(),
));
let value = value.assume_init();
if ret {
Some(value)
} else {
None
}
}
}
}