Package org.freedesktop.gstreamer.gst
Class ElementFactory
java.lang.Object
org.javagi.base.ProxyInstance
org.gnome.gobject.TypeInstance
org.gnome.gobject.GObject
org.gnome.gobject.InitiallyUnowned
org.freedesktop.gstreamer.gst.GstObject
org.freedesktop.gstreamer.gst.PluginFeature
org.freedesktop.gstreamer.gst.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
Nested ClassesModifier and TypeClassDescriptionstatic classElementFactory.Builder<B extends ElementFactory.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.static classNested classes/interfaces inherited from class org.freedesktop.gstreamer.gst.PluginFeature
PluginFeature.PluginFeature$Impl, PluginFeature.PluginFeatureClassNested classes/interfaces inherited from class org.freedesktop.gstreamer.gst.GstObject
GstObject.DeepNotifyCallback, GstObject.Object$Impl, GstObject.ObjectClassNested classes/interfaces inherited from class org.gnome.gobject.InitiallyUnowned
InitiallyUnowned.InitiallyUnownedClassNested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new ElementFactory.ElementFactory(MemorySegment address) Create a ElementFactory proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected ElementFactoryasParent()Returns this instance as if it were its parent type.static ElementFactory.Builder<? extends ElementFactory.Builder> builder()AElementFactory.Builderobject constructs aElementFactorywith the specified properties.booleancanSinkAllCaps(Caps caps) Checks if the factory can sink all possible capabilities.booleancanSinkAnyCaps(Caps caps) Checks if the factory can sink any possible capability.booleancanSrcAllCaps(Caps caps) Checks if the factory can src all possible capabilities.booleancanSrcAnyCaps(Caps caps) Checks if the factory can src any possible capability.@Nullable ElementCreate a new element of the type defined by the given elementfactory.@Nullable ElementcreateFull(@Nullable String first, Object... varargs) Create a new element of the type defined by the given elementfactory.@Nullable ElementcreateWithProperties(@Nullable String @Nullable [] names, @Nullable Value @Nullable [] values) Create a new element of the type defined by the given elementfactory.static @Nullable ElementFactorySearch for an element factory of the given name.Get theGTypefor elements managed by this factory.@Nullable StringgetMetadata(String key) Get the metadata on this ElementFactory withkey.@Nullable String @Nullable []Get the available keys for the metadata onfactory.intGets the number of pad_templates in this factory.booleanQueries whether registered element managed by this ElementFactory needs to be excluded from documentation system or not.Gets theGListofGstStaticPadTemplatefor this factory.static @Nullable TypegetType()Get the GType of the ElementFactory classString[]Gets anull-terminated array of protocols this element supports ornullif no protocols are supported.Gets the type of URIs the element supports orGST_URI_UNKNOWNif none.booleanhasInterface(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 inlistthat can handlecapsin the given direction.static List<ElementFactory> listGetElements(ElementFactoryListType type, Rank minrank) Get a list of factories that match the giventype.Only elements with a rank greater or equal tominrankwill be returned.booleanCheck if this ElementFactory is of the given types.static @Nullable ElementCreate a new element of the type defined by the given element factory.static @Nullable ElementCreate a new element of the type defined by the given element factory.static @Nullable ElementmakeWithProperties(String factoryname, @Nullable String @Nullable [] names, @Nullable Value @Nullable [] 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, setRankMethods 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, unrefMethods 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, 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, withPropertiesMethods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class org.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
-
ElementFactory
public ElementFactory()Creates a new ElementFactory.
-
-
Method Details
-
getType
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuperkeyword, 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:
asParentin 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:
GstElementFactoryif found,nullotherwise
-
listFilter
public static List<ElementFactory> listFilter(List<ElementFactory> list, Caps caps, PadDirection direction, boolean subsetonly) Filter out all the elementfactories inlistthat 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:
list- aGListofGstElementFactoryto filtercaps- aGstCapsdirection- aGstPadDirectionto filter onsubsetonly- whether to filter on caps subsets or not.- Returns:
- a
GListofGstElementFactoryelements that match the given requisites. Usegst_plugin_feature_list_freeafter usage.
-
listGetElements
Get a list of factories that match the giventype.Only elements with a rank greater or equal tominrankwill be returned. The list of factories is returned by decreasing rank.- Parameters:
type- aGstElementFactoryListTypeminrank- Minimum rank- Returns:
- a
GListofGstElementFactoryelements. 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, ornullto automatically create a unique name- Returns:
- new
GstElementornullif unable to create element
-
makeFull
public static @Nullable Element makeFull(String factoryname, @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-nullterminated list of properties- Returns:
- new
GstElementornullif unable to create element - Since:
- 1.20
-
makeWithProperties
public static @Nullable Element makeWithProperties(String factoryname, @Nullable String @Nullable [] names, @Nullable Value @Nullable [] 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
GstElementornullif the element couldn't be created - Since:
- 1.20
-
canSinkAllCaps
Checks if the factory can sink all possible capabilities.- Parameters:
caps- the caps to check- Returns:
trueif the caps are fully compatible.
-
canSinkAnyCaps
Checks if the factory can sink any possible capability.- Parameters:
caps- the caps to check- Returns:
trueif the caps have a common subset.
-
canSrcAllCaps
Checks if the factory can src all possible capabilities.- Parameters:
caps- the caps to check- Returns:
trueif the caps are fully compatible.
-
canSrcAnyCaps
Checks if the factory can src any possible capability.- Parameters:
caps- the caps to check- Returns:
trueif 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, ornullto automatically create a unique name- Returns:
- new
GstElementornullif 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-nullterminated list of properties- Returns:
- new
GstElementornullif the element couldn't be created - Since:
- 1.20
-
createWithProperties
public @Nullable Element createWithProperties(@Nullable String @Nullable [] names, @Nullable Value @Nullable [] 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
GstElementornullif the element couldn't be created - Since:
- 1.20
-
getElementType
Get theGTypefor 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
GTypefor elements managed by this factory or 0 if the factory is not loaded.
-
getMetadata
-
getMetadataKeys
Get the available keys for the metadata onfactory.- Returns:
- a
null-terminated array of key strings, ornullwhen 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:
trueif documentation should be skipped- Since:
- 1.20
-
getStaticPadTemplates
Gets theGListofGstStaticPadTemplatefor this factory.- Returns:
- the static pad templates
-
getUriProtocols
Gets anull-terminated array of protocols this element supports ornullif 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_UNKNOWNif none.- Returns:
- type of URIs this element supports
-
hasInterface
Check if this ElementFactory implements the interface with nameinterfacename.- Parameters:
interfacename- an interface name- Returns:
truewhen this ElementFactory implement the interface.
-
listIsType
Check if this ElementFactory is of the given types.- Parameters:
type- aGstElementFactoryListType- Returns:
trueif this ElementFactory is oftype.
-
builder
AElementFactory.Builderobject constructs aElementFactorywith the specified properties. Use the variousset...()methods to set properties, and finish construction withElementFactory.Builder.build().- Returns:
- the builder object
-