gstreamer-rs/gstreamer/src/auto/clock.rs
Sebastian Dröge 15b08a4293 Initial commit
Requires
  https://github.com/gtk-rs/gir/pull/365
  https://github.com/gtk-rs/gir/pull/364
to be merged for autogeneration of the bindings.

Requires
  https://github.com/gtk-rs/gir/issues/367
for fixing memory leaks.
2017-05-12 14:24:03 +02:00

324 lines
11 KiB
Rust

// This file was generated by gir (57b38ba) from gir-files (???)
// DO NOT EDIT
use ClockTime;
use Object;
use ffi;
use glib;
use glib::Value;
#[cfg(feature = "v1_6")]
use glib::object::Downcast;
use glib::object::IsA;
#[cfg(feature = "v1_6")]
use glib::signal::connect;
use glib::translate::*;
#[cfg(feature = "v1_6")]
use glib_ffi;
use gobject_ffi;
#[cfg(feature = "v1_6")]
use std::boxed::Box as Box_;
use std::mem;
#[cfg(feature = "v1_6")]
use std::mem::transmute;
use std::ptr;
glib_wrapper! {
pub struct Clock(Object<ffi::GstClock>): Object;
match fn {
get_type => || ffi::gst_clock_get_type(),
}
}
impl Clock {
//pub fn id_compare_func<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>, Q: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(id1: P, id2: Q) -> i32 {
// unsafe { TODO: call ffi::gst_clock_id_compare_func() }
//}
//pub fn id_get_time(id: /*Unimplemented*/ClockID) -> ClockTime {
// unsafe { TODO: call ffi::gst_clock_id_get_time() }
//}
//pub fn id_ref(id: /*Unimplemented*/ClockID) -> /*Unimplemented*/Option<ClockID> {
// unsafe { TODO: call ffi::gst_clock_id_ref() }
//}
//pub fn id_unref(id: /*Unimplemented*/ClockID) {
// unsafe { TODO: call ffi::gst_clock_id_unref() }
//}
//pub fn id_unschedule(id: /*Unimplemented*/ClockID) {
// unsafe { TODO: call ffi::gst_clock_id_unschedule() }
//}
//pub fn id_wait(id: /*Unimplemented*/ClockID) -> (/*Ignored*/ClockReturn, ClockTimeDiff) {
// unsafe { TODO: call ffi::gst_clock_id_wait() }
//}
//pub fn id_wait_async<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(id: /*Unimplemented*/ClockID, func: /*Unknown conversion*//*Unimplemented*/ClockCallback, user_data: P, destroy_data: /*Unknown conversion*//*Unimplemented*/DestroyNotify) -> /*Ignored*/ClockReturn {
// unsafe { TODO: call ffi::gst_clock_id_wait_async() }
//}
}
pub trait ClockExt {
fn add_observation(&self, slave: ClockTime, master: ClockTime) -> Option<f64>;
#[cfg(feature = "v1_6")]
fn add_observation_unapplied(&self, slave: ClockTime, master: ClockTime) -> Option<(f64, ClockTime, ClockTime, ClockTime, ClockTime)>;
fn adjust_unlocked(&self, internal: ClockTime) -> ClockTime;
#[cfg(feature = "v1_6")]
fn adjust_with_calibration(&self, internal_target: ClockTime, cinternal: ClockTime, cexternal: ClockTime, cnum: ClockTime, cdenom: ClockTime) -> ClockTime;
fn get_calibration(&self) -> (ClockTime, ClockTime, ClockTime, ClockTime);
fn get_internal_time(&self) -> ClockTime;
fn get_master(&self) -> Option<Clock>;
fn get_resolution(&self) -> ClockTime;
fn get_time(&self) -> ClockTime;
fn get_timeout(&self) -> ClockTime;
#[cfg(feature = "v1_6")]
fn is_synced(&self) -> bool;
//fn new_periodic_id(&self, start_time: ClockTime, interval: ClockTime) -> /*Unimplemented*/Option<ClockID>;
//fn new_single_shot_id(&self, time: ClockTime) -> /*Unimplemented*/Option<ClockID>;
//fn periodic_id_reinit(&self, id: /*Unimplemented*/ClockID, start_time: ClockTime, interval: ClockTime) -> bool;
fn set_calibration(&self, internal: ClockTime, external: ClockTime, rate_num: ClockTime, rate_denom: ClockTime);
fn set_master<'a, P: IsA<Clock> + 'a, Q: Into<Option<&'a P>>>(&self, master: Q) -> bool;
fn set_resolution(&self, resolution: ClockTime) -> ClockTime;
#[cfg(feature = "v1_6")]
fn set_synced(&self, synced: bool);
fn set_timeout(&self, timeout: ClockTime);
//fn single_shot_id_reinit(&self, id: /*Unimplemented*/ClockID, time: ClockTime) -> bool;
fn unadjust_unlocked(&self, external: ClockTime) -> ClockTime;
#[cfg(feature = "v1_8")]
fn unadjust_with_calibration(&self, external_target: ClockTime, cinternal: ClockTime, cexternal: ClockTime, cnum: ClockTime, cdenom: ClockTime) -> ClockTime;
#[cfg(feature = "v1_6")]
fn wait_for_sync(&self, timeout: ClockTime) -> bool;
fn get_property_window_size(&self) -> i32;
fn set_property_window_size(&self, window_size: i32);
fn get_property_window_threshold(&self) -> i32;
fn set_property_window_threshold(&self, window_threshold: i32);
#[cfg(feature = "v1_6")]
fn connect_synced<F: Fn(&Self, bool) + 'static>(&self, f: F) -> u64;
}
impl<O: IsA<Clock> + IsA<glib::object::Object>> ClockExt for O {
fn add_observation(&self, slave: ClockTime, master: ClockTime) -> Option<f64> {
unsafe {
let mut r_squared = mem::uninitialized();
let ret = from_glib(ffi::gst_clock_add_observation(self.to_glib_none().0, slave, master, &mut r_squared));
if ret { Some(r_squared) } else { None }
}
}
#[cfg(feature = "v1_6")]
fn add_observation_unapplied(&self, slave: ClockTime, master: ClockTime) -> Option<(f64, ClockTime, ClockTime, ClockTime, ClockTime)> {
unsafe {
let mut r_squared = mem::uninitialized();
let mut internal = mem::uninitialized();
let mut external = mem::uninitialized();
let mut rate_num = mem::uninitialized();
let mut rate_denom = mem::uninitialized();
let ret = from_glib(ffi::gst_clock_add_observation_unapplied(self.to_glib_none().0, slave, master, &mut r_squared, &mut internal, &mut external, &mut rate_num, &mut rate_denom));
if ret { Some((r_squared, internal, external, rate_num, rate_denom)) } else { None }
}
}
fn adjust_unlocked(&self, internal: ClockTime) -> ClockTime {
unsafe {
ffi::gst_clock_adjust_unlocked(self.to_glib_none().0, internal)
}
}
#[cfg(feature = "v1_6")]
fn adjust_with_calibration(&self, internal_target: ClockTime, cinternal: ClockTime, cexternal: ClockTime, cnum: ClockTime, cdenom: ClockTime) -> ClockTime {
unsafe {
ffi::gst_clock_adjust_with_calibration(self.to_glib_none().0, internal_target, cinternal, cexternal, cnum, cdenom)
}
}
fn get_calibration(&self) -> (ClockTime, ClockTime, ClockTime, ClockTime) {
unsafe {
let mut internal = mem::uninitialized();
let mut external = mem::uninitialized();
let mut rate_num = mem::uninitialized();
let mut rate_denom = mem::uninitialized();
ffi::gst_clock_get_calibration(self.to_glib_none().0, &mut internal, &mut external, &mut rate_num, &mut rate_denom);
(internal, external, rate_num, rate_denom)
}
}
fn get_internal_time(&self) -> ClockTime {
unsafe {
ffi::gst_clock_get_internal_time(self.to_glib_none().0)
}
}
fn get_master(&self) -> Option<Clock> {
unsafe {
from_glib_full(ffi::gst_clock_get_master(self.to_glib_none().0))
}
}
fn get_resolution(&self) -> ClockTime {
unsafe {
ffi::gst_clock_get_resolution(self.to_glib_none().0)
}
}
fn get_time(&self) -> ClockTime {
unsafe {
ffi::gst_clock_get_time(self.to_glib_none().0)
}
}
fn get_timeout(&self) -> ClockTime {
unsafe {
ffi::gst_clock_get_timeout(self.to_glib_none().0)
}
}
#[cfg(feature = "v1_6")]
fn is_synced(&self) -> bool {
unsafe {
from_glib(ffi::gst_clock_is_synced(self.to_glib_none().0))
}
}
//fn new_periodic_id(&self, start_time: ClockTime, interval: ClockTime) -> /*Unimplemented*/Option<ClockID> {
// unsafe { TODO: call ffi::gst_clock_new_periodic_id() }
//}
//fn new_single_shot_id(&self, time: ClockTime) -> /*Unimplemented*/Option<ClockID> {
// unsafe { TODO: call ffi::gst_clock_new_single_shot_id() }
//}
//fn periodic_id_reinit(&self, id: /*Unimplemented*/ClockID, start_time: ClockTime, interval: ClockTime) -> bool {
// unsafe { TODO: call ffi::gst_clock_periodic_id_reinit() }
//}
fn set_calibration(&self, internal: ClockTime, external: ClockTime, rate_num: ClockTime, rate_denom: ClockTime) {
unsafe {
ffi::gst_clock_set_calibration(self.to_glib_none().0, internal, external, rate_num, rate_denom);
}
}
fn set_master<'a, P: IsA<Clock> + 'a, Q: Into<Option<&'a P>>>(&self, master: Q) -> bool {
let master = master.into();
let master = master.to_glib_none();
unsafe {
from_glib(ffi::gst_clock_set_master(self.to_glib_none().0, master.0))
}
}
fn set_resolution(&self, resolution: ClockTime) -> ClockTime {
unsafe {
ffi::gst_clock_set_resolution(self.to_glib_none().0, resolution)
}
}
#[cfg(feature = "v1_6")]
fn set_synced(&self, synced: bool) {
unsafe {
ffi::gst_clock_set_synced(self.to_glib_none().0, synced.to_glib());
}
}
fn set_timeout(&self, timeout: ClockTime) {
unsafe {
ffi::gst_clock_set_timeout(self.to_glib_none().0, timeout);
}
}
//fn single_shot_id_reinit(&self, id: /*Unimplemented*/ClockID, time: ClockTime) -> bool {
// unsafe { TODO: call ffi::gst_clock_single_shot_id_reinit() }
//}
fn unadjust_unlocked(&self, external: ClockTime) -> ClockTime {
unsafe {
ffi::gst_clock_unadjust_unlocked(self.to_glib_none().0, external)
}
}
#[cfg(feature = "v1_8")]
fn unadjust_with_calibration(&self, external_target: ClockTime, cinternal: ClockTime, cexternal: ClockTime, cnum: ClockTime, cdenom: ClockTime) -> ClockTime {
unsafe {
ffi::gst_clock_unadjust_with_calibration(self.to_glib_none().0, external_target, cinternal, cexternal, cnum, cdenom)
}
}
#[cfg(feature = "v1_6")]
fn wait_for_sync(&self, timeout: ClockTime) -> bool {
unsafe {
from_glib(ffi::gst_clock_wait_for_sync(self.to_glib_none().0, timeout))
}
}
fn get_property_window_size(&self) -> i32 {
let mut value = Value::from(&0);
unsafe {
gobject_ffi::g_object_get_property(self.to_glib_none().0, "window-size".to_glib_none().0, value.to_glib_none_mut().0);
}
value.get().unwrap()
}
fn set_property_window_size(&self, window_size: i32) {
unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, "window-size".to_glib_none().0, Value::from(&window_size).to_glib_none().0);
}
}
fn get_property_window_threshold(&self) -> i32 {
let mut value = Value::from(&0);
unsafe {
gobject_ffi::g_object_get_property(self.to_glib_none().0, "window-threshold".to_glib_none().0, value.to_glib_none_mut().0);
}
value.get().unwrap()
}
fn set_property_window_threshold(&self, window_threshold: i32) {
unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, "window-threshold".to_glib_none().0, Value::from(&window_threshold).to_glib_none().0);
}
}
#[cfg(feature = "v1_6")]
fn connect_synced<F: Fn(&Self, bool) + 'static>(&self, f: F) -> u64 {
unsafe {
let f: Box_<Box_<Fn(&Self, bool) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "synced",
transmute(synced_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
}
#[cfg(feature = "v1_6")]
unsafe extern "C" fn synced_trampoline<P>(this: *mut ffi::GstClock, synced: glib_ffi::gboolean, f: glib_ffi::gpointer)
where P: IsA<Clock> {
callback_guard!();
let f: &Box_<Fn(&P, bool) + 'static> = transmute(f);
f(&Clock::from_glib_none(this).downcast_unchecked(), from_glib(synced))
}