mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-12 04:22:09 +00:00
47 lines
1.3 KiB
Rust
47 lines
1.3 KiB
Rust
|
// 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
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|