GstElementFactory

Name

GstElementFactory -- Create GstElements from a factory

Synopsis


#include <gst/gst.h>


struct      GstElementDetails;
GstElementFactory* gst_elementfactory_new   (const gchar *name,
                                             GType type,
                                             GstElementDetails *details);
GstElementFactory* gst_elementfactory_find  (const gchar *name);
const GList* gst_elementfactory_get_list    (void);
void        gst_elementfactory_add_padtemplate
                                            (GstElementFactory *elementfactory,
                                             GstPadTemplate *templ);
gboolean    gst_elementfactory_can_src_caps (GstElementFactory *factory,
                                             GstCaps *caps);
gboolean    gst_elementfactory_can_sink_caps
                                            (GstElementFactory *factory,
                                             GstCaps *caps);
GstElement* gst_elementfactory_create       (GstElementFactory *factory,
                                             const gchar *name);
GstElement* gst_elementfactory_make         (const gchar *factoryname,
                                             const gchar *name);

Object Hierarchy


  GObject
   +----GstObject
         +----GstPluginFeature
               +----GstElementFactory

Description

GstElementFactory is used to create instances of elements. A GstElementfactory can be added to a GstPlugin as it is also a GstPluginFeature.

Use gst_elementfactory_new() to create a new factory which can be added to a plugin with gst_plugin_add_feature().

gst_elementfactory_get_list() is used to get a list of all available factories in the plugin repository.

gst_elementfactory_add_padtemplate() is used to add a padtemplate to the factory. This function will enable the application to query for elementfactories that handle a specific media type.

Use the gst_elementfactory_find() and gst_elementfactory_create() functions to create element instances or use gst_elementfactory_make() as a convenient shortcut.

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

  include <gst/gst.h>

  GstElement *src;
  GstElementFactory *srcfactory;

  gst_init(&argc,&argv);

  srcfactory = gst_elementfactory_find("filesrc");
  g_return_if_fail(srcfactory != NULL);

  src = gst_elementfactory_create(srcfactory,"src");
  g_return_if_fail(src != NULL);
  ...
  

Details

struct GstElementDetails

struct GstElementDetails {
  gchar *longname;              /* long, english name */
  gchar *klass;                 /* type of element, as hierarchy */
  gchar *description;           /* insights of one form or another */
  gchar *version;               /* version of the element */
  gchar *author;                /* who wrote this thing? */
  gchar *copyright;             /* copyright details (year, etc.) */
};

This struct is used to define public information about the element. It describes the element, mostly for the benefit of editors.


gst_elementfactory_new ()

GstElementFactory* gst_elementfactory_new   (const gchar *name,
                                             GType type,
                                             GstElementDetails *details);

Create a new elementfactory capable of insantiating objects of the given type.

name : name of new elementfactory
type : GType of new element
details : GstElementDetails structure with element details
Returns : new elementfactory


gst_elementfactory_find ()

GstElementFactory* gst_elementfactory_find  (const gchar *name);

Search for an elementfactory of the given name.

name : name of factory to find
Returns : GstElementFactory if found, NULL otherwise


gst_elementfactory_get_list ()

const GList* gst_elementfactory_get_list    (void);

Get the global list of elementfactories.

Returns : GList of type GstElementFactory


gst_elementfactory_add_padtemplate ()

void        gst_elementfactory_add_padtemplate
                                            (GstElementFactory *elementfactory,
                                             GstPadTemplate *templ);

Add the given padtemplate to this elementfactory.

elementfactory : factory to add the src id to
templ : the padtemplate to add


gst_elementfactory_can_src_caps ()

gboolean    gst_elementfactory_can_src_caps (GstElementFactory *factory,
                                             GstCaps *caps);

Checks if the factory can source the given capability.

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


gst_elementfactory_can_sink_caps ()

gboolean    gst_elementfactory_can_sink_caps
                                            (GstElementFactory *factory,
                                             GstCaps *caps);

Checks if the factory can sink the given capability.

factory : factory to query
caps : the caps to check
Returns : true if it can sink the capabilities


gst_elementfactory_create ()

GstElement* gst_elementfactory_create       (GstElementFactory *factory,
                                             const gchar *name);

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

factory : factory to instantiate
name : name of new element
Returns : new GstElement


gst_elementfactory_make ()

GstElement* gst_elementfactory_make         (const gchar *factoryname,
                                             const gchar *name);

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

factoryname : a named factory to instantiate
name : name of new element
Returns : new GstElement (or NULL if unable to create element)

See Also

GstElement, GstPlugin, GstPluginFeature, GstPadTemplate.