Class Plugin
- All Implemented Interfaces:
Proxy
GstElement
instances can be loaded at runtime.
A plugin system can provide one or more of the basic GStreamer
GstPluginFeature
subclasses.
A plugin should export a symbol gst_plugin_desc
that is a
struct of type GstPluginDesc
.
the plugin loader will check the version of the core library the plugin was
linked against and will create a new GstPlugin
. It will then call the
GstPluginInitFunc
function that was provided in the
gst_plugin_desc
.
Once you have a handle to a GstPlugin
(e.g. from the GstRegistry
), you
can add any object that subclasses GstPluginFeature
.
Usually plugins are always automatically loaded so you don't need to call gst_plugin_load() explicitly to bring it into memory. There are options to statically link plugins to an app or even use GStreamer without a plugin repository in which case gst_plugin_load() can be needed to bring the plugin into memory.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Plugin.Builder<B extends Plugin.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.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
ConstructorDescriptionPlugin
(MemorySegment address) Create a Plugin proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDependency
(@Nullable String[] envVars, @Nullable String[] paths, @Nullable String[] names, Set<PluginDependencyFlags> flags) Make GStreamer aware of external dependencies which affect the feature set of this plugin (ie.void
addDependency
(@Nullable String[] envVars, @Nullable String[] paths, @Nullable String[] names, PluginDependencyFlags... flags) Make GStreamer aware of external dependencies which affect the feature set of this plugin (ie.void
addDependencySimple
(@Nullable String envVars, @Nullable String paths, @Nullable String names, Set<PluginDependencyFlags> flags) Make GStreamer aware of external dependencies which affect the feature set of this plugin (ie.void
addDependencySimple
(@Nullable String envVars, @Nullable String paths, @Nullable String names, PluginDependencyFlags... flags) Make GStreamer aware of external dependencies which affect the feature set of this plugin (ie.void
addStatusError
(String message) void
addStatusInfo
(String message) void
addStatusWarning
(String message) protected Plugin
asParent()
Returns this instance as if it were its parent type.static Plugin.Builder
<? extends Plugin.Builder> builder()
APlugin.Builder
object constructs aPlugin
with the specified properties.Gets the plugin specific data cache.Get the long descriptive name of the pluginget the filename of the pluginget the license of the plugingetName()
Get the short name of the pluginget the URL where the plugin comes fromget the package the plugin belongs to.Get the release date (and possibly time) in form of a string, if available.get the source module the plugin belongs to.String[]
String[]
String[]
static Type
getType()
Get the GType of the Plugin classget the version of the pluginboolean
isLoaded()
queries if the plugin is loaded into memorystatic void
Unrefs each member oflist
, then frees the list.load()
Loads this Plugin.static Plugin
loadByName
(String name) Load the named plugin.static Plugin
Loads the given plugin and refs it.static boolean
registerStatic
(int majorVersion, int minorVersion, String name, String description, PluginInitFunc initFunc, String version, String license, String source, String package_, String origin) Registers a static plugin, ie.static boolean
registerStaticFull
(int majorVersion, int minorVersion, String name, String description, PluginInitFullFunc initFullFunc, String version, String license, String source, String package_, String origin) Registers a static plugin, ie.void
setCacheData
(Structure cacheData) Adds plugin specific data to cache.Methods inherited from class org.freedesktop.gstreamer.gst.GstObject
addControlBinding, checkUniqueness, deepNotify, defaultDeepNotify, defaultError, emitDeepNotify, getControlBinding, getControlRate, getGValueArray, getMemoryLayout, 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
-
Plugin
Create a Plugin 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. -
listFree
-
loadByName
-
loadFile
Loads the given plugin and refs it. Caller needs to unref after use.- Parameters:
filename
- the plugin filename to load- Returns:
- a reference to the existing loaded GstPlugin, a
reference to the newly-loaded GstPlugin, or
null
if an error occurred. - Throws:
GErrorException
- seeGError
-
registerStatic
public static boolean registerStatic(int majorVersion, int minorVersion, String name, String description, PluginInitFunc initFunc, String version, String license, String source, String package_, String origin) Registers a static plugin, ie. a plugin which is private to an application or library and contained within the application or library (as opposed to being shipped as a separate module file).You must make sure that GStreamer has been initialised (with gst_init() or via gst_init_get_option_group()) before calling this function.
- Parameters:
majorVersion
- the major version number of the GStreamer core that the plugin was compiled for, you can just use GST_VERSION_MAJOR hereminorVersion
- the minor version number of the GStreamer core that the plugin was compiled for, you can just use GST_VERSION_MINOR herename
- a unique name of the plugin (ideally prefixed with an application- or library-specific namespace prefix in order to avoid name conflicts in case a similar plugin with the same name ever gets added to GStreamer)description
- description of the plugininitFunc
- pointer to the init function of this plugin.version
- version string of the pluginlicense
- effective license of plugin. Must be one of the approved licenses (seeGstPluginDesc
above) or the plugin will not be registered.source
- source module plugin belongs topackage_
- shipped package plugin belongs toorigin
- URL to provider of plugin- Returns:
true
if the plugin was registered correctly, otherwisefalse
.
-
registerStaticFull
public static boolean registerStaticFull(int majorVersion, int minorVersion, String name, String description, PluginInitFullFunc initFullFunc, String version, String license, String source, String package_, String origin) Registers a static plugin, ie. a plugin which is private to an application or library and contained within the application or library (as opposed to being shipped as a separate module file) with aGstPluginInitFullFunc
which allows user data to be passed to the callback function (useful for bindings).You must make sure that GStreamer has been initialised (with gst_init() or via gst_init_get_option_group()) before calling this function.
- Parameters:
majorVersion
- the major version number of the GStreamer core that the plugin was compiled for, you can just use GST_VERSION_MAJOR hereminorVersion
- the minor version number of the GStreamer core that the plugin was compiled for, you can just use GST_VERSION_MINOR herename
- a unique name of the plugin (ideally prefixed with an application- or library-specific namespace prefix in order to avoid name conflicts in case a similar plugin with the same name ever gets added to GStreamer)description
- description of the plugininitFullFunc
- pointer to the init function with user data of this plugin.version
- version string of the pluginlicense
- effective license of plugin. Must be one of the approved licenses (seeGstPluginDesc
above) or the plugin will not be registered.source
- source module plugin belongs topackage_
- shipped package plugin belongs toorigin
- URL to provider of plugin- Returns:
true
if the plugin was registered correctly, otherwisefalse
.
-
addDependency
public void addDependency(@Nullable @Nullable String[] envVars, @Nullable @Nullable String[] paths, @Nullable @Nullable String[] names, Set<PluginDependencyFlags> flags) Make GStreamer aware of external dependencies which affect the feature set of this plugin (ie. the elements or typefinders associated with it).GStreamer will re-inspect plugins with external dependencies whenever any of the external dependencies change. This is useful for plugins which wrap other plugin systems, e.g. a plugin which wraps a plugin-based visualisation library and makes visualisations available as GStreamer elements, or a codec loader which exposes elements and/or caps dependent on what external codec libraries are currently installed.
- Parameters:
envVars
-null
-terminated array of environment variables affecting the feature set of the plugin (e.g. an environment variable containing paths where to look for additional modules/plugins of a library), ornull
. Environment variable names may be followed by a path component which will be added to the content of the environment variable, e.g. "HOME/.mystuff/plugins".paths
-null
-terminated array of directories/paths where dependent files may be, ornull
.names
-null
-terminated array of file names (or file name suffixes, depending onflags
) to be used in combination with the paths frompaths
and/or the paths extracted from the environment variables inenvVars
, ornull
.flags
- optional flags, orGST_PLUGIN_DEPENDENCY_FLAG_NONE
-
addDependency
public void addDependency(@Nullable @Nullable String[] envVars, @Nullable @Nullable String[] paths, @Nullable @Nullable String[] names, PluginDependencyFlags... flags) Make GStreamer aware of external dependencies which affect the feature set of this plugin (ie. the elements or typefinders associated with it).GStreamer will re-inspect plugins with external dependencies whenever any of the external dependencies change. This is useful for plugins which wrap other plugin systems, e.g. a plugin which wraps a plugin-based visualisation library and makes visualisations available as GStreamer elements, or a codec loader which exposes elements and/or caps dependent on what external codec libraries are currently installed.
- Parameters:
envVars
-null
-terminated array of environment variables affecting the feature set of the plugin (e.g. an environment variable containing paths where to look for additional modules/plugins of a library), ornull
. Environment variable names may be followed by a path component which will be added to the content of the environment variable, e.g. "HOME/.mystuff/plugins".paths
-null
-terminated array of directories/paths where dependent files may be, ornull
.names
-null
-terminated array of file names (or file name suffixes, depending onflags
) to be used in combination with the paths frompaths
and/or the paths extracted from the environment variables inenvVars
, ornull
.flags
- optional flags, orGST_PLUGIN_DEPENDENCY_FLAG_NONE
-
addDependencySimple
public void addDependencySimple(@Nullable @Nullable String envVars, @Nullable @Nullable String paths, @Nullable @Nullable String names, Set<PluginDependencyFlags> flags) Make GStreamer aware of external dependencies which affect the feature set of this plugin (ie. the elements or typefinders associated with it).GStreamer will re-inspect plugins with external dependencies whenever any of the external dependencies change. This is useful for plugins which wrap other plugin systems, e.g. a plugin which wraps a plugin-based visualisation library and makes visualisations available as GStreamer elements, or a codec loader which exposes elements and/or caps dependent on what external codec libraries are currently installed.
Convenience wrapper function for gst_plugin_add_dependency() which takes simple strings as arguments instead of string arrays, with multiple arguments separated by predefined delimiters (see above).
- Parameters:
envVars
- one or more environment variables (separated by ':', ';' or ','), ornull
. Environment variable names may be followed by a path component which will be added to the content of the environment variable, e.g. "HOME/.mystuff/plugins:MYSTUFF_PLUGINS_PATH"paths
- one ore more directory paths (separated by ':' or ';' or ','), ornull
. Example: "/usr/lib/mystuff/plugins"names
- one or more file names or file name suffixes (separated by commas), ornull
flags
- optional flags, orGST_PLUGIN_DEPENDENCY_FLAG_NONE
-
addDependencySimple
public void addDependencySimple(@Nullable @Nullable String envVars, @Nullable @Nullable String paths, @Nullable @Nullable String names, PluginDependencyFlags... flags) Make GStreamer aware of external dependencies which affect the feature set of this plugin (ie. the elements or typefinders associated with it).GStreamer will re-inspect plugins with external dependencies whenever any of the external dependencies change. This is useful for plugins which wrap other plugin systems, e.g. a plugin which wraps a plugin-based visualisation library and makes visualisations available as GStreamer elements, or a codec loader which exposes elements and/or caps dependent on what external codec libraries are currently installed.
Convenience wrapper function for gst_plugin_add_dependency() which takes simple strings as arguments instead of string arrays, with multiple arguments separated by predefined delimiters (see above).
- Parameters:
envVars
- one or more environment variables (separated by ':', ';' or ','), ornull
. Environment variable names may be followed by a path component which will be added to the content of the environment variable, e.g. "HOME/.mystuff/plugins:MYSTUFF_PLUGINS_PATH"paths
- one ore more directory paths (separated by ':' or ';' or ','), ornull
. Example: "/usr/lib/mystuff/plugins"names
- one or more file names or file name suffixes (separated by commas), ornull
flags
- optional flags, orGST_PLUGIN_DEPENDENCY_FLAG_NONE
-
addStatusError
-
addStatusInfo
-
addStatusWarning
-
getCacheData
Gets the plugin specific data cache. If it isnull
there is no cached data stored. This is the case when the registry is getting rebuilt.- Returns:
- The cached data as a
GstStructure
ornull
.
-
getDescription
Get the long descriptive name of the plugin- Returns:
- the long name of the plugin
-
getFilename
-
getLicense
-
getName
-
getOrigin
-
getPackage
get the package the plugin belongs to.- Returns:
- the package of the plugin
-
getReleaseDateString
Get the release date (and possibly time) in form of a string, if available.For normal GStreamer plugin releases this will usually just be a date in the form of "YYYY-MM-DD", while pre-releases and builds from git may contain a time component after the date as well, in which case the string will be formatted like "YYYY-MM-DDTHH:MMZ" (e.g. "2012-04-30T09:30Z").
There may be plugins that do not have a valid release date set on them.
- Returns:
- the date string of the plugin, or
null
if not available.
-
getSource
get the source module the plugin belongs to.- Returns:
- the source of the plugin
-
getStatusErrors
-
getStatusInfos
-
getStatusWarnings
-
getVersion
-
isLoaded
public boolean isLoaded()queries if the plugin is loaded into memory- Returns:
true
is loaded,false
otherwise
-
load
Loads this Plugin. Note that the *return value* is the loaded plugin; this Plugin is untouched. The normal use pattern of this function goes like this:GstPlugin *loaded_plugin; loaded_plugin = gst_plugin_load (plugin); // presumably, we're no longer interested in the potentially-unloaded plugin gst_object_unref (plugin); plugin = loaded_plugin;
- Returns:
- a reference to a loaded plugin, or
null
on error.
-
setCacheData
Adds plugin specific data to cache. Passes the ownership of the structure to the this Plugin.The cache is flushed every time the registry is rebuilt.
- Parameters:
cacheData
- a structure containing the data to cache
-
builder
APlugin.Builder
object constructs aPlugin
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withPlugin.Builder.build()
.
-