ElementFactory#
Superclasses: PluginFeature, Object, InitiallyUnowned, Object
ElementFactory is used to create instances of elements. A
GstElementFactory can be added to a Plugin as it is also a
PluginFeature.
Use the find() and create()
functions to create element instances or use 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);
...
Methods#
- class ElementFactory
 - can_sink_all_caps(caps: Caps) bool#
 Checks if the factory can sink all possible capabilities.
- Parameters:
 caps – the caps to check
- can_sink_any_caps(caps: Caps) bool#
 Checks if the factory can sink any possible capability.
- Parameters:
 caps – the caps to check
- can_src_all_caps(caps: Caps) bool#
 Checks if the factory can src all possible capabilities.
- Parameters:
 caps – the caps to check
- can_src_any_caps(caps: Caps) bool#
 Checks if the factory can src any possible capability.
- Parameters:
 caps – the caps to check
- create(name: str | None = None) Element | 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.
- Parameters:
 name – name of new element, or
Noneto automatically create a unique name
- create_with_properties(names: list[str] | None = None, values: list[Value] | None = None) Element | None#
 Create a new element of the type defined by the given elementfactory. The supplied list of properties, will be passed at object construction.
Added in version 1.20.
- Parameters:
 names – array of properties names
values – array of associated properties values
- classmethod find() ElementFactory | None#
 Search for an element factory of the given name. Refs the returned element factory; caller is responsible for unreffing.
- get_element_type() GType#
 Get the
Typefor elements managed by this factory. The type can only be retrieved if the element factory is loaded, which can be assured withload().
- get_skip_documentation() bool#
 Queries whether registered element managed by
factoryneeds to be excluded from documentation system or not.Added in version 1.20.
- get_static_pad_templates() list[StaticPadTemplate]#
 Gets the
GListofStaticPadTemplatefor this factory.
- get_uri_protocols() list[str]#
 Gets a
None-terminated array of protocols this element supports orNoneif no protocols are supported. You may not change the contents of the returned array, as it is still owned by the element factory. Usestrdupv()to make a copy of the protocol string array if you need to.
- has_interface(interfacename: str) bool#
 Check if
factoryimplements the interface with nameinterfacename.- Parameters:
 interfacename – an interface name
- classmethod list_filter(caps: Caps, direction: PadDirection, subsetonly: bool) list[ElementFactory]#
 Filter out all the elementfactories in
listthat can handlecapsin the given direction.If
subsetonlyisTrue, then only the elements whose pads templates are a complete superset ofcapswill be returned. Else any element whose pad templates caps can intersect withcapswill be returned.- Parameters:
 caps – a
Capsdirection – a
PadDirectionto filter onsubsetonly – whether to filter on caps subsets or not.
- classmethod list_get_elements(minrank: Rank) list[ElementFactory]#
 Get a list of factories that match the given
type. Only elements with a rank greater or equal tominrankwill be returned. The list of factories is returned by decreasing rank.- Parameters:
 minrank – Minimum rank
- list_is_type(type: int) bool#
 Check if
factoryis of the given types.- Parameters:
 type – a
ElementFactoryListType
- classmethod make(name: str | None = None) Element | 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.- Parameters:
 name – name of new element, or
Noneto automatically create a unique name
- classmethod make_with_properties(names: list[str] | None = None, values: list[Value] | None = None) Element | None#
 Create a new element of the type defined by the given elementfactory. The supplied list of properties, will be passed at object construction.
Added in version 1.20.
- Parameters:
 names – array of properties names
values – array of associated properties values