gstreamer-rs/gstreamer-controller/src/auto/timed_value_control_source.rs

208 lines
6.7 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::Cast;
use glib::object::IsA;
use glib::signal::connect_raw;
use glib::signal::SignalHandlerId;
use glib::translate::*;
use glib_sys;
use gst;
use gst_controller_sys;
use std::boxed::Box as Box_;
use std::mem::transmute;
use ControlPoint;
glib_wrapper! {
pub struct TimedValueControlSource(Object<gst_controller_sys::GstTimedValueControlSource, gst_controller_sys::GstTimedValueControlSourceClass, TimedValueControlSourceClass>) @extends gst::ControlSource, gst::Object;
match fn {
get_type => || gst_controller_sys::gst_timed_value_control_source_get_type(),
}
}
unsafe impl Send for TimedValueControlSource {}
unsafe impl Sync for TimedValueControlSource {}
pub const NONE_TIMED_VALUE_CONTROL_SOURCE: Option<&TimedValueControlSource> = None;
pub trait TimedValueControlSourceExt: 'static {
//fn find_control_point_iter(&self, timestamp: gst::ClockTime) -> /*Ignored*/Option<glib::SequenceIter>;
//fn get_all(&self) -> /*Ignored*/Vec<gst::TimedValue>;
fn get_count(&self) -> i32;
fn set(&self, timestamp: gst::ClockTime, value: f64) -> bool;
//fn set_from_list(&self, timedvalues: /*Ignored*/&[&gst::TimedValue]) -> bool;
fn unset(&self, timestamp: gst::ClockTime) -> bool;
fn unset_all(&self);
fn connect_value_added<F: Fn(&Self, &ControlPoint) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId;
fn connect_value_changed<F: Fn(&Self, &ControlPoint) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId;
fn connect_value_removed<F: Fn(&Self, &ControlPoint) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId;
}
impl<O: IsA<TimedValueControlSource>> TimedValueControlSourceExt for O {
//fn find_control_point_iter(&self, timestamp: gst::ClockTime) -> /*Ignored*/Option<glib::SequenceIter> {
// unsafe { TODO: call gst_controller_sys:gst_timed_value_control_source_find_control_point_iter() }
//}
//fn get_all(&self) -> /*Ignored*/Vec<gst::TimedValue> {
// unsafe { TODO: call gst_controller_sys:gst_timed_value_control_source_get_all() }
//}
fn get_count(&self) -> i32 {
unsafe {
gst_controller_sys::gst_timed_value_control_source_get_count(
self.as_ref().to_glib_none().0,
)
}
}
fn set(&self, timestamp: gst::ClockTime, value: f64) -> bool {
unsafe {
from_glib(gst_controller_sys::gst_timed_value_control_source_set(
self.as_ref().to_glib_none().0,
timestamp.to_glib(),
value,
))
}
}
//fn set_from_list(&self, timedvalues: /*Ignored*/&[&gst::TimedValue]) -> bool {
// unsafe { TODO: call gst_controller_sys:gst_timed_value_control_source_set_from_list() }
//}
fn unset(&self, timestamp: gst::ClockTime) -> bool {
unsafe {
from_glib(gst_controller_sys::gst_timed_value_control_source_unset(
self.as_ref().to_glib_none().0,
timestamp.to_glib(),
))
}
}
fn unset_all(&self) {
unsafe {
gst_controller_sys::gst_timed_value_control_source_unset_all(
self.as_ref().to_glib_none().0,
);
}
}
fn connect_value_added<F: Fn(&Self, &ControlPoint) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn value_added_trampoline<
P,
F: Fn(&P, &ControlPoint) + Send + Sync + 'static,
>(
this: *mut gst_controller_sys::GstTimedValueControlSource,
timed_value: *mut gst_controller_sys::GstControlPoint,
f: glib_sys::gpointer,
) where
P: IsA<TimedValueControlSource>,
{
let f: &F = &*(f as *const F);
f(
&TimedValueControlSource::from_glib_borrow(this).unsafe_cast_ref(),
&from_glib_borrow(timed_value),
)
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"value-added\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
value_added_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
fn connect_value_changed<F: Fn(&Self, &ControlPoint) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn value_changed_trampoline<
P,
F: Fn(&P, &ControlPoint) + Send + Sync + 'static,
>(
this: *mut gst_controller_sys::GstTimedValueControlSource,
timed_value: *mut gst_controller_sys::GstControlPoint,
f: glib_sys::gpointer,
) where
P: IsA<TimedValueControlSource>,
{
let f: &F = &*(f as *const F);
f(
&TimedValueControlSource::from_glib_borrow(this).unsafe_cast_ref(),
&from_glib_borrow(timed_value),
)
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"value-changed\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
value_changed_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
fn connect_value_removed<F: Fn(&Self, &ControlPoint) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn value_removed_trampoline<
P,
F: Fn(&P, &ControlPoint) + Send + Sync + 'static,
>(
this: *mut gst_controller_sys::GstTimedValueControlSource,
timed_value: *mut gst_controller_sys::GstControlPoint,
f: glib_sys::gpointer,
) where
P: IsA<TimedValueControlSource>,
{
let f: &F = &*(f as *const F);
f(
&TimedValueControlSource::from_glib_borrow(this).unsafe_cast_ref(),
&from_glib_borrow(timed_value),
)
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"value-removed\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
value_removed_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
}