:right-sidebar: True Plugin =================================================================== .. currentmodule:: gi.repository.Gst .. class:: Plugin(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.Gst.Object`, :class:`~gi.repository.GObject.InitiallyUnowned`, :class:`~gi.repository.GObject.Object` GStreamer is extensible, so :obj:`~gi.repository.Gst.Element` instances can be loaded at runtime. A plugin system can provide one or more of the basic GStreamer :obj:`~gi.repository.Gst.PluginFeature` 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 :obj:`~gi.repository.Gst.Plugin`\. It will then call the :obj:`~gi.repository.Gst.PluginInitFunc` function that was provided in the ``gst_plugin_desc``\. Once you have a handle to a :obj:`~gi.repository.Gst.Plugin` (e.g. from the :obj:`~gi.repository.Gst.Registry`\), you can add any object that subclasses :obj:`~gi.repository.Gst.PluginFeature`\. Usually plugins are always automatically loaded so you don't need to call :func:`~gi.repository.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 :func:`~gi.repository.Gst.Plugin.load` can be needed to bring the plugin into memory. Methods ------- .. rst-class:: interim-class .. class:: Plugin :no-index: .. method:: add_dependency(env_vars: list[str] | None, paths: list[str] | None, names: list[str] | None, flags: ~gi.repository.Gst.PluginDependencyFlags) -> None 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. :param env_vars: :const:`None`-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), or :const:`None`. 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". :param paths: :const:`None`-terminated array of directories/paths where dependent files may be, or :const:`None`. :param names: :const:`None`-terminated array of file names (or file name suffixes, depending on ``flags``\) to be used in combination with the paths from ``paths`` and/or the paths extracted from the environment variables in ``env_vars``\, or :const:`None`. :param flags: optional flags, or ``GST_PLUGIN_DEPENDENCY_FLAG_NONE`` .. method:: add_dependency_simple(env_vars: str | None, paths: str | None, names: str | None, flags: ~gi.repository.Gst.PluginDependencyFlags) -> None 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 :func:`~gi.repository.Gst.Plugin.add_dependency` which takes simple strings as arguments instead of string arrays, with multiple arguments separated by predefined delimiters (see above). :param env_vars: one or more environment variables (separated by ':', ';' or ','), or :const:`None`. 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" :param paths: one ore more directory paths (separated by ':' or ';' or ','), or :const:`None`. Example: "/usr/lib/mystuff/plugins" :param names: one or more file names or file name suffixes (separated by commas), or :const:`None` :param flags: optional flags, or ``GST_PLUGIN_DEPENDENCY_FLAG_NONE`` .. method:: add_status_error(message: str) -> None .. versionadded:: 1.24 :param message: the status error message .. method:: add_status_info(message: str) -> None .. versionadded:: 1.24 :param message: the status info message .. method:: add_status_warning(message: str) -> None .. versionadded:: 1.24 :param message: the status warning message .. method:: get_cache_data() -> ~gi.repository.Gst.Structure | None Gets the plugin specific data cache. If it is :const:`None` there is no cached data stored. This is the case when the registry is getting rebuilt. .. method:: get_description() -> str Get the long descriptive name of the plugin .. method:: get_filename() -> str | None get the filename of the plugin .. method:: get_license() -> str get the license of the plugin .. method:: get_name() -> str Get the short name of the plugin .. method:: get_origin() -> str get the URL where the plugin comes from .. method:: get_package() -> str get the package the plugin belongs to. .. method:: get_release_date_string() -> str | None 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. .. method:: get_source() -> str get the source module the plugin belongs to. .. method:: get_status_errors() -> list[str] | None .. versionadded:: 1.24 .. method:: get_status_infos() -> list[str] | None .. versionadded:: 1.24 .. method:: get_status_warnings() -> list[str] | None .. versionadded:: 1.24 .. method:: get_version() -> str get the version of the plugin .. method:: is_loaded() -> bool queries if the plugin is loaded into memory .. classmethod:: list_free() -> None Unrefs each member of ``list``\, then frees the list. .. method:: load() -> ~gi.repository.Gst.Plugin | None Loads ``plugin``\. Note that the *return value* is the loaded plugin; ``plugin`` is untouched. The normal use pattern of this function goes like this: .. code-block:: :dedent: 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; .. classmethod:: load_by_name() -> ~gi.repository.Gst.Plugin | None Load the named plugin. Refs the plugin. .. classmethod:: load_file() -> ~gi.repository.Gst.Plugin Loads the given plugin and refs it. Caller needs to unref after use. .. classmethod:: register_static(minor_version: int, name: str, description: str, init_func: ~typing.Callable[[~gi.repository.Gst.Plugin], bool], version: str, license: str, source: str, package: str, origin: str) -> bool 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 :func:`~gi.repository.Gst.init` or via :func:`~gi.repository.Gst.init_get_option_group`) before calling this function. :param minor_version: the minor version number of the GStreamer core that the plugin was compiled for, you can just use GST_VERSION_MINOR here :param name: 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) :param description: description of the plugin :param init_func: pointer to the init function of this plugin. :param version: version string of the plugin :param license: effective license of plugin. Must be one of the approved licenses (see ``GstPluginDesc`` above) or the plugin will not be registered. :param source: source module plugin belongs to :param package: shipped package plugin belongs to :param origin: URL to provider of plugin .. classmethod:: register_static_full(minor_version: int, name: str, description: str, init_full_func: ~typing.Callable[[~gi.repository.Gst.Plugin, ~typing.Any], bool], version: str, license: str, source: str, package: str, origin: str, user_data: ~typing.Any = None) -> bool 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 a :obj:`~gi.repository.Gst.PluginInitFullFunc` which allows user data to be passed to the callback function (useful for bindings). You must make sure that GStreamer has been initialised (with :func:`~gi.repository.Gst.init` or via :func:`~gi.repository.Gst.init_get_option_group`) before calling this function. :param minor_version: the minor version number of the GStreamer core that the plugin was compiled for, you can just use GST_VERSION_MINOR here :param name: 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) :param description: description of the plugin :param init_full_func: pointer to the init function with user data of this plugin. :param version: version string of the plugin :param license: effective license of plugin. Must be one of the approved licenses (see ``GstPluginDesc`` above) or the plugin will not be registered. :param source: source module plugin belongs to :param package: shipped package plugin belongs to :param origin: URL to provider of plugin :param user_data: gpointer to user data .. method:: set_cache_data(cache_data: ~gi.repository.Gst.Structure) -> None Adds plugin specific data to cache. Passes the ownership of the structure to the ``plugin``\. The cache is flushed every time the registry is rebuilt. :param cache_data: a structure containing the data to cache