ElementFactory

gstreamer.ElementFactory is used to create instances of elements. A GstElementFactory can be added to a gstreamer.Plugin as it is also a gstreamer.PluginFeature

Use the Element.factoryFind and Element.factoryCreate functions to create element instances or use Element.factoryMake as a convenient shortcut.

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

Using an element factory

1 
2 [include|include] <gst/gst.h>
3 
4 GstElement *src;
5 GstElementFactory *srcfactory;
6 
7 gst_init (&argc, &argv);
8 
9 srcfactory = gst_element_factory_find ("filesrc");
10 g_return_if_fail (srcfactory != NULL);
11 src = gst_element_factory_create (srcfactory, "src");
12 g_return_if_fail (src != NULL);
13 ...

Constructors

this
this(GstElementFactory* gstElementFactory, bool ownedRef = false)

Sets our main struct and passes it to the parent class.

Members

Functions

canSinkAllCaps
bool canSinkAllCaps(Caps caps)

Checks if the factory can sink all possible capabilities.

canSinkAnyCaps
bool canSinkAnyCaps(Caps caps)

Checks if the factory can sink any possible capability.

canSrcAllCaps
bool canSrcAllCaps(Caps caps)

Checks if the factory can src all possible capabilities.

canSrcAnyCaps
bool canSrcAnyCaps(Caps caps)

Checks if the factory can src any possible capability.

create
Element create(string 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.

getElementFactoryStruct
GstElementFactory* getElementFactoryStruct(bool transferOwnership = false)

Get the main Gtk struct

getElementType
GType getElementType()

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 Plugin.featureLoad.

getMetadata
string getMetadata(string key)

Get the metadata on factory with key.

getMetadataKeys
string[] getMetadataKeys()

Get the available keys for the metadata on factory.

getNumPadTemplates
uint getNumPadTemplates()

Gets the number of pad_templates in this factory.

getStaticPadTemplates
ListG getStaticPadTemplates()

Gets the GList of gstreamer.StaticPadTemplate for this factory.

getStruct
void* getStruct()

the main Gtk struct as a void*

getUriProtocols
string[] getUriProtocols()

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.

getUriType
GstURIType getUriType()

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

hasInterface
bool hasInterface(string interfacename)

Check if factory implements the interface with name interfacename.

listIsType
bool listIsType(GstElementFactoryListType type)

Check if factory is of the given types.

Static functions

find
ElementFactory find(string name)

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

getType
GType getType()
listFilter
ListG listFilter(ListG list, Caps caps, GstPadDirection direction, bool subsetonly)

Filter out all the elementfactories in list that can handle caps in the given direction.

listGetElements
ListG listGetElements(GstElementFactoryListType type, GstRank minrank)

Get a list of factories that match the given type. Only elements with a rank greater or equal to minrank will be returned. The list of factories is returned by decreasing rank.

make
Element make(string factoryname)

Create a new element of the type defined by the given element factory. The element will receive a guaranteed unique name, consisting of the element factory name and a number.

make
Element make(string factoryname, string 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.

Variables

gstElementFactory
GstElementFactory* gstElementFactory;

the main Gtk struct

Inherited Members

From PluginFeature

gstPluginFeature
GstPluginFeature* gstPluginFeature;

the main Gtk struct

getPluginFeatureStruct
GstPluginFeature* getPluginFeatureStruct(bool transferOwnership = false)

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

getType
GType getType()
listCopy
ListG listCopy(ListG list)

Copies the list of features. Caller should call gst_plugin_feature_list_free when done with the list.

listDebug
void listDebug(ListG list)

Debug the plugin feature names in list.

listFree
void listFree(ListG list)

Unrefs each member of list, then frees the list.

rankCompareFunc
int rankCompareFunc(void* p1, void* p2)

Compares the two given gstreamer.PluginFeature instances. This function can be used as a GCompareFunc when sorting by rank and then by name.

checkVersion
bool checkVersion(uint minMajor, uint minMinor, uint minMicro)

Checks whether the given plugin feature is at least the required version

getPlugin
Plugin getPlugin()

Get the plugin that provides this feature.

getPluginName
string getPluginName()

Get the name of the plugin that provides this feature.

getRank
uint getRank()

Gets the rank of a plugin feature.

load
PluginFeature load()

Loads the plugin containing feature if it's not already loaded. feature is unaffected; use the return value instead.

setRank
void setRank(uint rank)

Specifies a rank for a plugin feature, so that autoplugging uses the most appropriate feature.

Meta