gstreamer/auto/
device_provider_factory.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
4// DO NOT EDIT
5
6use crate::{ffi, DeviceProvider, Object, PluginFeature};
7use glib::translate::*;
8
9glib::wrapper! {
10    /// [`DeviceProviderFactory`][crate::DeviceProviderFactory] is used to create instances of device providers. A
11    /// GstDeviceProviderfactory can be added to a [`Plugin`][crate::Plugin] as it is also a
12    /// [`PluginFeature`][crate::PluginFeature].
13    ///
14    /// Use the [`find()`][Self::find()] and
15    /// [`get()`][Self::get()] functions to create device
16    /// provider instances or use [`by_name()`][Self::by_name()] as a
17    /// convenient shortcut.
18    ///
19    /// # Implements
20    ///
21    /// [`PluginFeatureExt`][trait@crate::prelude::PluginFeatureExt], [`GstObjectExt`][trait@crate::prelude::GstObjectExt], [`trait@glib::ObjectExt`], [`PluginFeatureExtManual`][trait@crate::prelude::PluginFeatureExtManual]
22    #[doc(alias = "GstDeviceProviderFactory")]
23    pub struct DeviceProviderFactory(Object<ffi::GstDeviceProviderFactory, ffi::GstDeviceProviderFactoryClass>) @extends PluginFeature, Object;
24
25    match fn {
26        type_ => || ffi::gst_device_provider_factory_get_type(),
27    }
28}
29
30impl DeviceProviderFactory {
31    /// Returns the device provider of the type defined by the given device
32    /// providerfactory.
33    ///
34    /// # Returns
35    ///
36    /// the [`DeviceProvider`][crate::DeviceProvider] or [`None`]
37    /// if the device provider couldn't be created
38    #[doc(alias = "gst_device_provider_factory_get")]
39    pub fn get(&self) -> Option<DeviceProvider> {
40        unsafe { from_glib_full(ffi::gst_device_provider_factory_get(self.to_glib_none().0)) }
41    }
42
43    /// Get the `GType` for device providers managed by this factory. The type can
44    /// only be retrieved if the device provider factory is loaded, which can be
45    /// assured with [`PluginFeatureExtManual::load()`][crate::prelude::PluginFeatureExtManual::load()].
46    ///
47    /// # Returns
48    ///
49    /// the `GType` for device providers managed by this factory.
50    #[doc(alias = "gst_device_provider_factory_get_device_provider_type")]
51    #[doc(alias = "get_device_provider_type")]
52    pub fn device_provider_type(&self) -> glib::types::Type {
53        unsafe {
54            from_glib(ffi::gst_device_provider_factory_get_device_provider_type(
55                self.to_glib_none().0,
56            ))
57        }
58    }
59
60    /// Get the available keys for the metadata on `self`.
61    ///
62    /// # Returns
63    ///
64    ///
65    /// a [`None`]-terminated array of key strings, or [`None`] when there is no
66    /// metadata. Free with `g_strfreev()` when no longer needed.
67    #[doc(alias = "gst_device_provider_factory_get_metadata_keys")]
68    #[doc(alias = "get_metadata_keys")]
69    pub fn metadata_keys(&self) -> Vec<glib::GString> {
70        unsafe {
71            FromGlibPtrContainer::from_glib_full(
72                ffi::gst_device_provider_factory_get_metadata_keys(self.to_glib_none().0),
73            )
74        }
75    }
76
77    /// Check if `self` matches all of the given `classes`
78    /// ## `classes`
79    /// a "/" separate list of classes to match, only match
80    ///  if all classes are matched
81    ///
82    /// # Returns
83    ///
84    /// [`true`] if `self` matches or if `classes` is [`None`].
85    #[doc(alias = "gst_device_provider_factory_has_classes")]
86    pub fn has_classes(&self, classes: Option<&str>) -> bool {
87        unsafe {
88            from_glib(ffi::gst_device_provider_factory_has_classes(
89                self.to_glib_none().0,
90                classes.to_glib_none().0,
91            ))
92        }
93    }
94
95    /// Check if `self` matches all of the given classes
96    /// ## `classes`
97    /// a [`None`] terminated array
98    ///  of classes to match, only match if all classes are matched
99    ///
100    /// # Returns
101    ///
102    /// [`true`] if `self` matches.
103    #[doc(alias = "gst_device_provider_factory_has_classesv")]
104    pub fn has_classesv(&self, classes: &[&str]) -> bool {
105        unsafe {
106            from_glib(ffi::gst_device_provider_factory_has_classesv(
107                self.to_glib_none().0,
108                classes.to_glib_none().0,
109            ))
110        }
111    }
112
113    /// Search for an device provider factory of the given name. Refs the returned
114    /// device provider factory; caller is responsible for unreffing.
115    /// ## `name`
116    /// name of factory to find
117    ///
118    /// # Returns
119    ///
120    /// [`DeviceProviderFactory`][crate::DeviceProviderFactory] if
121    /// found, [`None`] otherwise
122    #[doc(alias = "gst_device_provider_factory_find")]
123    pub fn find(name: &str) -> Option<DeviceProviderFactory> {
124        assert_initialized_main_thread!();
125        unsafe { from_glib_full(ffi::gst_device_provider_factory_find(name.to_glib_none().0)) }
126    }
127
128    /// Returns the device provider of the type defined by the given device
129    /// provider factory.
130    /// ## `factoryname`
131    /// a named factory to instantiate
132    ///
133    /// # Returns
134    ///
135    /// a [`DeviceProvider`][crate::DeviceProvider] or [`None`]
136    /// if unable to create device provider
137    #[doc(alias = "gst_device_provider_factory_get_by_name")]
138    #[doc(alias = "get_by_name")]
139    pub fn by_name(factoryname: &str) -> Option<DeviceProvider> {
140        assert_initialized_main_thread!();
141        unsafe {
142            from_glib_full(ffi::gst_device_provider_factory_get_by_name(
143                factoryname.to_glib_none().0,
144            ))
145        }
146    }
147}
148
149unsafe impl Send for DeviceProviderFactory {}
150unsafe impl Sync for DeviceProviderFactory {}