Gst.ElementFactory

g GObject.InitiallyUnowned GObject.InitiallyUnowned Gst.Object Gst.Object GObject.InitiallyUnowned->Gst.Object GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gst.ElementFactory Gst.ElementFactory Gst.PluginFeature Gst.PluginFeature Gst.Object->Gst.PluginFeature Gst.PluginFeature->Gst.ElementFactory

Subclasses:

None

Methods

Inherited:

Gst.PluginFeature (10), Gst.Object (27), GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

find (name)

class

list_filter (list, caps, direction, subsetonly)

class

list_get_elements (type, minrank)

class

make (factoryname, name)

class

make_with_properties (factoryname, names, values)

can_sink_all_caps (caps)

can_sink_any_caps (caps)

can_src_all_caps (caps)

can_src_any_caps (caps)

create (name)

create_with_properties (names, values)

get_element_type ()

get_metadata (key)

get_metadata_keys ()

get_num_pad_templates ()

get_skip_documentation ()

get_static_pad_templates ()

get_uri_protocols ()

get_uri_type ()

has_interface (interfacename)

list_is_type (type)

Virtual Methods

Inherited:

Gst.Object (1), GObject.Object (7)

Properties

Inherited:

Gst.Object (2)

Signals

Inherited:

Gst.Object (1), GObject.Object (1)

Fields

Inherited:

Gst.Object (1), GObject.Object (1)

Class Details

class Gst.ElementFactory(**kwargs)
Bases:

Gst.PluginFeature

Abstract:

No

Structure:

Gst.ElementFactoryClass

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

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 GstFileSrc element.

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);
...
classmethod find(name)[source]
Parameters:

name (str) – name of factory to find

Returns:

Gst.ElementFactory if found, None otherwise

Return type:

Gst.ElementFactory or None

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

classmethod list_filter(list, caps, direction, subsetonly)[source]
Parameters:
Returns:

a GLib.List of Gst.ElementFactory elements that match the given requisites. Use Gst.PluginFeature.list_free after usage.

Return type:

[Gst.ElementFactory]

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

If subsetonly is True, then only the elements whose pads templates are a complete superset of caps will be returned. Else any element whose pad templates caps can intersect with caps will be returned.

classmethod list_get_elements(type, minrank)[source]
Parameters:
  • type (int) – a #GstElementFactoryListType

  • minrank (Gst.Rank) – Minimum rank

Returns:

a GLib.List of Gst.ElementFactory elements. Use Gst.PluginFeature.list_free() after usage.

Return type:

[Gst.ElementFactory]

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.

classmethod make(factoryname, name)[source]
Parameters:
  • factoryname (str) – a named factory to instantiate

  • name (str or None) – name of new element, or None to automatically create a unique name

Returns:

new Gst.Element or None if unable to create element

Return type:

Gst.Element or None

Create a new element of the type defined by the given element factory. If name is None, 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.

classmethod make_with_properties(factoryname, names, values)[source]
Parameters:
  • factoryname (str) – a named factory to instantiate

  • names ([str] or None) – array of properties names

  • values ([GObject.Value] or None) – array of associated properties values

Returns:

new Gst.Element or None if the element couldn’t be created

Return type:

Gst.Element or None

Create a new element of the type defined by the given elementfactory. The supplied list of properties, will be passed at object construction.

New in version 1.20.

can_sink_all_caps(caps)[source]
Parameters:

caps (Gst.Caps) – the caps to check

Returns:

True if the caps are fully compatible.

Return type:

bool

Checks if the factory can sink all possible capabilities.

can_sink_any_caps(caps)[source]
Parameters:

caps (Gst.Caps) – the caps to check

Returns:

True if the caps have a common subset.

Return type:

bool

Checks if the factory can sink any possible capability.

can_src_all_caps(caps)[source]
Parameters:

caps (Gst.Caps) – the caps to check

Returns:

True if the caps are fully compatible.

Return type:

bool

Checks if the factory can src all possible capabilities.

can_src_any_caps(caps)[source]
Parameters:

caps (Gst.Caps) – the caps to check

Returns:

True if the caps have a common subset.

Return type:

bool

Checks if the factory can src any possible capability.

create(name)[source]
Parameters:

name (str or None) – name of new element, or None to automatically create a unique name

Returns:

new Gst.Element or None if the element couldn’t be created

Return type:

Gst.Element or None

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.

create_with_properties(names, values)[source]
Parameters:
  • names ([str] or None) – array of properties names

  • values ([GObject.Value] or None) – array of associated properties values

Returns:

new Gst.Element or None if the element couldn’t be created

Return type:

Gst.Element or None

Create a new element of the type defined by the given elementfactory. The supplied list of properties, will be passed at object construction.

New in version 1.20.

get_element_type()[source]
Returns:

the GObject.GType for elements managed by this factory or 0 if the factory is not loaded.

Return type:

GObject.GType

Get the GObject.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.PluginFeature.load().

get_metadata(key)[source]
Parameters:

key (str) – a key

Returns:

the metadata with key on self or None when there was no metadata with the given key.

Return type:

str or None

Get the metadata on self with key.

get_metadata_keys()[source]
Returns:

a None-terminated array of key strings, or None when there is no metadata. Free with GLib.strfreev() when no longer needed.

Return type:

[str] or None

Get the available keys for the metadata on self.

get_num_pad_templates()[source]
Returns:

the number of pad_templates

Return type:

int

Gets the number of pad_templates in this factory.

get_skip_documentation()[source]
Returns:

True if documentation should be skipped

Return type:

bool

Queries whether registered element managed by self needs to be excluded from documentation system or not.

New in version 1.20.

get_static_pad_templates()[source]
Returns:

the static pad templates

Return type:

[Gst.StaticPadTemplate]

Gets the GLib.List of Gst.StaticPadTemplate for this factory.

get_uri_protocols()[source]
Returns:

the supported protocols or None

Return type:

[str]

Gets a None-terminated array of protocols this element supports or None 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 GLib.strdupv() to make a copy of the protocol string array if you need to.

get_uri_type()[source]
Returns:

type of URIs this element supports

Return type:

Gst.URIType

Gets the type of URIs the element supports or Gst.URIType.UNKNOWN if none.

has_interface(interfacename)[source]
Parameters:

interfacename (str) – an interface name

Returns:

True when self implement the interface.

Return type:

bool

Check if self implements the interface with name interfacename.

list_is_type(type)[source]
Parameters:

type (int) – a #GstElementFactoryListType

Returns:

True if self is of type.

Return type:

bool

Check if self is of the given types.