Package org.freedesktop.gstreamer.gst
Class ElementFactory
- All Implemented Interfaces:
Proxy
GstElementFactory
is used to create instances of elements. A
GstElementFactory can be added to a GstPlugin
as it is also a
GstPluginFeature
.
Use the gst_element_factory_find() and gst_element_factory_create() functions to create element instances or use gst_element_factory_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);
...
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
ElementFactory.Builder<B extends ElementFactory.Builder<B>>
Inner class implementing a builder pattern to construct a GObject with properties.static class
Nested classes/interfaces inherited from class org.freedesktop.gstreamer.gst.PluginFeature
PluginFeature.PluginFeatureClass, PluginFeature.PluginFeatureImpl
Nested classes/interfaces inherited from class org.freedesktop.gstreamer.gst.GstObject
GstObject.DeepNotifyCallback, GstObject.ObjectClass, GstObject.ObjectImpl
Nested classes/interfaces inherited from class org.gnome.gobject.InitiallyUnowned
InitiallyUnowned.InitiallyUnownedClass
Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback
-
Constructor Summary
ConstructorDescriptionElementFactory
(MemorySegment address) Create a ElementFactory proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected ElementFactory
asParent()
Returns this instance as if it were its parent type.static ElementFactory.Builder
<? extends ElementFactory.Builder> builder()
AElementFactory.Builder
object constructs aElementFactory
with the specified properties.boolean
canSinkAllCaps
(Caps caps) Checks if the factory can sink all possible capabilities.boolean
canSinkAnyCaps
(Caps caps) Checks if the factory can sink any possible capability.boolean
canSrcAllCaps
(Caps caps) Checks if the factory can src all possible capabilities.boolean
canSrcAnyCaps
(Caps caps) Checks if the factory can src any possible capability.Create a new element of the type defined by the given elementfactory.createFull
(@Nullable String first, Object... varargs) Create a new element of the type defined by the given elementfactory.createWithProperties
(@Nullable String[] names, @Nullable Value[] values) Create a new element of the type defined by the given elementfactory.static ElementFactory
Search for an element factory of the given name.Get theGType
for elements managed by this factory.getMetadata
(String key) Get the metadata on this ElementFactory withkey
.String[]
Get the available keys for the metadata on this ElementFactory.int
Gets the number of pad_templates in this factory.boolean
Queries whether registered element managed by this ElementFactory needs to be excluded from documentation system or not.Gets theGList
ofGstStaticPadTemplate
for this factory.static Type
getType()
Get the GType of the ElementFactory classString[]
Gets anull
-terminated array of protocols this element supports ornull
if no protocols are supported.Gets the type of URIs the element supports orGST_URI_UNKNOWN
if none.boolean
hasInterface
(String interfacename) Check if this ElementFactory implements the interface with nameinterfacename
.static List
<ElementFactory> listFilter
(List<ElementFactory> list, Caps caps, PadDirection direction, boolean subsetonly) Filter out all the elementfactories inlist
that can handlecaps
in the given direction.static List
<ElementFactory> listGetElements
(ElementFactoryListType type, Rank minrank) Get a list of factories that match the giventype
.boolean
Check if this ElementFactory is of the given types.static Element
Create a new element of the type defined by the given element factory.static Element
Create a new element of the type defined by the given element factory.static Element
makeWithProperties
(String factoryname, @Nullable String[] names, @Nullable Value[] values) Create a new element of the type defined by the given elementfactory.Methods inherited from class org.freedesktop.gstreamer.gst.PluginFeature
checkVersion, getPlugin, getPluginName, getRank, listCopy, listDebug, listFree, load, rankCompareFunc, setRank
Methods inherited from class org.freedesktop.gstreamer.gst.GstObject
addControlBinding, checkUniqueness, deepNotify, defaultDeepNotify, defaultError, emitDeepNotify, getControlBinding, getControlRate, getGValueArray, getMemoryLayout, getName, getParent, getPathString, getValue, getValueArray, hasActiveControlBindings, hasAncestor, hasAsAncestor, hasAsParent, onDeepNotify, ref, refSink, removeControlBinding, replace, setControlBindingDisabled, setControlBindingsDisabled, setControlRate, setName, setParent, suggestNextSync, syncValues, unparent, unref
Methods inherited from class org.gnome.gobject.GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newInstance, newInstance, newv, notify_, notify_, notifyByPspec, onNotify, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, watchClosure, weakRef, weakUnref, withProperties
Methods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, getPrivate, readGClass, writeGClass
Methods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
ElementFactory
Create a ElementFactory proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
-
Method Details
-
getType
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuper
keyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()
doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName()
. This will call the native function pointer of this virtual method in the typeclass of the parent type.- Overrides:
asParent
in classPluginFeature
-
find
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- Returns:
GstElementFactory
if found,null
otherwise
-
listFilter
public static List<ElementFactory> listFilter(List<ElementFactory> list, Caps caps, PadDirection direction, boolean subsetonly) Filter out all the elementfactories inlist
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
- aGList
ofGstElementFactory
to filtercaps
- aGstCaps
direction
- aGstPadDirection
to filter onsubsetonly
- whether to filter on caps subsets or not.- Returns:
- a
GList
ofGstElementFactory
elements that match the given requisites. Usegst_plugin_feature_list_free
after usage.
-
listGetElements
Get a list of factories that match the giventype
. Only elements with a rank greater or equal tominrank
will be returned. The list of factories is returned by decreasing rank.- Parameters:
type
- aGstElementFactoryListType
minrank
- Minimum rank- Returns:
- a
GList
ofGstElementFactory
elements. Use gst_plugin_feature_list_free() after usage.
-
make
Create a new element of the type defined by the given element factory. If name isnull
, 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 instantiatename
- name of new element, ornull
to automatically create a unique name- Returns:
- new
GstElement
ornull
if unable to create element
-
makeFull
public static Element makeFull(String factoryname, @Nullable @Nullable String first, Object... varargs) Create a new element of the type defined by the given element factory. The supplied list of properties, will be passed at object construction.- Parameters:
factoryname
- a named factory to instantiatefirst
- name of first propertyvarargs
-null
terminated list of properties- Returns:
- new
GstElement
ornull
if unable to create element
-
makeWithProperties
public static Element makeWithProperties(String factoryname, @Nullable @Nullable String[] names, @Nullable @Nullable Value[] values) Create a new element of the type defined by the given elementfactory. The supplied list of properties, will be passed at object construction.- Parameters:
factoryname
- a named factory to instantiatenames
- array of properties namesvalues
- array of associated properties values- Returns:
- new
GstElement
ornull
if the element couldn't be created
-
canSinkAllCaps
Checks if the factory can sink all possible capabilities.- Parameters:
caps
- the caps to check- Returns:
true
if the caps are fully compatible.
-
canSinkAnyCaps
Checks if the factory can sink any possible capability.- Parameters:
caps
- the caps to check- Returns:
true
if the caps have a common subset.
-
canSrcAllCaps
Checks if the factory can src all possible capabilities.- Parameters:
caps
- the caps to check- Returns:
true
if the caps are fully compatible.
-
canSrcAnyCaps
Checks if the factory can src any possible capability.- Parameters:
caps
- the caps to check- Returns:
true
if the caps have a common subset.
-
create
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, ornull
to automatically create a unique name- Returns:
- new
GstElement
ornull
if the element couldn't be created
-
createFull
Create a new element of the type defined by the given elementfactory. The supplied list of properties, will be passed at object construction.- Parameters:
first
- name of the first propertyvarargs
-null
terminated list of properties- Returns:
- new
GstElement
ornull
if the element couldn't be created
-
createWithProperties
public Element createWithProperties(@Nullable @Nullable String[] names, @Nullable @Nullable Value[] values) Create a new element of the type defined by the given elementfactory. The supplied list of properties, will be passed at object construction.- Parameters:
names
- array of properties namesvalues
- array of associated properties values- Returns:
- new
GstElement
ornull
if the element couldn't be created
-
getElementType
Get theGType
for elements managed by this factory. The type can only be retrieved if the element factory is loaded, which can be assured with gst_plugin_feature_load().- Returns:
- the
GType
for elements managed by this factory or 0 if the factory is not loaded.
-
getMetadata
-
getMetadataKeys
Get the available keys for the metadata on this ElementFactory.- Returns:
- a
null
-terminated array of key strings, ornull
when there is no metadata. Free with g_strfreev() when no longer needed.
-
getNumPadTemplates
public int getNumPadTemplates()Gets the number of pad_templates in this factory.- Returns:
- the number of pad_templates
-
getSkipDocumentation
public boolean getSkipDocumentation()Queries whether registered element managed by this ElementFactory needs to be excluded from documentation system or not.- Returns:
true
if documentation should be skipped
-
getStaticPadTemplates
Gets theGList
ofGstStaticPadTemplate
for this factory.- Returns:
- the static pad templates
-
getUriProtocols
Gets anull
-terminated array of protocols this element supports ornull
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.- Returns:
- the supported protocols
or
null
-
getUriType
Gets the type of URIs the element supports orGST_URI_UNKNOWN
if none.- Returns:
- type of URIs this element supports
-
hasInterface
Check if this ElementFactory implements the interface with nameinterfacename
.- Parameters:
interfacename
- an interface name- Returns:
true
when this ElementFactory implement the interface.
-
listIsType
Check if this ElementFactory is of the given types.- Parameters:
type
- aGstElementFactoryListType
- Returns:
true
if this ElementFactory is oftype
.
-
builder
AElementFactory.Builder
object constructs aElementFactory
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withElementFactory.Builder.build()
.
-