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 gobject.ObjectG;
30 private import gstreamer.DeviceProvider;
31 private import gstreamer.PluginFeature;
32 private import gstreamer.c.functions;
33 public  import gstreamer.c.types;
34 public  import gstreamerc.gstreamertypes;
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 	protected override void setStruct(GObject* obj)
69 	{
70 		gstDeviceProviderFactory = cast(GstDeviceProviderFactory*)obj;
71 		super.setStruct(obj);
72 	}
73 
74 	/**
75 	 * Sets our main struct and passes it to the parent class.
76 	 */
77 	public this (GstDeviceProviderFactory* gstDeviceProviderFactory, bool ownedRef = false)
78 	{
79 		this.gstDeviceProviderFactory = gstDeviceProviderFactory;
80 		super(cast(GstPluginFeature*)gstDeviceProviderFactory, ownedRef);
81 	}
82 
83 
84 	/** */
85 	public static GType getType()
86 	{
87 		return gst_device_provider_factory_get_type();
88 	}
89 
90 	/**
91 	 * Search for an device provider factory of the given name. Refs the returned
92 	 * device provider factory; caller is responsible for unreffing.
93 	 *
94 	 * Params:
95 	 *     name = name of factory to find
96 	 *
97 	 * Returns: #GstDeviceProviderFactory if
98 	 *     found, %NULL otherwise
99 	 *
100 	 * Since: 1.4
101 	 */
102 	public static DeviceProviderFactory find(string name)
103 	{
104 		auto p = gst_device_provider_factory_find(Str.toStringz(name));
105 
106 		if(p is null)
107 		{
108 			return null;
109 		}
110 
111 		return ObjectG.getDObject!(DeviceProviderFactory)(cast(GstDeviceProviderFactory*) p, true);
112 	}
113 
114 	/**
115 	 * Returns the device provider of the type defined by the given device
116 	 * provider factory.
117 	 *
118 	 * Params:
119 	 *     factoryname = a named factory to instantiate
120 	 *
121 	 * Returns: a #GstDeviceProvider or %NULL
122 	 *     if unable to create device provider
123 	 *
124 	 * Since: 1.4
125 	 */
126 	public static DeviceProvider getByName(string factoryname)
127 	{
128 		auto p = gst_device_provider_factory_get_by_name(Str.toStringz(factoryname));
129 
130 		if(p is null)
131 		{
132 			return null;
133 		}
134 
135 		return ObjectG.getDObject!(DeviceProvider)(cast(GstDeviceProvider*) p, true);
136 	}
137 
138 	/**
139 	 * Get a list of factories with a rank greater or equal to @minrank.
140 	 * The list of factories is returned by decreasing rank.
141 	 *
142 	 * Params:
143 	 *     minrank = Minimum rank
144 	 *
145 	 * Returns: a #GList of #GstDeviceProviderFactory device providers. Use
146 	 *     gst_plugin_feature_list_free() after usage.
147 	 *
148 	 * Since: 1.4
149 	 */
150 	public static ListG listGetDeviceProviders(GstRank minrank)
151 	{
152 		auto p = gst_device_provider_factory_list_get_device_providers(minrank);
153 
154 		if(p is null)
155 		{
156 			return null;
157 		}
158 
159 		return new ListG(cast(GList*) p, true);
160 	}
161 
162 	/**
163 	 * Returns the device provider of the type defined by the given device
164 	 * providerfactory.
165 	 *
166 	 * Returns: the #GstDeviceProvider or %NULL
167 	 *     if the device provider couldn't be created
168 	 *
169 	 * Since: 1.4
170 	 */
171 	public DeviceProvider get()
172 	{
173 		auto p = gst_device_provider_factory_get(gstDeviceProviderFactory);
174 
175 		if(p is null)
176 		{
177 			return null;
178 		}
179 
180 		return ObjectG.getDObject!(DeviceProvider)(cast(GstDeviceProvider*) p, true);
181 	}
182 
183 	/**
184 	 * Get the #GType for device providers managed by this factory. The type can
185 	 * only be retrieved if the device provider factory is loaded, which can be
186 	 * assured with gst_plugin_feature_load().
187 	 *
188 	 * Returns: the #GType for device providers managed by this factory.
189 	 *
190 	 * Since: 1.4
191 	 */
192 	public GType getDeviceProviderType()
193 	{
194 		return gst_device_provider_factory_get_device_provider_type(gstDeviceProviderFactory);
195 	}
196 
197 	/**
198 	 * Get the metadata on @factory with @key.
199 	 *
200 	 * Params:
201 	 *     key = a key
202 	 *
203 	 * Returns: the metadata with @key on @factory or %NULL
204 	 *     when there was no metadata with the given @key.
205 	 *
206 	 * Since: 1.4
207 	 */
208 	public string getMetadata(string key)
209 	{
210 		return Str.toString(gst_device_provider_factory_get_metadata(gstDeviceProviderFactory, Str.toStringz(key)));
211 	}
212 
213 	/**
214 	 * Get the available keys for the metadata on @factory.
215 	 *
216 	 * Returns: a %NULL-terminated array of key strings, or %NULL when there is no
217 	 *     metadata. Free with g_strfreev() when no longer needed.
218 	 *
219 	 * Since: 1.4
220 	 */
221 	public string[] getMetadataKeys()
222 	{
223 		auto retStr = gst_device_provider_factory_get_metadata_keys(gstDeviceProviderFactory);
224 
225 		scope(exit) Str.freeStringArray(retStr);
226 		return Str.toStringArray(retStr);
227 	}
228 
229 	/**
230 	 * Check if @factory matches all of the given @classes
231 	 *
232 	 * Params:
233 	 *     classes = a "/" separate list of classes to match, only match
234 	 *         if all classes are matched
235 	 *
236 	 * Returns: %TRUE if @factory matches or if @classes is %NULL.
237 	 *
238 	 * Since: 1.4
239 	 */
240 	public bool hasClasses(string classes)
241 	{
242 		return gst_device_provider_factory_has_classes(gstDeviceProviderFactory, Str.toStringz(classes)) != 0;
243 	}
244 
245 	/**
246 	 * Check if @factory matches all of the given classes
247 	 *
248 	 * Params:
249 	 *     classes = a %NULL terminated array
250 	 *         of classes to match, only match if all classes are matched
251 	 *
252 	 * Returns: %TRUE if @factory matches.
253 	 *
254 	 * Since: 1.4
255 	 */
256 	public bool hasClassesv(string[] classes)
257 	{
258 		return gst_device_provider_factory_has_classesv(gstDeviceProviderFactory, Str.toStringzArray(classes)) != 0;
259 	}
260 }