2018-04-23 17:34:22 +00:00
|
|
|
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
|
|
|
// from gir-files (https://github.com/gtk-rs/gir-files)
|
2017-07-04 22:47:33 +00:00
|
|
|
// DO NOT EDIT
|
|
|
|
|
|
|
|
use Bus;
|
|
|
|
use Device;
|
|
|
|
use DeviceProviderFactory;
|
|
|
|
use Object;
|
|
|
|
use Plugin;
|
|
|
|
use glib;
|
2018-12-09 16:06:12 +00:00
|
|
|
use glib::GString;
|
2019-01-16 11:32:39 +00:00
|
|
|
use glib::object::Cast;
|
2017-07-04 22:47:33 +00:00
|
|
|
use glib::object::IsA;
|
2017-09-09 13:01:32 +00:00
|
|
|
use glib::signal::SignalHandlerId;
|
2018-12-08 09:05:20 +00:00
|
|
|
use glib::signal::connect_raw;
|
2017-07-04 22:47:33 +00:00
|
|
|
use glib::translate::*;
|
2019-03-19 07:40:05 +00:00
|
|
|
use glib_sys;
|
|
|
|
use gst_sys;
|
2017-07-04 22:47:33 +00:00
|
|
|
use libc;
|
|
|
|
use std::boxed::Box as Box_;
|
|
|
|
use std::mem::transmute;
|
|
|
|
|
|
|
|
glib_wrapper! {
|
2019-03-19 07:40:05 +00:00
|
|
|
pub struct DeviceProvider(Object<gst_sys::GstDeviceProvider, gst_sys::GstDeviceProviderClass, DeviceProviderClass>) @extends Object;
|
2017-07-04 22:47:33 +00:00
|
|
|
|
|
|
|
match fn {
|
2019-03-19 07:40:05 +00:00
|
|
|
get_type => || gst_sys::gst_device_provider_get_type(),
|
2017-07-04 22:47:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl DeviceProvider {
|
2019-03-19 07:40:05 +00:00
|
|
|
pub fn register(plugin: Option<&Plugin>, name: &str, rank: u32, type_: glib::types::Type) -> Result<(), glib::error::BoolError> {
|
2017-07-10 09:36:15 +00:00
|
|
|
assert_initialized_main_thread!();
|
2017-07-04 22:47:33 +00:00
|
|
|
unsafe {
|
2019-03-19 07:40:05 +00:00
|
|
|
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")
|
2017-07-04 22:47:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
unsafe impl Send for DeviceProvider {}
|
|
|
|
unsafe impl Sync for DeviceProvider {}
|
|
|
|
|
2019-01-16 11:32:39 +00:00
|
|
|
pub const NONE_DEVICE_PROVIDER: Option<&DeviceProvider> = None;
|
|
|
|
|
2018-12-08 09:05:20 +00:00
|
|
|
pub trait DeviceProviderExt: 'static {
|
2017-07-04 22:47:33 +00:00
|
|
|
fn can_monitor(&self) -> bool;
|
|
|
|
|
2019-01-16 11:32:39 +00:00
|
|
|
fn device_add<P: IsA<Device>>(&self, device: &P);
|
2017-07-04 22:47:33 +00:00
|
|
|
|
2019-01-16 11:32:39 +00:00
|
|
|
fn device_remove<P: IsA<Device>>(&self, device: &P);
|
2017-07-04 22:47:33 +00:00
|
|
|
|
2017-12-17 16:29:22 +00:00
|
|
|
fn get_bus(&self) -> Bus;
|
2017-07-04 22:47:33 +00:00
|
|
|
|
|
|
|
fn get_devices(&self) -> Vec<Device>;
|
|
|
|
|
|
|
|
fn get_factory(&self) -> Option<DeviceProviderFactory>;
|
|
|
|
|
2018-12-09 16:06:12 +00:00
|
|
|
fn get_hidden_providers(&self) -> Vec<GString>;
|
2017-07-04 22:47:33 +00:00
|
|
|
|
|
|
|
fn hide_provider(&self, name: &str);
|
|
|
|
|
2017-12-18 07:44:32 +00:00
|
|
|
fn start(&self) -> Result<(), glib::error::BoolError>;
|
2017-07-04 22:47:33 +00:00
|
|
|
|
|
|
|
fn stop(&self);
|
|
|
|
|
|
|
|
fn unhide_provider(&self, name: &str);
|
|
|
|
|
2017-09-09 13:01:32 +00:00
|
|
|
fn connect_provider_hidden<F: Fn(&Self, &str) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
|
2017-07-04 22:47:33 +00:00
|
|
|
|
2017-09-09 13:01:32 +00:00
|
|
|
fn connect_provider_unhidden<F: Fn(&Self, &str) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
|
2017-07-04 22:47:33 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 09:05:20 +00:00
|
|
|
impl<O: IsA<DeviceProvider>> DeviceProviderExt for O {
|
2017-07-04 22:47:33 +00:00
|
|
|
fn can_monitor(&self) -> bool {
|
|
|
|
unsafe {
|
2019-03-19 07:40:05 +00:00
|
|
|
from_glib(gst_sys::gst_device_provider_can_monitor(self.as_ref().to_glib_none().0))
|
2017-07-04 22:47:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-16 11:32:39 +00:00
|
|
|
fn device_add<P: IsA<Device>>(&self, device: &P) {
|
2017-07-04 22:47:33 +00:00
|
|
|
unsafe {
|
2019-03-19 07:40:05 +00:00
|
|
|
gst_sys::gst_device_provider_device_add(self.as_ref().to_glib_none().0, device.as_ref().to_glib_none().0);
|
2017-07-04 22:47:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-16 11:32:39 +00:00
|
|
|
fn device_remove<P: IsA<Device>>(&self, device: &P) {
|
2017-07-04 22:47:33 +00:00
|
|
|
unsafe {
|
2019-03-19 07:40:05 +00:00
|
|
|
gst_sys::gst_device_provider_device_remove(self.as_ref().to_glib_none().0, device.as_ref().to_glib_none().0);
|
2017-07-04 22:47:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-17 16:29:22 +00:00
|
|
|
fn get_bus(&self) -> Bus {
|
2017-07-04 22:47:33 +00:00
|
|
|
unsafe {
|
2019-03-19 07:40:05 +00:00
|
|
|
from_glib_full(gst_sys::gst_device_provider_get_bus(self.as_ref().to_glib_none().0))
|
2017-07-04 22:47:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn get_devices(&self) -> Vec<Device> {
|
|
|
|
unsafe {
|
2019-03-19 07:40:05 +00:00
|
|
|
FromGlibPtrContainer::from_glib_full(gst_sys::gst_device_provider_get_devices(self.as_ref().to_glib_none().0))
|
2017-07-04 22:47:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn get_factory(&self) -> Option<DeviceProviderFactory> {
|
|
|
|
unsafe {
|
2019-03-19 07:40:05 +00:00
|
|
|
from_glib_none(gst_sys::gst_device_provider_get_factory(self.as_ref().to_glib_none().0))
|
2017-07-04 22:47:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-09 16:06:12 +00:00
|
|
|
fn get_hidden_providers(&self) -> Vec<GString> {
|
2017-07-04 22:47:33 +00:00
|
|
|
unsafe {
|
2019-03-19 07:40:05 +00:00
|
|
|
FromGlibPtrContainer::from_glib_full(gst_sys::gst_device_provider_get_hidden_providers(self.as_ref().to_glib_none().0))
|
2017-07-04 22:47:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn hide_provider(&self, name: &str) {
|
|
|
|
unsafe {
|
2019-03-19 07:40:05 +00:00
|
|
|
gst_sys::gst_device_provider_hide_provider(self.as_ref().to_glib_none().0, name.to_glib_none().0);
|
2017-07-04 22:47:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-18 07:44:32 +00:00
|
|
|
fn start(&self) -> Result<(), glib::error::BoolError> {
|
2017-07-04 22:47:33 +00:00
|
|
|
unsafe {
|
2019-03-19 07:40:05 +00:00
|
|
|
glib_result_from_gboolean!(gst_sys::gst_device_provider_start(self.as_ref().to_glib_none().0), "Failed to start")
|
2017-07-04 22:47:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn stop(&self) {
|
|
|
|
unsafe {
|
2019-03-19 07:40:05 +00:00
|
|
|
gst_sys::gst_device_provider_stop(self.as_ref().to_glib_none().0);
|
2017-07-04 22:47:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn unhide_provider(&self, name: &str) {
|
|
|
|
unsafe {
|
2019-03-19 07:40:05 +00:00
|
|
|
gst_sys::gst_device_provider_unhide_provider(self.as_ref().to_glib_none().0, name.to_glib_none().0);
|
2017-07-04 22:47:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-09-09 13:01:32 +00:00
|
|
|
fn connect_provider_hidden<F: Fn(&Self, &str) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
|
2017-07-04 22:47:33 +00:00
|
|
|
unsafe {
|
2019-01-29 13:53:44 +00:00
|
|
|
let f: Box_<F> = Box_::new(f);
|
2019-01-16 11:32:39 +00:00
|
|
|
connect_raw(self.as_ptr() as *mut _, b"provider-hidden\0".as_ptr() as *const _,
|
2019-01-29 13:53:44 +00:00
|
|
|
Some(transmute(provider_hidden_trampoline::<Self, F> as usize)), Box_::into_raw(f))
|
2017-07-04 22:47:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-09-09 13:01:32 +00:00
|
|
|
fn connect_provider_unhidden<F: Fn(&Self, &str) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
|
2017-07-04 22:47:33 +00:00
|
|
|
unsafe {
|
2019-01-29 13:53:44 +00:00
|
|
|
let f: Box_<F> = Box_::new(f);
|
2019-01-16 11:32:39 +00:00
|
|
|
connect_raw(self.as_ptr() as *mut _, b"provider-unhidden\0".as_ptr() as *const _,
|
2019-01-29 13:53:44 +00:00
|
|
|
Some(transmute(provider_unhidden_trampoline::<Self, F> as usize)), Box_::into_raw(f))
|
2017-07-04 22:47:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-03-19 07:40:05 +00:00
|
|
|
unsafe extern "C" fn provider_hidden_trampoline<P, F: Fn(&P, &str) + Send + Sync + 'static>(this: *mut gst_sys::GstDeviceProvider, object: *mut libc::c_char, f: glib_sys::gpointer)
|
2017-07-04 22:47:33 +00:00
|
|
|
where P: IsA<DeviceProvider> {
|
2019-02-22 09:51:17 +00:00
|
|
|
let f: &F = &*(f as *const F);
|
2019-01-16 11:32:39 +00:00
|
|
|
f(&DeviceProvider::from_glib_borrow(this).unsafe_cast(), &GString::from_glib_borrow(object))
|
2017-07-04 22:47:33 +00:00
|
|
|
}
|
|
|
|
|
2019-03-19 07:40:05 +00:00
|
|
|
unsafe extern "C" fn provider_unhidden_trampoline<P, F: Fn(&P, &str) + Send + Sync + 'static>(this: *mut gst_sys::GstDeviceProvider, object: *mut libc::c_char, f: glib_sys::gpointer)
|
2017-07-04 22:47:33 +00:00
|
|
|
where P: IsA<DeviceProvider> {
|
2019-02-22 09:51:17 +00:00
|
|
|
let f: &F = &*(f as *const F);
|
2019-01-16 11:32:39 +00:00
|
|
|
f(&DeviceProvider::from_glib_borrow(this).unsafe_cast(), &GString::from_glib_borrow(object))
|
2017-07-04 22:47:33 +00:00
|
|
|
}
|