device.rs 7.97 KB
Newer Older
1
// This file was generated by gir (6a48033) from gir-files (???)
2 3
// DO NOT EDIT

Sebastian Dröge's avatar
Sebastian Dröge committed
4
use Caps;
5 6
use Element;
use Object;
Sebastian Dröge's avatar
Sebastian Dröge committed
7
use Structure;
8 9
use ffi;
use glib;
10
use glib::Value;
11 12
use glib::object::Downcast;
use glib::object::IsA;
13
use glib::signal::SignalHandlerId;
14 15 16 17 18
use glib::signal::connect;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use std::boxed::Box as Box_;
19
use std::mem;
20
use std::mem::transmute;
21
use std::ptr;
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36

glib_wrapper! {
    pub struct Device(Object<ffi::GstDevice>): Object;

    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>;

Sebastian Dröge's avatar
Sebastian Dröge committed
37
    fn get_caps(&self) -> Option<Caps>;
38 39 40 41 42

    fn get_device_class(&self) -> Option<String>;

    fn get_display_name(&self) -> Option<String>;

Sebastian Dröge's avatar
Sebastian Dröge committed
43 44
    fn get_properties(&self) -> Option<Structure>;

45 46 47 48 49 50
    fn has_classes(&self, classes: &str) -> bool;

    fn has_classesv(&self, classes: &[&str]) -> bool;

    fn reconfigure_element<P: IsA<Element>>(&self, element: &P) -> bool;

51 52 53 54 55 56 57 58
    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>;

59
    fn connect_removed<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
60

61
    fn connect_property_caps_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
62

63
    fn connect_property_device_class_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
64

65
    fn connect_property_display_name_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
66

67
    fn connect_property_properties_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
68 69 70 71 72 73 74 75 76 77 78
}

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))
        }
    }

Sebastian Dröge's avatar
Sebastian Dröge committed
79 80 81 82 83
    fn get_caps(&self) -> Option<Caps> {
        unsafe {
            from_glib_full(ffi::gst_device_get_caps(self.to_glib_none().0))
        }
    }
84 85 86 87 88 89 90 91 92 93 94 95 96

    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))
        }
    }

Sebastian Dröge's avatar
Sebastian Dröge committed
97 98 99 100 101 102
    fn get_properties(&self) -> Option<Structure> {
        unsafe {
            from_glib_full(ffi::gst_device_get_properties(self.to_glib_none().0))
        }
    }

103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
    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))
        }
    }

121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
    fn get_property_caps(&self) -> Option<Caps> {
        let mut value = Value::from(None::<&Caps>);
        unsafe {
            gobject_ffi::g_object_get_property(self.to_glib_none().0, "caps".to_glib_none().0, value.to_glib_none_mut().0);
        }
        value.get()
    }

    fn get_property_device_class(&self) -> Option<String> {
        let mut value = Value::from(None::<&str>);
        unsafe {
            gobject_ffi::g_object_get_property(self.to_glib_none().0, "device-class".to_glib_none().0, value.to_glib_none_mut().0);
        }
        value.get()
    }

    fn get_property_display_name(&self) -> Option<String> {
        let mut value = Value::from(None::<&str>);
        unsafe {
            gobject_ffi::g_object_get_property(self.to_glib_none().0, "display-name".to_glib_none().0, value.to_glib_none_mut().0);
        }
        value.get()
    }

    fn get_property_properties(&self) -> Option<Structure> {
        let mut value = Value::from(None::<&Structure>);
        unsafe {
            gobject_ffi::g_object_get_property(self.to_glib_none().0, "properties".to_glib_none().0, value.to_glib_none_mut().0);
        }
        value.get()
    }

153
    fn connect_removed<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
154 155 156 157 158 159
        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 _)
        }
    }
160

161
    fn connect_property_caps_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
162 163 164 165 166 167 168
        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 _)
        }
    }

169
    fn connect_property_device_class_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
170 171 172 173 174 175 176
        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 _)
        }
    }

177
    fn connect_property_display_name_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
178 179 180 181 182 183 184
        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 _)
        }
    }

185
    fn connect_property_properties_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
186 187 188 189 190 191
        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 _)
        }
    }
192 193 194 195 196
}

unsafe extern "C" fn removed_trampoline<P>(this: *mut ffi::GstDevice, f: glib_ffi::gpointer)
where P: IsA<Device> {
    callback_guard!();
197
    let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
198
    f(&Device::from_glib_borrow(this).downcast_unchecked())
199
}
200 201 202 203 204

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);
205
    f(&Device::from_glib_borrow(this).downcast_unchecked())
206 207 208 209 210 211
}

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);
212
    f(&Device::from_glib_borrow(this).downcast_unchecked())
213 214 215 216 217 218
}

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);
219
    f(&Device::from_glib_borrow(this).downcast_unchecked())
220 221 222 223 224 225
}

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);
226
    f(&Device::from_glib_borrow(this).downcast_unchecked())
227
}