// 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 Bus; use Device; use DeviceProviderFactory; use Object; use Plugin; use glib; use glib::GString; use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; use glib::translate::*; use glib_sys; use gst_sys; use libc; use std::boxed::Box as Box_; use std::mem::transmute; glib_wrapper! { pub struct DeviceProvider(Object) @extends Object; match fn { get_type => || gst_sys::gst_device_provider_get_type(), } } impl DeviceProvider { pub fn register(plugin: Option<&Plugin>, name: &str, rank: u32, type_: glib::types::Type) -> Result<(), glib::error::BoolError> { assert_initialized_main_thread!(); unsafe { glib_result_from_gboolean!(gst_sys::gst_device_provider_register(plugin.to_glib_none().0, name.to_glib_none().0, rank, type_.to_glib()), "Failed to register device provider factory") } } } unsafe impl Send for DeviceProvider {} unsafe impl Sync for DeviceProvider {} pub const NONE_DEVICE_PROVIDER: Option<&DeviceProvider> = None; pub trait DeviceProviderExt: 'static { fn can_monitor(&self) -> bool; fn device_add>(&self, device: &P); fn device_remove>(&self, device: &P); fn get_bus(&self) -> Bus; fn get_devices(&self) -> Vec; fn get_factory(&self) -> Option; fn get_hidden_providers(&self) -> Vec; fn hide_provider(&self, name: &str); fn start(&self) -> Result<(), glib::error::BoolError>; fn stop(&self); fn unhide_provider(&self, name: &str); fn connect_provider_hidden(&self, f: F) -> SignalHandlerId; fn connect_provider_unhidden(&self, f: F) -> SignalHandlerId; } impl> DeviceProviderExt for O { fn can_monitor(&self) -> bool { unsafe { from_glib(gst_sys::gst_device_provider_can_monitor(self.as_ref().to_glib_none().0)) } } fn device_add>(&self, device: &P) { unsafe { gst_sys::gst_device_provider_device_add(self.as_ref().to_glib_none().0, device.as_ref().to_glib_none().0); } } fn device_remove>(&self, device: &P) { unsafe { gst_sys::gst_device_provider_device_remove(self.as_ref().to_glib_none().0, device.as_ref().to_glib_none().0); } } fn get_bus(&self) -> Bus { unsafe { from_glib_full(gst_sys::gst_device_provider_get_bus(self.as_ref().to_glib_none().0)) } } fn get_devices(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_full(gst_sys::gst_device_provider_get_devices(self.as_ref().to_glib_none().0)) } } fn get_factory(&self) -> Option { unsafe { from_glib_none(gst_sys::gst_device_provider_get_factory(self.as_ref().to_glib_none().0)) } } fn get_hidden_providers(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_full(gst_sys::gst_device_provider_get_hidden_providers(self.as_ref().to_glib_none().0)) } } fn hide_provider(&self, name: &str) { unsafe { gst_sys::gst_device_provider_hide_provider(self.as_ref().to_glib_none().0, name.to_glib_none().0); } } fn start(&self) -> Result<(), glib::error::BoolError> { unsafe { glib_result_from_gboolean!(gst_sys::gst_device_provider_start(self.as_ref().to_glib_none().0), "Failed to start") } } fn stop(&self) { unsafe { gst_sys::gst_device_provider_stop(self.as_ref().to_glib_none().0); } } fn unhide_provider(&self, name: &str) { unsafe { gst_sys::gst_device_provider_unhide_provider(self.as_ref().to_glib_none().0, name.to_glib_none().0); } } fn connect_provider_hidden(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"provider-hidden\0".as_ptr() as *const _, Some(transmute(provider_hidden_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_provider_unhidden(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"provider-unhidden\0".as_ptr() as *const _, Some(transmute(provider_unhidden_trampoline:: as usize)), Box_::into_raw(f)) } } } unsafe extern "C" fn provider_hidden_trampoline(this: *mut gst_sys::GstDeviceProvider, object: *mut libc::c_char, f: glib_sys::gpointer) where P: IsA { let f: &F = &*(f as *const F); f(&DeviceProvider::from_glib_borrow(this).unsafe_cast(), &GString::from_glib_borrow(object)) } unsafe extern "C" fn provider_unhidden_trampoline(this: *mut gst_sys::GstDeviceProvider, object: *mut libc::c_char, f: glib_sys::gpointer) where P: IsA { let f: &F = &*(f as *const F); f(&DeviceProvider::from_glib_borrow(this).unsafe_cast(), &GString::from_glib_borrow(object)) }