Next: , Previous: gstconfig, Up: Top


9 GstElementFactory

Create GstElements from a factory

9.1 Overview

<gst-element-factory> is used to create instances of elements. A GstElementfactory can be added to a <gst-plugin> as it is also a <gst-plugin-feature>.

Use the gst-element-factory-find and gst-element-factory-create functions to create element instances or use gst-element-factory-make as a convenient shortcut.

The following code example shows you how to create a GstFileSrc element.

     
       #include <gst/gst.h>
       GstElement *src;
       GstElementFactory *srcfactory;
       gst_init(&argc,&argv);
       srcfactory = gst_element_factory_find("filesrc");
       g_return_if_fail(srcfactory != NULL);
       src = gst_element_factory_create(srcfactory,"src");
       g_return_if_fail(src != NULL);
       ...

Last reviewed on 2005-11-23 (0.9.5)

9.2 Usage

— Class: <gst-element-factory>

This <gobject> class defines no properties, other than those defined by its superclasses.

— Function: gst-element-register (plugin <gst-plugin>) (name mchars) (rank unsigned-int) (type <gtype>)   (ret bool)

Create a new elementfactory capable of instantiating objects of the type and add the factory to plugin.

plugin
<gst-plugin> to register the element with
name
name of elements of this type
rank
rank of element (higher rank means more importance when autoplugging)
type
GType of element to register
ret
TRUE, if the registering succeeded, FALSE on error
— Function: gst-element-factory-find (name mchars)   (ret <gst-element-factory>)

Search for an element factory of the given name. Refs the returned element factory; caller is responsible for unreffing.

name
name of factory to find
ret
<gst-element-factory> if found, NULL otherwise
— Function: gst-element-factory-get-longname (self <gst-element-factory>)   (ret mchars)
— Method: get-longname

Gets the longname for this factory

factory
a <gst-element-factory>
ret
the longname
— Function: gst-element-factory-get-klass (self <gst-element-factory>)   (ret mchars)
— Method: get-klass

Gets the class for this factory.

factory
a <gst-element-factory>
ret
the class
— Function: gst-element-factory-get-description (self <gst-element-factory>)   (ret mchars)
— Method: get-description

Gets the description for this factory.

factory
a <gst-element-factory>
ret
the description
— Function: gst-element-factory-get-author (self <gst-element-factory>)   (ret mchars)
— Method: get-author

Gets the author for this factory.

factory
a <gst-element-factory>
ret
the author
— Function: gst-element-factory-get-uri-type (self <gst-element-factory>)   (ret int)
— Method: get-uri-type

Gets the type of URIs the element supports or GST_URI_UNKNOWN if none.

factory
a <gst-element-factory>
ret
type of URIs this element supports
— Function: gst-element-factory-create (self <gst-element-factory>) (name mchars)   (ret <gst-element>)
— Method: create

Create a new element of the type defined by the given elementfactory. It will be given the name supplied, since all elements require a name as their first argument.

factory
factory to instantiate
name
name of new element
ret
new <gst-element> or NULL if the element couldn't be created
— Function: gst-element-factory-make (factoryname mchars) (name mchars)   (ret <gst-element>)

Create a new element of the type defined by the given element factory. If name is NULL, then the element will receive a guaranteed unique name, consisting of the element factory name and a number. If name is given, it will be given the name supplied.

factoryname
a named factory to instantiate
name
name of new element
ret
new <gst-element> or NULL if unable to create element
— Function: gst-element-factory-can-sink-caps (self <gst-element-factory>) (caps <gst-caps>)   (ret bool)
— Method: can-sink-caps

Checks if the factory can sink the given capability.

factory
factory to query
caps
the caps to check
ret
true if it can sink the capabilities
— Function: gst-element-factory-can-src-caps (self <gst-element-factory>) (caps <gst-caps>)   (ret bool)
— Method: can-src-caps

Checks if the factory can source the given capability.

factory
factory to query
caps
the caps to check
ret
true if it can src the capabilities