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  * Conversion parameters:
26  * inFile  = GstElementFactory.html
27  * outPack = gstreamer
28  * outFile = ElementFactory
29  * strct   = GstElementFactory
30  * realStrct=
31  * ctorStrct=
32  * clss    = ElementFactory
33  * interf  = 
34  * class Code: Yes
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gst_element_factory_
41  * 	- gst_element_
42  * 	- gst_
43  * omit structs:
44  * omit prefixes:
45  * omit code:
46  * omit signals:
47  * imports:
48  * 	- glib.Str
49  * 	- gstreamer.Element
50  * 	- gstreamer.Plugin
51  * 	- gstreamer.Caps
52  * 	- glib.ListG
53  * structWrap:
54  * 	- GList* -> ListG
55  * 	- GstCaps* -> Caps
56  * 	- GstElement* -> Element
57  * 	- GstElementFactory* -> ElementFactory
58  * 	- GstPlugin* -> Plugin
59  * module aliases:
60  * local aliases:
61  * overrides:
62  */
63 
64 module gstreamer.ElementFactory;
65 
66 public  import gstreamerc.gstreamertypes;
67 
68 private import gstreamerc.gstreamer;
69 private import glib.ConstructionException;
70 private import gobject.ObjectG;
71 
72 
73 private import glib.Str;
74 private import gstreamer.Element;
75 private import gstreamer.Plugin;
76 private import gstreamer.Caps;
77 private import glib.ListG;
78 
79 
80 
81 private import gstreamer.PluginFeature;
82 
83 /**
84  * Description
85  * GstElementFactory is used to create instances of elements. A
86  * GstElementfactory can be added to a GstPlugin as it is also a
87  * GstPluginFeature.
88  * Use the gst_element_factory_find() and gst_element_factory_create()
89  * functions to create element instances or use gst_element_factory_make() as a
90  * convenient shortcut.
91  * The following code example shows you how to create a GstFileSrc element.
92  * $(DDOC_COMMENT example)
93  * Last reviewed on 2005-11-23 (0.9.5)
94  */
95 public class ElementFactory : PluginFeature
96 {
97 	
98 	/** the main Gtk struct */
99 	protected GstElementFactory* gstElementFactory;
100 	
101 	
102 	public GstElementFactory* getElementFactoryStruct()
103 	{
104 		return gstElementFactory;
105 	}
106 	
107 	
108 	/** the main Gtk struct as a void* */
109 	protected override void* getStruct()
110 	{
111 		return cast(void*)gstElementFactory;
112 	}
113 	
114 	/**
115 	 * Sets our main struct and passes it to the parent class
116 	 */
117 	public this (GstElementFactory* gstElementFactory)
118 	{
119 		super(cast(GstPluginFeature*)gstElementFactory);
120 		this.gstElementFactory = gstElementFactory;
121 	}
122 	
123 	protected override void setStruct(GObject* obj)
124 	{
125 		super.setStruct(obj);
126 		gstElementFactory = cast(GstElementFactory*)obj;
127 	}
128 	
129 	/**
130 	 * Create a new element of the type defined by the given element factory.
131 	 * The element will receive a guaranteed unique name,
132 	 * consisting of the element factory name and a number.
133 	 * Params:
134 	 *  factoryname = a named factory to instantiate
135 	 * Returns:
136 	 *  new GstElement or NULL if unable to create element
137 	 */
138 	public static Element make( string factoryname )
139 	{
140 		// GstElement* gst_element_factory_make (const gchar *factoryname,  const gchar *name);
141 		return new Element( gst_element_factory_make(Str.toStringz(factoryname), null ) );
142 	}
143 	
144 	/**
145 	 */
146 	
147 	/**
148 	 * Create a new elementfactory capable of instantiating objects of the
149 	 * type and add the factory to plugin.
150 	 * Params:
151 	 * plugin = GstPlugin to register the element with
152 	 * name = name of elements of this type
153 	 * rank = rank of element (higher rank means more importance when autoplugging)
154 	 * type = GType of element to register
155 	 * Returns: TRUE, if the registering succeeded, FALSE on error
156 	 */
157 	public static int register(Plugin plugin, string name, uint rank, GType type)
158 	{
159 		// gboolean gst_element_register (GstPlugin *plugin,  const gchar *name,  guint rank,  GType type);
160 		return gst_element_register((plugin is null) ? null : plugin.getPluginStruct(), Str.toStringz(name), rank, type);
161 	}
162 	
163 	/**
164 	 * Search for an element factory of the given name. Refs the returned
165 	 * element factory; caller is responsible for unreffing.
166 	 * Params:
167 	 * name = name of factory to find
168 	 * Returns: GstElementFactory if found, NULL otherwise
169 	 */
170 	public static ElementFactory find(string name)
171 	{
172 		// GstElementFactory* gst_element_factory_find (const gchar *name);
173 		auto p = gst_element_factory_find(Str.toStringz(name));
174 		
175 		if(p is null)
176 		{
177 			return null;
178 		}
179 		
180 		return ObjectG.getDObject!(ElementFactory)(cast(GstElementFactory*) p);
181 	}
182 	
183 	/**
184 	 * Get the GType for elements managed by this factory. The type can
185 	 * only be retrieved if the element factory is loaded, which can be
186 	 * assured with gst_plugin_feature_load().
187 	 * Returns: the GType for elements managed by this factory or 0 if the factory is not loaded.
188 	 */
189 	public GType getElementType()
190 	{
191 		// GType gst_element_factory_get_element_type  (GstElementFactory *factory);
192 		return gst_element_factory_get_element_type(gstElementFactory);
193 	}
194 	
195 	/**
196 	 * Gets the longname for this factory
197 	 * Returns: the longname
198 	 */
199 	public string getLongname()
200 	{
201 		// const gchar* gst_element_factory_get_longname (GstElementFactory *factory);
202 		return Str.toString(gst_element_factory_get_longname(gstElementFactory));
203 	}
204 	
205 	/**
206 	 * Gets the class for this factory.
207 	 * Returns: the class
208 	 */
209 	public string getKlass()
210 	{
211 		// const gchar* gst_element_factory_get_klass (GstElementFactory *factory);
212 		return Str.toString(gst_element_factory_get_klass(gstElementFactory));
213 	}
214 	
215 	/**
216 	 * Gets the description for this factory.
217 	 * Returns: the description
218 	 */
219 	public string getDescription()
220 	{
221 		// const gchar* gst_element_factory_get_description (GstElementFactory *factory);
222 		return Str.toString(gst_element_factory_get_description(gstElementFactory));
223 	}
224 	
225 	/**
226 	 * Gets the author for this factory.
227 	 * Returns: the author
228 	 */
229 	public string getAuthor()
230 	{
231 		// const gchar* gst_element_factory_get_author (GstElementFactory *factory);
232 		return Str.toString(gst_element_factory_get_author(gstElementFactory));
233 	}
234 	
235 	/**
236 	 * Gets the number of pad_templates in this factory.
237 	 * Returns: the number of pad_templates
238 	 */
239 	public uint getNumPadTemplates()
240 	{
241 		// guint gst_element_factory_get_num_pad_templates  (GstElementFactory *factory);
242 		return gst_element_factory_get_num_pad_templates(gstElementFactory);
243 	}
244 	
245 	/**
246 	 * Gets the type of URIs the element supports or GST_URI_UNKNOWN if none.
247 	 * Returns: type of URIs this element supports
248 	 */
249 	public int getUriType()
250 	{
251 		// gint gst_element_factory_get_uri_type (GstElementFactory *factory);
252 		return gst_element_factory_get_uri_type(gstElementFactory);
253 	}
254 	
255 	/**
256 	 * Gets a NULL-terminated array of protocols this element supports or NULL if
257 	 * no protocols are supported. You may not change the contents of the returned
258 	 * array, as it is still owned by the element factory. Use g_strdupv() to
259 	 * make a copy of the protocol string array if you need to.
260 	 * Returns: the supported protocols or NULL
261 	 */
262 	public string[] getUriProtocols()
263 	{
264 		// gchar** gst_element_factory_get_uri_protocols  (GstElementFactory *factory);
265 		return Str.toStringArray(gst_element_factory_get_uri_protocols(gstElementFactory));
266 	}
267 	
268 	/**
269 	 * Check if factory implements the interface with name interfacename.
270 	 * Params:
271 	 * interfacename = an interface name
272 	 * Returns: TRUE when factory implement the interface. Since 0.10.14
273 	 */
274 	public int hasInterface(string interfacename)
275 	{
276 		// gboolean gst_element_factory_has_interface (GstElementFactory *factory,  const gchar *interfacename);
277 		return gst_element_factory_has_interface(gstElementFactory, Str.toStringz(interfacename));
278 	}
279 	
280 	/**
281 	 * Create a new element of the type defined by the given elementfactory.
282 	 * It will be given the name supplied, since all elements require a name as
283 	 * their first argument.
284 	 * Params:
285 	 * name = name of new element
286 	 * Returns: new GstElement or NULL if the element couldn't be created
287 	 */
288 	public Element create(string name)
289 	{
290 		// GstElement* gst_element_factory_create (GstElementFactory *factory,  const gchar *name);
291 		auto p = gst_element_factory_create(gstElementFactory, Str.toStringz(name));
292 		
293 		if(p is null)
294 		{
295 			return null;
296 		}
297 		
298 		return ObjectG.getDObject!(Element)(cast(GstElement*) p);
299 	}
300 	
301 	/**
302 	 * Create a new element of the type defined by the given element factory.
303 	 * If name is NULL, then the element will receive a guaranteed unique name,
304 	 * consisting of the element factory name and a number.
305 	 * If name is given, it will be given the name supplied.
306 	 * Params:
307 	 * factoryname = a named factory to instantiate
308 	 * name = name of new element
309 	 * Returns: new GstElement or NULL if unable to create element
310 	 */
311 	public static Element make(string factoryname, string name)
312 	{
313 		// GstElement* gst_element_factory_make (const gchar *factoryname,  const gchar *name);
314 		auto p = gst_element_factory_make(Str.toStringz(factoryname), Str.toStringz(name));
315 		
316 		if(p is null)
317 		{
318 			return null;
319 		}
320 		
321 		return ObjectG.getDObject!(Element)(cast(GstElement*) p);
322 	}
323 	
324 	/**
325 	 * Checks if the factory can sink the given capability.
326 	 * Params:
327 	 * caps = the caps to check
328 	 * Returns: true if it can sink the capabilities
329 	 */
330 	public int canSinkCaps(Caps caps)
331 	{
332 		// gboolean gst_element_factory_can_sink_caps (GstElementFactory *factory,  const GstCaps *caps);
333 		return gst_element_factory_can_sink_caps(gstElementFactory, (caps is null) ? null : caps.getCapsStruct());
334 	}
335 	
336 	/**
337 	 * Checks if the factory can source the given capability.
338 	 * Params:
339 	 * caps = the caps to check
340 	 * Returns: true if it can src the capabilities
341 	 */
342 	public int canSrcCaps(Caps caps)
343 	{
344 		// gboolean gst_element_factory_can_src_caps (GstElementFactory *factory,  const GstCaps *caps);
345 		return gst_element_factory_can_src_caps(gstElementFactory, (caps is null) ? null : caps.getCapsStruct());
346 	}
347 	
348 	/**
349 	 * Gets the GList of GstStaticPadTemplate for this factory.
350 	 * Returns: the padtemplates
351 	 */
352 	public ListG getStaticPadTemplates()
353 	{
354 		// const GList* gst_element_factory_get_static_pad_templates  (GstElementFactory *factory);
355 		auto p = gst_element_factory_get_static_pad_templates(gstElementFactory);
356 		
357 		if(p is null)
358 		{
359 			return null;
360 		}
361 		
362 		return ObjectG.getDObject!(ListG)(cast(GList*) p);
363 	}
364 }