gstreamer/auto/element_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::{Object, PluginFeature, URIType, ffi};
7use glib::translate::*;
8
9glib::wrapper! {
10 /// argv);
11 ///
12 /// srcfactory = gst_element_factory_find ("filesrc");
13 /// g_return_if_fail (srcfactory != NULL);
14 /// src = gst_element_factory_create (srcfactory, "src");
15 /// g_return_if_fail (src != NULL);
16 /// ...
17 /// ]|
18 ///
19 /// # Implements
20 ///
21 /// [`PluginFeatureExt`][trait@crate::prelude::PluginFeatureExt], [`GstObjectExt`][trait@crate::prelude::GstObjectExt], [`trait@glib::ObjectExt`], [`PluginFeatureExtManual`][trait@crate::prelude::PluginFeatureExtManual], [`GstObjectExtManual`][trait@crate::prelude::GstObjectExtManual]
22 #[doc(alias = "GstElementFactory")]
23 pub struct ElementFactory(Object<ffi::GstElementFactory, ffi::GstElementFactoryClass>) @extends PluginFeature, Object;
24
25 match fn {
26 type_ => || ffi::gst_element_factory_get_type(),
27 }
28}
29
30impl ElementFactory {
31 /// Get the `GType` for elements managed by this factory. The type can
32 /// only be retrieved if the element factory is loaded, which can be
33 /// assured with [`PluginFeatureExtManual::load()`][crate::prelude::PluginFeatureExtManual::load()].
34 ///
35 /// # Returns
36 ///
37 /// the `GType` for elements managed by this factory or 0 if
38 /// the factory is not loaded.
39 #[doc(alias = "gst_element_factory_get_element_type")]
40 #[doc(alias = "get_element_type")]
41 pub fn element_type(&self) -> glib::types::Type {
42 unsafe {
43 from_glib(ffi::gst_element_factory_get_element_type(
44 self.to_glib_none().0,
45 ))
46 }
47 }
48
49 /// Get the available keys for the metadata on `self`.
50 ///
51 /// # Returns
52 ///
53 ///
54 /// a [`None`]-terminated array of key strings, or [`None`] when there is no
55 /// metadata. Free with `g_strfreev()` when no longer needed.
56 #[doc(alias = "gst_element_factory_get_metadata_keys")]
57 #[doc(alias = "get_metadata_keys")]
58 pub fn metadata_keys(&self) -> Vec<glib::GString> {
59 unsafe {
60 FromGlibPtrContainer::from_glib_full(ffi::gst_element_factory_get_metadata_keys(
61 self.to_glib_none().0,
62 ))
63 }
64 }
65
66 /// Gets the number of pad_templates in this factory.
67 ///
68 /// # Returns
69 ///
70 /// the number of pad_templates
71 #[doc(alias = "gst_element_factory_get_num_pad_templates")]
72 #[doc(alias = "get_num_pad_templates")]
73 pub fn num_pad_templates(&self) -> u32 {
74 unsafe { ffi::gst_element_factory_get_num_pad_templates(self.to_glib_none().0) }
75 }
76
77 /// Queries whether registered element managed by `self` needs to
78 /// be excluded from documentation system or not.
79 ///
80 /// # Returns
81 ///
82 /// [`true`] if documentation should be skipped
83 #[cfg(feature = "v1_20")]
84 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
85 #[doc(alias = "gst_element_factory_get_skip_documentation")]
86 #[doc(alias = "get_skip_documentation")]
87 pub fn skips_documentation(&self) -> bool {
88 unsafe {
89 from_glib(ffi::gst_element_factory_get_skip_documentation(
90 self.to_glib_none().0,
91 ))
92 }
93 }
94
95 /// Gets a [`None`]-terminated array of protocols this element supports or [`None`] if
96 /// no protocols are supported. You may not change the contents of the returned
97 /// array, as it is still owned by the element factory. Use `g_strdupv()` to
98 /// make a copy of the protocol string array if you need to.
99 ///
100 /// # Returns
101 ///
102 /// the supported protocols
103 /// or [`None`]
104 #[doc(alias = "gst_element_factory_get_uri_protocols")]
105 #[doc(alias = "get_uri_protocols")]
106 pub fn uri_protocols(&self) -> Vec<glib::GString> {
107 unsafe {
108 FromGlibPtrContainer::from_glib_none(ffi::gst_element_factory_get_uri_protocols(
109 self.to_glib_none().0,
110 ))
111 }
112 }
113
114 /// Gets the type of URIs the element supports or [`URIType::Unknown`][crate::URIType::Unknown] if none.
115 ///
116 /// # Returns
117 ///
118 /// type of URIs this element supports
119 #[doc(alias = "gst_element_factory_get_uri_type")]
120 #[doc(alias = "get_uri_type")]
121 pub fn uri_type(&self) -> URIType {
122 unsafe { from_glib(ffi::gst_element_factory_get_uri_type(self.to_glib_none().0)) }
123 }
124
125 /// Check if `self` implements the interface with name `interfacename`.
126 /// ## `interfacename`
127 /// an interface name
128 ///
129 /// # Returns
130 ///
131 /// [`true`] when `self` implement the interface.
132 #[doc(alias = "gst_element_factory_has_interface")]
133 pub fn has_interface(&self, interfacename: &str) -> bool {
134 unsafe {
135 from_glib(ffi::gst_element_factory_has_interface(
136 self.to_glib_none().0,
137 interfacename.to_glib_none().0,
138 ))
139 }
140 }
141
142 /// Search for an element factory of the given name. Refs the returned
143 /// element factory; caller is responsible for unreffing.
144 /// ## `name`
145 /// name of factory to find
146 ///
147 /// # Returns
148 ///
149 /// [`ElementFactory`][crate::ElementFactory] if found,
150 /// [`None`] otherwise
151 #[doc(alias = "gst_element_factory_find")]
152 pub fn find(name: &str) -> Option<ElementFactory> {
153 assert_initialized_main_thread!();
154 unsafe { from_glib_full(ffi::gst_element_factory_find(name.to_glib_none().0)) }
155 }
156}
157
158unsafe impl Send for ElementFactory {}
159unsafe impl Sync for ElementFactory {}