2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = GstElementFactory.html
27 * outFile = ElementFactory
28 * strct = GstElementFactory
31 * clss = ElementFactory
39 * - gst_element_factory_
54 * - GstElement* -> Element
55 * - GstElementFactory* -> ElementFactory
56 * - GstPlugin* -> Plugin
61 module gstreamer
.ElementFactory
;
67 import tango
.io
.Stdout
; // use the tango loging?
71 private import gstreamerc
.gstreamertypes
;
73 private import gstreamerc
.gstreamer
;
76 private import glib
.Str
;
77 private import gstreamer
.Element
;
78 private import gstreamer
.Plugin
;
79 private import gstreamer
.Caps
;
80 private import glib
.ListG
;
87 * GstElementFactory is used to create instances of elements. A
88 * GstElementfactory can be added to a GstPlugin as it is also a
90 * Use the gst_element_factory_find() and gst_element_factory_create()
91 * functions to create element instances or use gst_element_factory_make() as a
92 * convenient shortcut.
93 * The following code example shows you how to create a GstFileSrc element.
94 * Example6.Using an element factory
97 * GstElementFactory *srcfactory;
98 * gst_init(argc,argv);
99 * srcfactory = gst_element_factory_find("filesrc");
100 * g_return_if_fail(srcfactory != NULL);
101 * src = gst_element_factory_create(srcfactory,"src");
102 * g_return_if_fail(src != NULL);
104 * Last reviewed on 2005-11-23 (0.9.5)
106 private import gstreamer
.PluginFeature
;
107 public class ElementFactory
: PluginFeature
110 /** the main Gtk struct */
111 protected GstElementFactory
* gstElementFactory
;
114 public GstElementFactory
* getElementFactoryStruct()
116 return gstElementFactory
;
120 /** the main Gtk struct as a void* */
121 protected void* getStruct()
123 return cast(void*)gstElementFactory
;
127 * Sets our main struct and passes it to the parent class
129 public this (GstElementFactory
* gstElementFactory
)
133 if ( gstElementFactory
is null )
138 Stdout("struct gstElementFactory is null on constructor").newline
;
142 printf("struct gstElementFactory is null on constructor");
149 assert(gstElementFactory
!is null, "struct gstElementFactory is null on constructor");
151 super(cast(GstPluginFeature
*)gstElementFactory
);
152 this.gstElementFactory
= gstElementFactory
;
156 * Create a new element of the type defined by the given element factory.
157 * The element will receive a guaranteed unique name,
158 * consisting of the element factory name and a number.
160 * a named factory to instantiate
162 * new GstElement or NULL if unable to create element
164 public static Element
make( char[] factoryname
)
166 // GstElement* gst_element_factory_make (const gchar *factoryname, const gchar *name);
167 return new Element( gst_element_factory_make(Str
.toStringz(factoryname
), null ) );
178 * Create a new elementfactory capable of instantiating objects of the
179 * type and add the factory to plugin.
181 * GstPlugin to register the element with
183 * name of elements of this type
185 * rank of element (higher rank means more importance when autoplugging)
187 * GType of element to register
189 * TRUE, if the registering succeeded, FALSE on error
191 public static int register(Plugin plugin
, char[] name
, uint rank
, GType type
)
193 // gboolean gst_element_register (GstPlugin *plugin, const gchar *name, guint rank, GType type);
194 return gst_element_register((plugin
is null) ?
null : plugin
.getPluginStruct(), Str
.toStringz(name
), rank
, type
);
198 * Search for an element factory of the given name. Refs the returned
199 * element factory; caller is responsible for unreffing.
201 * name of factory to find
203 * GstElementFactory if found, NULL otherwise
205 public static ElementFactory
find(char[] name
)
207 // GstElementFactory* gst_element_factory_find (const gchar *name);
208 return new ElementFactory( gst_element_factory_find(Str
.toStringz(name
)) );
212 * Get the GType for elements managed by this factory. The type can
213 * only be retrieved if the element factory is loaded, which can be
214 * assured with gst_plugin_feature_load().
216 * factory to get managed GType from
218 * the GType for elements managed by this factory or 0 if
219 * the factory is not loaded.
221 public GType
getElementType()
223 // GType gst_element_factory_get_element_type (GstElementFactory *factory);
224 return gst_element_factory_get_element_type(gstElementFactory
);
228 * Gets the longname for this factory
230 * a GstElementFactory
234 public char[] getLongname()
236 // const gchar* gst_element_factory_get_longname (GstElementFactory *factory);
237 return Str
.toString(gst_element_factory_get_longname(gstElementFactory
) );
241 * Gets the class for this factory.
243 * a GstElementFactory
247 public char[] getKlass()
249 // const gchar* gst_element_factory_get_klass (GstElementFactory *factory);
250 return Str
.toString(gst_element_factory_get_klass(gstElementFactory
) );
254 * Gets the description for this factory.
256 * a GstElementFactory
260 public char[] getDescription()
262 // const gchar* gst_element_factory_get_description (GstElementFactory *factory);
263 return Str
.toString(gst_element_factory_get_description(gstElementFactory
) );
267 * Gets the author for this factory.
269 * a GstElementFactory
273 public char[] getAuthor()
275 // const gchar* gst_element_factory_get_author (GstElementFactory *factory);
276 return Str
.toString(gst_element_factory_get_author(gstElementFactory
) );
280 * Gets the number of pad_templates in this factory.
282 * a GstElementFactory
284 * the number of pad_templates
286 public uint getNumPadTemplates()
288 // guint gst_element_factory_get_num_pad_templates (GstElementFactory *factory);
289 return gst_element_factory_get_num_pad_templates(gstElementFactory
);
293 * Gets the type of URIs the element supports or GST_URI_UNKNOWN if none.
295 * a GstElementFactory
297 * type of URIs this element supports
299 public int getUriType()
301 // gint gst_element_factory_get_uri_type (GstElementFactory *factory);
302 return gst_element_factory_get_uri_type(gstElementFactory
);
306 * Gets a NULL-terminated array of protocols this element supports or NULL if
307 * no protocols are supported. You may not change the contents of the returned
308 * array, as it is still owned by the element factory. Use g_strdupv() to
309 * make a copy of the protocol string array if you need to.
311 * a GstElementFactory
313 * the supported protocols or NULL
315 public char** getUriProtocols()
317 // gchar** gst_element_factory_get_uri_protocols (GstElementFactory *factory);
318 return gst_element_factory_get_uri_protocols(gstElementFactory
);
322 * Create a new element of the type defined by the given elementfactory.
323 * It will be given the name supplied, since all elements require a name as
324 * their first argument.
326 * factory to instantiate
328 * name of new element
330 * new GstElement or NULL if the element couldn't be created
332 public Element
create(char[] name
)
334 // GstElement* gst_element_factory_create (GstElementFactory *factory, const gchar *name);
335 return new Element( gst_element_factory_create(gstElementFactory
, Str
.toStringz(name
)) );
339 * Create a new element of the type defined by the given element factory.
340 * If name is NULL, then the element will receive a guaranteed unique name,
341 * consisting of the element factory name and a number.
342 * If name is given, it will be given the name supplied.
344 * a named factory to instantiate
346 * name of new element
348 * new GstElement or NULL if unable to create element
350 public static Element
make(char[] factoryname
, char[] name
)
352 // GstElement* gst_element_factory_make (const gchar *factoryname, const gchar *name);
353 return new Element( gst_element_factory_make(Str
.toStringz(factoryname
), Str
.toStringz(name
)) );
357 * Checks if the factory can sink the given capability.
363 * true if it can sink the capabilities
365 public int canSinkCaps(Caps caps
)
367 // gboolean gst_element_factory_can_sink_caps (GstElementFactory *factory, const GstCaps *caps);
368 return gst_element_factory_can_sink_caps(gstElementFactory
, (caps
is null) ?
null : caps
.getCapsStruct());
372 * Checks if the factory can source the given capability.
378 * true if it can src the capabilities
380 public int canSrcCaps(Caps caps
)
382 // gboolean gst_element_factory_can_src_caps (GstElementFactory *factory, const GstCaps *caps);
383 return gst_element_factory_can_src_caps(gstElementFactory
, (caps
is null) ?
null : caps
.getCapsStruct());
387 * Gets the GList of GstStaticPadTemplate for this factory.
389 * a GstElementFactory
393 * GstElement, GstPlugin, GstPluginFeature, GstPadTemplate.
395 public ListG
getStaticPadTemplates()
397 // const GList* gst_element_factory_get_static_pad_templates (GstElementFactory *factory);
398 return new ListG( gst_element_factory_get_static_pad_templates(gstElementFactory
) );