gstreamer-rs/gstreamer/src/auto/device_provider.rs

168 lines
5.6 KiB
Rust
Raw Normal View History

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 glib;
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;
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
}
}
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;
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-04-23 14:32:09 +00:00
#[cfg(any(feature = "v1_16", feature = "dox"))]
fn device_changed<P: IsA<Device>, Q: IsA<Device>>(&self, device: &P, changed_device: &Q);
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
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>;
fn get_hidden_providers(&self) -> Vec<GString>;
2017-07-04 22:47:33 +00:00
fn hide_provider(&self, name: &str);
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
}
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-04-23 14:32:09 +00:00
#[cfg(any(feature = "v1_16", feature = "dox"))]
fn device_changed<P: IsA<Device>, Q: IsA<Device>>(&self, device: &P, changed_device: &Q) {
unsafe {
gst_sys::gst_device_provider_device_changed(self.as_ref().to_glib_none().0, device.as_ref().to_glib_none().0, changed_device.as_ref().to_glib_none().0);
}
}
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
}
}
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
}
}
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
}
}
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
}