1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module gstreamer.DeviceProviderFactory;
26 
27 private import glib.ListG;
28 private import glib.Str;
29 private import glib.c.functions;
30 private import gobject.ObjectG;
31 private import gstreamer.DeviceProvider;
32 private import gstreamer.PluginFeature;
33 private import gstreamer.c.functions;
34 public  import gstreamer.c.types;
35 
36 
37 /**
38  * #GstDeviceProviderFactory is used to create instances of device providers. A
39  * GstDeviceProviderfactory can be added to a #GstPlugin as it is also a
40  * #GstPluginFeature.
41  * 
42  * Use the gst_device_provider_factory_find() and
43  * gst_device_provider_factory_get() functions to create device
44  * provider instances or use gst_device_provider_factory_get_by_name() as a
45  * convenient shortcut.
46  *
47  * Since: 1.4
48  */
49 public class DeviceProviderFactory : PluginFeature
50 {
51 	/** the main Gtk struct */
52 	protected GstDeviceProviderFactory* gstDeviceProviderFactory;
53 
54 	/** Get the main Gtk struct */
55 	public GstDeviceProviderFactory* getDeviceProviderFactoryStruct(bool transferOwnership = false)
56 	{
57 		if (transferOwnership)
58 			ownedRef = false;
59 		return gstDeviceProviderFactory;
60 	}
61 
62 	/** the main Gtk struct as a void* */
63 	protected override void* getStruct()
64 	{
65 		return cast(void*)gstDeviceProviderFactory;
66 	}
67 
68 	/**
69 	 * Sets our main struct and passes it to the parent class.
70 	 */
71 	public this (GstDeviceProviderFactory* gstDeviceProviderFactory, bool ownedRef = false)
72 	{
73 		this.gstDeviceProviderFactory = gstDeviceProviderFactory;
74 		super(cast(GstPluginFeature*)gstDeviceProviderFactory, ownedRef);
75 	}
76 
77 
78 	/** */
79 	public static GType getType()
80 	{
81 		return gst_device_provider_factory_get_type();
82 	}
83 
84 	/**
85 	 * Search for an device provider factory of the given name. Refs the returned
86 	 * device provider factory; caller is responsible for unreffing.
87 	 *
88 	 * Params:
89 	 *     name = name of factory to find
90 	 *
91 	 * Returns: #GstDeviceProviderFactory if
92 	 *     found, %NULL otherwise
93 	 *
94 	 * Since: 1.4
95 	 */
96 	public static DeviceProviderFactory find(string name)
97 	{
98 		auto __p = gst_device_provider_factory_find(Str.toStringz(name));
99 
100 		if(__p is null)
101 		{
102 			return null;
103 		}
104 
105 		return ObjectG.getDObject!(DeviceProviderFactory)(cast(GstDeviceProviderFactory*) __p, true);
106 	}
107 
108 	/**
109 	 * Returns the device provider of the type defined by the given device
110 	 * provider factory.
111 	 *
112 	 * Params:
113 	 *     factoryname = a named factory to instantiate
114 	 *
115 	 * Returns: a #GstDeviceProvider or %NULL
116 	 *     if unable to create device provider
117 	 *
118 	 * Since: 1.4
119 	 */
120 	public static DeviceProvider getByName(string factoryname)
121 	{
122 		auto __p = gst_device_provider_factory_get_by_name(Str.toStringz(factoryname));
123 
124 		if(__p is null)
125 		{
126 			return null;
127 		}
128 
129 		return ObjectG.getDObject!(DeviceProvider)(cast(GstDeviceProvider*) __p, true);
130 	}
131 
132 	/**
133 	 * Get a list of factories with a rank greater or equal to @minrank.
134 	 * The list of factories is returned by decreasing rank.
135 	 *
136 	 * Params:
137 	 *     minrank = Minimum rank
138 	 *
139 	 * Returns: a #GList of #GstDeviceProviderFactory device providers. Use
140 	 *     gst_plugin_feature_list_free() after usage.
141 	 *
142 	 * Since: 1.4
143 	 */
144 	public static ListG listGetDeviceProviders(GstRank minrank)
145 	{
146 		auto __p = gst_device_provider_factory_list_get_device_providers(minrank);
147 
148 		if(__p is null)
149 		{
150 			return null;
151 		}
152 
153 		return new ListG(cast(GList*) __p, true);
154 	}
155 
156 	/**
157 	 * Returns the device provider of the type defined by the given device
158 	 * providerfactory.
159 	 *
160 	 * Returns: the #GstDeviceProvider or %NULL
161 	 *     if the device provider couldn't be created
162 	 *
163 	 * Since: 1.4
164 	 */
165 	public DeviceProvider get()
166 	{
167 		auto __p = gst_device_provider_factory_get(gstDeviceProviderFactory);
168 
169 		if(__p is null)
170 		{
171 			return null;
172 		}
173 
174 		return ObjectG.getDObject!(DeviceProvider)(cast(GstDeviceProvider*) __p, true);
175 	}
176 
177 	/**
178 	 * Get the #GType for device providers managed by this factory. The type can
179 	 * only be retrieved if the device provider factory is loaded, which can be
180 	 * assured with gst_plugin_feature_load().
181 	 *
182 	 * Returns: the #GType for device providers managed by this factory.
183 	 *
184 	 * Since: 1.4
185 	 */
186 	public GType getDeviceProviderType()
187 	{
188 		return gst_device_provider_factory_get_device_provider_type(gstDeviceProviderFactory);
189 	}
190 
191 	/**
192 	 * Get the metadata on @factory with @key.
193 	 *
194 	 * Params:
195 	 *     key = a key
196 	 *
197 	 * Returns: the metadata with @key on @factory or %NULL
198 	 *     when there was no metadata with the given @key.
199 	 *
200 	 * Since: 1.4
201 	 */
202 	public string getMetadata(string key)
203 	{
204 		return Str.toString(gst_device_provider_factory_get_metadata(gstDeviceProviderFactory, Str.toStringz(key)));
205 	}
206 
207 	/**
208 	 * Get the available keys for the metadata on @factory.
209 	 *
210 	 * Returns: a %NULL-terminated array of key strings, or %NULL when there is no
211 	 *     metadata. Free with g_strfreev() when no longer needed.
212 	 *
213 	 * Since: 1.4
214 	 */
215 	public string[] getMetadataKeys()
216 	{
217 		auto retStr = gst_device_provider_factory_get_metadata_keys(gstDeviceProviderFactory);
218 
219 		scope(exit) Str.freeStringArray(retStr);
220 		return Str.toStringArray(retStr);
221 	}
222 
223 	/**
224 	 * Check if @factory matches all of the given @classes
225 	 *
226 	 * Params:
227 	 *     classes = a "/" separate list of classes to match, only match
228 	 *         if all classes are matched
229 	 *
230 	 * Returns: %TRUE if @factory matches or if @classes is %NULL.
231 	 *
232 	 * Since: 1.4
233 	 */
234 	public bool hasClasses(string classes)
235 	{
236 		return gst_device_provider_factory_has_classes(gstDeviceProviderFactory, Str.toStringz(classes)) != 0;
237 	}
238 
239 	/**
240 	 * Check if @factory matches all of the given classes
241 	 *
242 	 * Params:
243 	 *     classes = a %NULL terminated array
244 	 *         of classes to match, only match if all classes are matched
245 	 *
246 	 * Returns: %TRUE if @factory matches.
247 	 *
248 	 * Since: 1.4
249 	 */
250 	public bool hasClassesv(string[] classes)
251 	{
252 		return gst_device_provider_factory_has_classesv(gstDeviceProviderFactory, Str.toStringzArray(classes)) != 0;
253 	}
254 }