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
None
to automatically create a unique name
- create_with_properties(names: Sequence[str] | None = None, values: Sequence[Any] | 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
- find(name: str) ElementFactory | None
Search for an element factory of the given name. Refs the returned element factory; caller is responsible for unreffing.
- Parameters:
name – name of factory to find
- get_element_type() type
Get the
Type
for 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
factory
needs to be excluded from documentation system or not.Added in version 1.20.
- get_static_pad_templates() list[StaticPadTemplate]
Gets the
GList
ofStaticPadTemplate
for this factory.
- get_uri_protocols() list[str]
Gets a
None
-terminated array of protocols this element supports orNone
if 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
factory
implements the interface with nameinterfacename
.- Parameters:
interfacename – an interface name
- list_filter(list: list[ElementFactory], caps: Caps, direction: PadDirection, subsetonly: bool) list[ElementFactory]
Filter out all the elementfactories in
list
that can handlecaps
in the given direction.If
subsetonly
isTrue
, then only the elements whose pads templates are a complete superset ofcaps
will be returned. Else any element whose pad templates caps can intersect withcaps
will be returned.- Parameters:
list – a
GList
ofElementFactory
to filtercaps – a
Caps
direction – a
PadDirection
to filter onsubsetonly – whether to filter on caps subsets or not.
- list_get_elements(type: int, minrank: Rank) list[ElementFactory]
Get a list of factories that match the given
type
. Only elements with a rank greater or equal tominrank
will be returned. The list of factories is returned by decreasing rank.- Parameters:
type – a
ElementFactoryListType
minrank – Minimum rank
- list_is_type(type: int) bool
Check if
factory
is of the given types.- Parameters:
type – a
ElementFactoryListType
- make(factoryname: str, 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:
factoryname – a named factory to instantiate
name – name of new element, or
None
to automatically create a unique name
- make_with_properties(factoryname: str, names: Sequence[str] | None = None, values: Sequence[Any] | 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:
factoryname – a named factory to instantiate
names – array of properties names
values – array of associated properties values