![]() |
![]() |
![]() |
GStreamer 0.10 Core Reference Manual | ![]() |
---|---|---|---|---|
#include <gst/gst.h> GstElementFactory; GstElementDetails; #define GST_ELEMENT_DETAILS (longname,klass,description,author) #define GST_IS_ELEMENT_DETAILS (details) gboolean gst_element_register (GstPlugin *plugin, const gchar *name, guint rank, GType type); GstElementFactory* gst_element_factory_find (const gchar *name); GType gst_element_factory_get_element_type (GstElementFactory *factory); const gchar* gst_element_factory_get_longname (GstElementFactory *factory); const gchar* gst_element_factory_get_klass (GstElementFactory *factory); const gchar* gst_element_factory_get_description (GstElementFactory *factory); const gchar* gst_element_factory_get_author (GstElementFactory *factory); guint gst_element_factory_get_num_pad_templates (GstElementFactory *factory); gint gst_element_factory_get_uri_type (GstElementFactory *factory); gchar** gst_element_factory_get_uri_protocols (GstElementFactory *factory); GstElement* gst_element_factory_create (GstElementFactory *factory, const gchar *name); GstElement* gst_element_factory_make (const gchar *factoryname, const gchar *name); gboolean gst_element_factory_can_sink_caps (GstElementFactory *factory, const GstCaps *caps); gboolean gst_element_factory_can_src_caps (GstElementFactory *factory, const GstCaps *caps); const GList* gst_element_factory_get_static_pad_templates (GstElementFactory *factory);
GstElementFactory is used to create instances of elements. A GstElementfactory can be added to a GstPlugin as it is also a GstPluginFeature.
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.
Example 6. Using an element factory
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)
typedef struct _GstElementFactory GstElementFactory;
The opaque GstElementFactory data structure.
typedef struct { gchar *longname; gchar *klass; gchar *description; gchar *author; } GstElementDetails;
This struct defines the public information about a GstElement. It contains meta-data about the element that is mostly for the benefit of editors.
The klass
member can be used by applications to filter elements based
on functionality.
longname
;gcharlongname
long, english name
long, english name
gchar *klass
;gcharklass
type of element, as an unordered list separated with slashes ('/')
type of element, as an unordered list separated with slashes ('/')
gchar *description
;gchardescription
what the element is about
what the element is about
gchar *author
;gcharauthor
who wrote this thing?
who wrote this thing?
gchar *longname ; |
long, english name |
gchar *klass ; |
type of element, as an unordered list separated with slashes ('/') |
gchar *description ; |
what the element is about |
gchar *author ; |
who wrote this thing? |
#define GST_ELEMENT_DETAILS(longname,klass,description,author)
Macro to initialize GstElementDetails.
longname
:longname
long, english name
long, english name
klass
:klass
type of element, as hierarchy
type of element, as hierarchy
description
:description
what the element is about
what the element is about
author
:author
who wrote this thing?
who wrote this thing?
longname : |
long, english name |
klass : |
type of element, as hierarchy |
description : |
what the element is about |
author : |
who wrote this thing? |
#define GST_IS_ELEMENT_DETAILS(details)
Tests if element details are initialized.
details
:details
the GstElementDetails to check
the GstElementDetails to check
GstElementDetailsGstElementDetails
details : |
the GstElementDetails to check |
gboolean gst_element_register (GstPlugin *plugin, const gchar *name, guint rank, GType type);
Create a new elementfactory capable of instantiating objects of the
type
and add the factory to plugin
.
plugin
:plugin
GstPlugin to register the element with
GstPlugin to register the element with
GstPluginGstPluginname
:name
name of elements of this type
name of elements of this type
rank
:rank
rank of element (higher rank means more importance when autoplugging)
rank of element (higher rank means more importance when autoplugging)
type
:type
GType of element to register
GType of element to register
Returns :Returns TRUE, if the registering succeeded, FALSE on error
TRUE, if the registering succeeded, FALSE on error
plugin : |
GstPlugin 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 |
Returns : | TRUE, if the registering succeeded, FALSE on error |
GstElementFactory* gst_element_factory_find (const gchar *name);
Search for an element factory of the given name. Refs the returned element factory; caller is responsible for unreffing.
name
:name
name of factory to find
name of factory to find
Returns :Returns GstElementFactory if found, NULL otherwise
GstElementFactory if found, NULL otherwise
GstElementFactoryGstElementFactory
name : |
name of factory to find |
Returns : | GstElementFactory if found, NULL otherwise |
GType gst_element_factory_get_element_type (GstElementFactory *factory);
Get the GType for elements managed by this factory. The type can
only be retrieved if the element factory is loaded, which can be
assured with gst_plugin_feature_load()
.
factory
:factory
factory to get managed GType from
factory to get managed GType from
GTypeGTypeReturns :Returns the GType for elements managed by this factory or 0 if
the factory is not loaded.
the GType for elements managed by this factory or 0 if
the factory is not loaded.
GTypeGType
factory : |
factory to get managed GType from |
Returns : | the GType for elements managed by this factory or 0 if the factory is not loaded. |
const gchar* gst_element_factory_get_longname (GstElementFactory *factory);
Gets the longname for this factory
factory
:factory
a GstElementFactory
a GstElementFactory
GstElementFactoryGstElementFactoryReturns :Returns the longname
the longname
factory : |
a GstElementFactory |
Returns : | the longname |
const gchar* gst_element_factory_get_klass (GstElementFactory *factory);
Gets the class for this factory.
factory
:factory
a GstElementFactory
a GstElementFactory
GstElementFactoryGstElementFactoryReturns :Returns the class
the class
factory : |
a GstElementFactory |
Returns : | the class |
const gchar* gst_element_factory_get_description (GstElementFactory *factory);
Gets the description for this factory.
factory
:factory
a GstElementFactory
a GstElementFactory
GstElementFactoryGstElementFactoryReturns :Returns the description
the description
factory : |
a GstElementFactory |
Returns : | the description |
const gchar* gst_element_factory_get_author (GstElementFactory *factory);
Gets the author for this factory.
factory
:factory
a GstElementFactory
a GstElementFactory
GstElementFactoryGstElementFactoryReturns :Returns the author
the author
factory : |
a GstElementFactory |
Returns : | the author |
guint gst_element_factory_get_num_pad_templates (GstElementFactory *factory);
Gets the number of pad_templates in this factory.
factory
:factory
a GstElementFactory
a GstElementFactory
GstElementFactoryGstElementFactoryReturns :Returns the number of pad_templates
the number of pad_templates
factory : |
a GstElementFactory |
Returns : | the number of pad_templates |
gint gst_element_factory_get_uri_type (GstElementFactory *factory);
Gets the type of URIs the element supports or GST_URI_UNKNOWN if none.
factory
:factory
a GstElementFactory
a GstElementFactory
GstElementFactoryGstElementFactoryReturns :Returns type of URIs this element supports
type of URIs this element supports
factory : |
a GstElementFactory |
Returns : | type of URIs this element supports |
gchar** gst_element_factory_get_uri_protocols (GstElementFactory *factory);
Gets a NULL-terminated array of protocols this element supports or NULL if
no protocols are supported. You may not change the contents of the returned
array, as it is still owned by the element factory. Use g_strdupv()
to
make a copy of the protocol string array if you need to.
factory
:factory
a GstElementFactory
a GstElementFactory
GstElementFactoryGstElementFactoryReturns :Returns the supported protocols or NULL
the supported protocols or NULL
factory : |
a GstElementFactory |
Returns : | the supported protocols or NULL |
GstElement* gst_element_factory_create (GstElementFactory *factory, const gchar *name);
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
factory to instantiate
factory to instantiate
name
:name
name of new element
name of new element
Returns :Returns new GstElement or NULL if the element couldn't be created
new GstElement or NULL if the element couldn't be created
GstElementGstElement
factory : |
factory to instantiate |
name : |
name of new element |
Returns : | new GstElement or NULL if the element couldn't be created |
GstElement* gst_element_factory_make (const gchar *factoryname, const gchar *name);
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
:factoryname
a named factory to instantiate
a named factory to instantiate
name
:name
name of new element
name of new element
Returns :Returns new GstElement or NULL if unable to create element
new GstElement or NULL if unable to create element
GstElementGstElement
factoryname : |
a named factory to instantiate |
name : |
name of new element |
Returns : | new GstElement or NULL if unable to create element |
gboolean gst_element_factory_can_sink_caps (GstElementFactory *factory, const GstCaps *caps);
Checks if the factory can sink the given capability.
factory
:factory
factory to query
factory to query
caps
:caps
the caps to check
the caps to check
Returns :Returns true if it can sink the capabilities
true if it can sink the capabilities
factory : |
factory to query |
caps : |
the caps to check |
Returns : | true if it can sink the capabilities |
gboolean gst_element_factory_can_src_caps (GstElementFactory *factory, const GstCaps *caps);
Checks if the factory can source the given capability.
factory
:factory
factory to query
factory to query
caps
:caps
the caps to check
the caps to check
Returns :Returns true if it can src the capabilities
true if it can src the capabilities
factory : |
factory to query |
caps : |
the caps to check |
Returns : | true if it can src the capabilities |
const GList* gst_element_factory_get_static_pad_templates (GstElementFactory *factory);
Gets the GList of padtemplates for this factory.
factory
:factory
a GstElementFactory
a GstElementFactory
GstElementFactoryGstElementFactoryReturns :Returns the padtemplates
the padtemplates
factory : |
a GstElementFactory |
Returns : | the padtemplates |