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