2017-11-27 17:16:34 +00:00
|
|
|
// This file was generated by gir (d50d839) from gir-files (???)
|
2017-07-04 22:47:33 +00:00
|
|
|
// DO NOT EDIT
|
|
|
|
|
2017-07-10 21:02:08 +00:00
|
|
|
use Caps;
|
2017-07-04 22:47:33 +00:00
|
|
|
use Element;
|
|
|
|
use Object;
|
2017-07-10 21:02:08 +00:00
|
|
|
use Structure;
|
2017-07-04 22:47:33 +00:00
|
|
|
use ffi;
|
|
|
|
use glib;
|
2017-11-27 17:16:34 +00:00
|
|
|
use glib::StaticType;
|
2017-08-18 13:29:21 +00:00
|
|
|
use glib::Value;
|
2017-07-04 22:47:33 +00:00
|
|
|
use glib::object::Downcast;
|
|
|
|
use glib::object::IsA;
|
2017-09-09 13:01:32 +00:00
|
|
|
use glib::signal::SignalHandlerId;
|
2017-07-04 22:47:33 +00:00
|
|
|
use glib::signal::connect;
|
|
|
|
use glib::translate::*;
|
|
|
|
use glib_ffi;
|
|
|
|
use gobject_ffi;
|
|
|
|
use std::boxed::Box as Box_;
|
2017-07-19 18:41:25 +00:00
|
|
|
use std::mem;
|
2017-07-04 22:47:33 +00:00
|
|
|
use std::mem::transmute;
|
2017-07-19 18:41:25 +00:00
|
|
|
use std::ptr;
|
2017-07-04 22:47:33 +00:00
|
|
|
|
|
|
|
glib_wrapper! {
|
2017-11-09 11:33:40 +00:00
|
|
|
pub struct Device(Object<ffi::GstDevice, ffi::GstDeviceClass>): Object;
|
2017-07-04 22:47:33 +00:00
|
|
|
|
|
|
|
match fn {
|
|
|
|
get_type => || ffi::gst_device_get_type(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
unsafe impl Send for Device {}
|
|
|
|
unsafe impl Sync for Device {}
|
|
|
|
|
|
|
|
pub trait DeviceExt {
|
|
|
|
fn create_element<'a, P: Into<Option<&'a str>>>(&self, name: P) -> Option<Element>;
|
|
|
|
|
2017-07-10 21:02:08 +00:00
|
|
|
fn get_caps(&self) -> Option<Caps>;
|
2017-07-04 22:47:33 +00:00
|
|
|
|
|
|
|
fn get_device_class(&self) -> Option<String>;
|
|
|
|
|
|
|
|
fn get_display_name(&self) -> Option<String>;
|
|
|
|
|
2017-07-10 21:02:08 +00:00
|
|
|
fn get_properties(&self) -> Option<Structure>;
|
|
|
|
|
2017-07-04 22:47:33 +00:00
|
|
|
fn has_classes(&self, classes: &str) -> bool;
|
|
|
|
|
|
|
|
fn has_classesv(&self, classes: &[&str]) -> bool;
|
|
|
|
|
|
|
|
fn reconfigure_element<P: IsA<Element>>(&self, element: &P) -> bool;
|
|
|
|
|
2017-08-18 13:29:21 +00:00
|
|
|
fn get_property_caps(&self) -> Option<Caps>;
|
|
|
|
|
|
|
|
fn get_property_device_class(&self) -> Option<String>;
|
|
|
|
|
|
|
|
fn get_property_display_name(&self) -> Option<String>;
|
|
|
|
|
|
|
|
fn get_property_properties(&self) -> Option<Structure>;
|
|
|
|
|
2017-09-09 13:01:32 +00:00
|
|
|
fn connect_removed<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
|
2017-08-18 13:29:21 +00:00
|
|
|
|
2017-09-09 13:01:32 +00:00
|
|
|
fn connect_property_caps_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
|
2017-08-18 13:29:21 +00:00
|
|
|
|
2017-09-09 13:01:32 +00:00
|
|
|
fn connect_property_device_class_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
|
2017-08-18 13:29:21 +00:00
|
|
|
|
2017-09-09 13:01:32 +00:00
|
|
|
fn connect_property_display_name_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
|
2017-08-18 13:29:21 +00:00
|
|
|
|
2017-09-09 13:01:32 +00:00
|
|
|
fn connect_property_properties_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
|
2017-07-04 22:47:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
impl<O: IsA<Device> + IsA<glib::object::Object>> DeviceExt for O {
|
|
|
|
fn create_element<'a, P: Into<Option<&'a str>>>(&self, name: P) -> Option<Element> {
|
|
|
|
let name = name.into();
|
|
|
|
let name = name.to_glib_none();
|
|
|
|
unsafe {
|
|
|
|
from_glib_full(ffi::gst_device_create_element(self.to_glib_none().0, name.0))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-07-10 21:02:08 +00:00
|
|
|
fn get_caps(&self) -> Option<Caps> {
|
|
|
|
unsafe {
|
|
|
|
from_glib_full(ffi::gst_device_get_caps(self.to_glib_none().0))
|
|
|
|
}
|
|
|
|
}
|
2017-07-04 22:47:33 +00:00
|
|
|
|
|
|
|
fn get_device_class(&self) -> Option<String> {
|
|
|
|
unsafe {
|
|
|
|
from_glib_full(ffi::gst_device_get_device_class(self.to_glib_none().0))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn get_display_name(&self) -> Option<String> {
|
|
|
|
unsafe {
|
|
|
|
from_glib_full(ffi::gst_device_get_display_name(self.to_glib_none().0))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-07-10 21:02:08 +00:00
|
|
|
fn get_properties(&self) -> Option<Structure> {
|
|
|
|
unsafe {
|
|
|
|
from_glib_full(ffi::gst_device_get_properties(self.to_glib_none().0))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-07-04 22:47:33 +00:00
|
|
|
fn has_classes(&self, classes: &str) -> bool {
|
|
|
|
unsafe {
|
|
|
|
from_glib(ffi::gst_device_has_classes(self.to_glib_none().0, classes.to_glib_none().0))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn has_classesv(&self, classes: &[&str]) -> bool {
|
|
|
|
unsafe {
|
|
|
|
from_glib(ffi::gst_device_has_classesv(self.to_glib_none().0, classes.to_glib_none().0))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn reconfigure_element<P: IsA<Element>>(&self, element: &P) -> bool {
|
|
|
|
unsafe {
|
|
|
|
from_glib(ffi::gst_device_reconfigure_element(self.to_glib_none().0, element.to_glib_none().0))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-18 13:29:21 +00:00
|
|
|
fn get_property_caps(&self) -> Option<Caps> {
|
|
|
|
unsafe {
|
2017-11-27 17:16:34 +00:00
|
|
|
let mut value = Value::uninitialized();
|
|
|
|
gobject_ffi::g_value_init(value.to_glib_none_mut().0, <Caps as StaticType>::static_type().to_glib());
|
2017-08-18 13:29:21 +00:00
|
|
|
gobject_ffi::g_object_get_property(self.to_glib_none().0, "caps".to_glib_none().0, value.to_glib_none_mut().0);
|
2017-11-27 17:16:34 +00:00
|
|
|
value.get()
|
2017-08-18 13:29:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn get_property_device_class(&self) -> Option<String> {
|
|
|
|
unsafe {
|
2017-11-27 17:16:34 +00:00
|
|
|
let mut value = Value::uninitialized();
|
|
|
|
gobject_ffi::g_value_init(value.to_glib_none_mut().0, <String as StaticType>::static_type().to_glib());
|
2017-08-18 13:29:21 +00:00
|
|
|
gobject_ffi::g_object_get_property(self.to_glib_none().0, "device-class".to_glib_none().0, value.to_glib_none_mut().0);
|
2017-11-27 17:16:34 +00:00
|
|
|
value.get()
|
2017-08-18 13:29:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn get_property_display_name(&self) -> Option<String> {
|
|
|
|
unsafe {
|
2017-11-27 17:16:34 +00:00
|
|
|
let mut value = Value::uninitialized();
|
|
|
|
gobject_ffi::g_value_init(value.to_glib_none_mut().0, <String as StaticType>::static_type().to_glib());
|
2017-08-18 13:29:21 +00:00
|
|
|
gobject_ffi::g_object_get_property(self.to_glib_none().0, "display-name".to_glib_none().0, value.to_glib_none_mut().0);
|
2017-11-27 17:16:34 +00:00
|
|
|
value.get()
|
2017-08-18 13:29:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn get_property_properties(&self) -> Option<Structure> {
|
|
|
|
unsafe {
|
2017-11-27 17:16:34 +00:00
|
|
|
let mut value = Value::uninitialized();
|
|
|
|
gobject_ffi::g_value_init(value.to_glib_none_mut().0, <Structure as StaticType>::static_type().to_glib());
|
2017-08-18 13:29:21 +00:00
|
|
|
gobject_ffi::g_object_get_property(self.to_glib_none().0, "properties".to_glib_none().0, value.to_glib_none_mut().0);
|
2017-11-27 17:16:34 +00:00
|
|
|
value.get()
|
2017-08-18 13:29:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-09-09 13:01:32 +00:00
|
|
|
fn connect_removed<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
|
2017-07-04 22:47:33 +00:00
|
|
|
unsafe {
|
|
|
|
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
|
|
|
|
connect(self.to_glib_none().0, "removed",
|
|
|
|
transmute(removed_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
|
|
|
|
}
|
|
|
|
}
|
2017-08-18 13:29:21 +00:00
|
|
|
|
2017-09-09 13:01:32 +00:00
|
|
|
fn connect_property_caps_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
|
2017-08-18 13:29:21 +00:00
|
|
|
unsafe {
|
|
|
|
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
|
|
|
|
connect(self.to_glib_none().0, "notify::caps",
|
|
|
|
transmute(notify_caps_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-09-09 13:01:32 +00:00
|
|
|
fn connect_property_device_class_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
|
2017-08-18 13:29:21 +00:00
|
|
|
unsafe {
|
|
|
|
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
|
|
|
|
connect(self.to_glib_none().0, "notify::device-class",
|
|
|
|
transmute(notify_device_class_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-09-09 13:01:32 +00:00
|
|
|
fn connect_property_display_name_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
|
2017-08-18 13:29:21 +00:00
|
|
|
unsafe {
|
|
|
|
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
|
|
|
|
connect(self.to_glib_none().0, "notify::display-name",
|
|
|
|
transmute(notify_display_name_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-09-09 13:01:32 +00:00
|
|
|
fn connect_property_properties_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
|
2017-08-18 13:29:21 +00:00
|
|
|
unsafe {
|
|
|
|
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
|
|
|
|
connect(self.to_glib_none().0, "notify::properties",
|
|
|
|
transmute(notify_properties_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
|
|
|
|
}
|
|
|
|
}
|
2017-07-04 22:47:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
unsafe extern "C" fn removed_trampoline<P>(this: *mut ffi::GstDevice, f: glib_ffi::gpointer)
|
|
|
|
where P: IsA<Device> {
|
|
|
|
callback_guard!();
|
2017-08-03 18:56:39 +00:00
|
|
|
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
|
2017-09-09 13:01:32 +00:00
|
|
|
f(&Device::from_glib_borrow(this).downcast_unchecked())
|
2017-07-04 22:47:33 +00:00
|
|
|
}
|
2017-08-18 13:29:21 +00:00
|
|
|
|
|
|
|
unsafe extern "C" fn notify_caps_trampoline<P>(this: *mut ffi::GstDevice, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
|
|
|
|
where P: IsA<Device> {
|
|
|
|
callback_guard!();
|
|
|
|
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
|
2017-09-09 13:01:32 +00:00
|
|
|
f(&Device::from_glib_borrow(this).downcast_unchecked())
|
2017-08-18 13:29:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
unsafe extern "C" fn notify_device_class_trampoline<P>(this: *mut ffi::GstDevice, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
|
|
|
|
where P: IsA<Device> {
|
|
|
|
callback_guard!();
|
|
|
|
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
|
2017-09-09 13:01:32 +00:00
|
|
|
f(&Device::from_glib_borrow(this).downcast_unchecked())
|
2017-08-18 13:29:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
unsafe extern "C" fn notify_display_name_trampoline<P>(this: *mut ffi::GstDevice, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
|
|
|
|
where P: IsA<Device> {
|
|
|
|
callback_guard!();
|
|
|
|
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
|
2017-09-09 13:01:32 +00:00
|
|
|
f(&Device::from_glib_borrow(this).downcast_unchecked())
|
2017-08-18 13:29:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
unsafe extern "C" fn notify_properties_trampoline<P>(this: *mut ffi::GstDevice, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
|
|
|
|
where P: IsA<Device> {
|
|
|
|
callback_guard!();
|
|
|
|
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
|
2017-09-09 13:01:32 +00:00
|
|
|
f(&Device::from_glib_borrow(this).downcast_unchecked())
|
2017-08-18 13:29:21 +00:00
|
|
|
}
|