device_provider_factory.rs 2.77 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
// This file was generated by gir (33e9567) from gir-files (???)
// DO NOT EDIT

use DeviceProvider;
use Object;
use ffi;
use glib;
use glib::object::IsA;
use glib::translate::*;

glib_wrapper! {
    pub struct DeviceProviderFactory(Object<ffi::GstDeviceProviderFactory>): Object;

    match fn {
        get_type => || ffi::gst_device_provider_factory_get_type(),
    }
}

impl DeviceProviderFactory {
    pub fn find(name: &str) -> Option<DeviceProviderFactory> {
        unsafe {
            from_glib_full(ffi::gst_device_provider_factory_find(name.to_glib_none().0))
        }
    }

    pub fn get_by_name(factoryname: &str) -> Option<DeviceProvider> {
        unsafe {
            from_glib_full(ffi::gst_device_provider_factory_get_by_name(factoryname.to_glib_none().0))
        }
    }

    //pub fn list_get_device_providers(minrank: /*Ignored*/Rank) -> Vec<DeviceProviderFactory> {
    //    unsafe { TODO: call ffi::gst_device_provider_factory_list_get_device_providers() }
    //}
}

unsafe impl Send for DeviceProviderFactory {}
unsafe impl Sync for DeviceProviderFactory {}

pub trait DeviceProviderFactoryExt {
    fn get(&self) -> Option<DeviceProvider>;

    fn get_device_provider_type(&self) -> glib::types::Type;

    fn get_metadata(&self, key: &str) -> Option<String>;

    fn get_metadata_keys(&self) -> Vec<String>;

    fn has_classes<'a, P: Into<Option<&'a str>>>(&self, classes: P) -> bool;

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

impl<O: IsA<DeviceProviderFactory>> DeviceProviderFactoryExt for O {
    fn get(&self) -> Option<DeviceProvider> {
        unsafe {
            from_glib_full(ffi::gst_device_provider_factory_get(self.to_glib_none().0))
        }
    }

    fn get_device_provider_type(&self) -> glib::types::Type {
        unsafe {
            from_glib(ffi::gst_device_provider_factory_get_device_provider_type(self.to_glib_none().0))
        }
    }

    fn get_metadata(&self, key: &str) -> Option<String> {
        unsafe {
            from_glib_none(ffi::gst_device_provider_factory_get_metadata(self.to_glib_none().0, key.to_glib_none().0))
        }
    }

    fn get_metadata_keys(&self) -> Vec<String> {
        unsafe {
            FromGlibPtrContainer::from_glib_full(ffi::gst_device_provider_factory_get_metadata_keys(self.to_glib_none().0))
        }
    }

    fn has_classes<'a, P: Into<Option<&'a str>>>(&self, classes: P) -> bool {
        let classes = classes.into();
        let classes = classes.to_glib_none();
        unsafe {
            from_glib(ffi::gst_device_provider_factory_has_classes(self.to_glib_none().0, classes.0))
        }
    }

    fn has_classesv(&self, classes: &[&str]) -> bool {
        unsafe {
            from_glib(ffi::gst_device_provider_factory_has_classesv(self.to_glib_none().0, classes.to_glib_none().0))
        }
    }
}