Copyright | Will Thompson, Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (garetxe@gmail.com) |
Safe Haskell | None |
Language | Haskell2010 |
GI.Gst.Objects.Registry
Contents
Description
One registry holds the metadata of a set of plugins.
<emphasis role="bold">Design:</emphasis>
The Registry
object is a list of plugins and some functions for dealing
with them. Each Plugin
is matched 1-1 with a file on disk, and may or may
not be loaded at a given time.
The primary source, at all times, of plugin information is each plugin file itself. Thus, if an application wants information about a particular plugin, or wants to search for a feature that satisfies given criteria, the primary means of doing so is to load every plugin and look at the resulting information that is gathered in the default registry. Clearly, this is a time consuming process, so we cache information in the registry file. The format and location of the cache file is internal to gstreamer.
On startup, plugins are searched for in the plugin search path. The following locations are checked in this order: <itemizedlist> <listitem> <para>location from --gst-plugin-path commandline option.</para> </listitem> <listitem> <para>the GST_PLUGIN_PATH environment variable.</para> </listitem> <listitem> <para>the GST_PLUGIN_SYSTEM_PATH environment variable.</para> </listitem> <listitem> <para>default locations (if GST_PLUGIN_SYSTEM_PATH is not set). Those default locations are: <filename>$XDG_DATA_HOME/gstreamer-$GST_API_VERSION/plugins/</filename> and <filename>$prefix/libs/gstreamer-$GST_API_VERSION/</filename>. <ulink url="http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html"> <filename>$XDG_DATA_HOME</filename></ulink> defaults to <filename>$HOME/.local/share</filename>. </para> </listitem> </itemizedlist> The registry cache file is loaded from <filename>$XDG_CACHE_HOME/gstreamer-$GST_API_VERSION/registry-$ARCH.bin</filename> (where <ulink url="http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html"> <filename>$XDG_CACHE_HOME</filename></ulink> defaults to <filename>$HOME/.cache</filename>) or the file listed in the GST_REGISTRY env var. One reason to change the registry location is for testing.
For each plugin that is found in the plugin search path, there could be 3 possibilities for cached information: <itemizedlist> <listitem> <para>the cache may not contain information about a given file.</para> </listitem> <listitem> <para>the cache may have stale information.</para> </listitem> <listitem> <para>the cache may have current information.</para> </listitem> </itemizedlist>
In the first two cases, the plugin is loaded and the cache updated. In addition to these cases, the cache may have entries for plugins that are not relevant to the current process. These are marked as not available to the current process. If the cache is updated for whatever reason, it is marked dirty.
A dirty cache is written out at the end of initialization. Each entry is checked to make sure the information is minimally valid. If not, the entry is simply dropped.
<emphasis role="bold">Implementation notes:</emphasis>
The "cache" and "registry" are different concepts and can represent
different sets of plugins. For various reasons, at init time, the cache is
stored in the default registry, and plugins not relevant to the current
process are marked with the PluginFlagsCached
bit. These plugins are
removed at the end of initialization.
- newtype Registry = Registry (ManagedPtr Registry)
- class GObject o => IsRegistry o
- toRegistry :: IsRegistry o => o -> IO Registry
- noRegistry :: Maybe Registry
- data RegistryAddFeatureMethodInfo
- registryAddFeature :: (HasCallStack, MonadIO m, IsRegistry a, IsPluginFeature b) => a -> b -> m Bool
- data RegistryAddPluginMethodInfo
- registryAddPlugin :: (HasCallStack, MonadIO m, IsRegistry a, IsPlugin b) => a -> b -> m Bool
- data RegistryCheckFeatureVersionMethodInfo
- registryCheckFeatureVersion :: (HasCallStack, MonadIO m, IsRegistry a) => a -> Text -> Word32 -> Word32 -> Word32 -> m Bool
- data RegistryFeatureFilterMethodInfo
- registryFeatureFilter :: (HasCallStack, MonadIO m, IsRegistry a) => a -> PluginFeatureFilter -> Bool -> m [PluginFeature]
- data RegistryFindFeatureMethodInfo
- registryFindFeature :: (HasCallStack, MonadIO m, IsRegistry a) => a -> Text -> GType -> m (Maybe PluginFeature)
- data RegistryFindPluginMethodInfo
- registryFindPlugin :: (HasCallStack, MonadIO m, IsRegistry a) => a -> Text -> m (Maybe Plugin)
- registryForkIsEnabled :: (HasCallStack, MonadIO m) => m Bool
- registryForkSetEnabled :: (HasCallStack, MonadIO m) => Bool -> m ()
- registryGet :: (HasCallStack, MonadIO m) => m Registry
- data RegistryGetFeatureListMethodInfo
- registryGetFeatureList :: (HasCallStack, MonadIO m, IsRegistry a) => a -> GType -> m [PluginFeature]
- data RegistryGetFeatureListByPluginMethodInfo
- registryGetFeatureListByPlugin :: (HasCallStack, MonadIO m, IsRegistry a) => a -> Text -> m [PluginFeature]
- data RegistryGetFeatureListCookieMethodInfo
- registryGetFeatureListCookie :: (HasCallStack, MonadIO m, IsRegistry a) => a -> m Word32
- data RegistryGetPluginListMethodInfo
- registryGetPluginList :: (HasCallStack, MonadIO m, IsRegistry a) => a -> m [Plugin]
- data RegistryLookupMethodInfo
- registryLookup :: (HasCallStack, MonadIO m, IsRegistry a) => a -> Text -> m (Maybe Plugin)
- data RegistryLookupFeatureMethodInfo
- registryLookupFeature :: (HasCallStack, MonadIO m, IsRegistry a) => a -> Text -> m PluginFeature
- data RegistryPluginFilterMethodInfo
- registryPluginFilter :: (HasCallStack, MonadIO m, IsRegistry a) => a -> PluginFilter -> Bool -> m [Plugin]
- data RegistryRemoveFeatureMethodInfo
- registryRemoveFeature :: (HasCallStack, MonadIO m, IsRegistry a, IsPluginFeature b) => a -> b -> m ()
- data RegistryRemovePluginMethodInfo
- registryRemovePlugin :: (HasCallStack, MonadIO m, IsRegistry a, IsPlugin b) => a -> b -> m ()
- data RegistryScanPathMethodInfo
- registryScanPath :: (HasCallStack, MonadIO m, IsRegistry a) => a -> Text -> m Bool
- type C_RegistryFeatureAddedCallback = Ptr () -> Ptr PluginFeature -> Ptr () -> IO ()
- type RegistryFeatureAddedCallback = PluginFeature -> IO ()
- data RegistryFeatureAddedSignalInfo
- afterRegistryFeatureAdded :: (GObject a, MonadIO m) => a -> RegistryFeatureAddedCallback -> m SignalHandlerId
- genClosure_RegistryFeatureAdded :: RegistryFeatureAddedCallback -> IO Closure
- mk_RegistryFeatureAddedCallback :: C_RegistryFeatureAddedCallback -> IO (FunPtr C_RegistryFeatureAddedCallback)
- noRegistryFeatureAddedCallback :: Maybe RegistryFeatureAddedCallback
- onRegistryFeatureAdded :: (GObject a, MonadIO m) => a -> RegistryFeatureAddedCallback -> m SignalHandlerId
- wrap_RegistryFeatureAddedCallback :: RegistryFeatureAddedCallback -> Ptr () -> Ptr PluginFeature -> Ptr () -> IO ()
- type C_RegistryPluginAddedCallback = Ptr () -> Ptr Plugin -> Ptr () -> IO ()
- type RegistryPluginAddedCallback = Plugin -> IO ()
- data RegistryPluginAddedSignalInfo
- afterRegistryPluginAdded :: (GObject a, MonadIO m) => a -> RegistryPluginAddedCallback -> m SignalHandlerId
- genClosure_RegistryPluginAdded :: RegistryPluginAddedCallback -> IO Closure
- mk_RegistryPluginAddedCallback :: C_RegistryPluginAddedCallback -> IO (FunPtr C_RegistryPluginAddedCallback)
- noRegistryPluginAddedCallback :: Maybe RegistryPluginAddedCallback
- onRegistryPluginAdded :: (GObject a, MonadIO m) => a -> RegistryPluginAddedCallback -> m SignalHandlerId
- wrap_RegistryPluginAddedCallback :: RegistryPluginAddedCallback -> Ptr () -> Ptr Plugin -> Ptr () -> IO ()
Exported types
Constructors
Registry (ManagedPtr Registry) |
Instances
GObject Registry Source # | |
IsObject Registry Source # | |
IsObject Registry Source # | |
IsRegistry Registry Source # | |
((~) * info (ResolveRegistryMethod t Registry), MethodInfo * info Registry p) => IsLabel t (Registry -> p) Source # | |
((~) * info (ResolveRegistryMethod t Registry), MethodInfo * info Registry p) => IsLabelProxy t (Registry -> p) Source # | |
HasAttributeList * Registry Source # | |
type AttributeList Registry Source # | |
type SignalList Registry Source # | |
class GObject o => IsRegistry o Source #
Instances
(GObject a, UnknownAncestorError Constraint Registry a) => IsRegistry a Source # | |
IsRegistry Registry Source # | |
toRegistry :: IsRegistry o => o -> IO Registry Source #
Methods
addFeature
data RegistryAddFeatureMethodInfo Source #
Instances
((~) * signature (b -> m Bool), MonadIO m, IsRegistry a, IsPluginFeature b) => MethodInfo * RegistryAddFeatureMethodInfo a signature Source # | |
Arguments
:: (HasCallStack, MonadIO m, IsRegistry a, IsPluginFeature b) | |
=> a |
|
-> b |
|
-> m Bool | Returns: MT safe. |
Add the feature to the registry. The feature-added signal will be emitted.
This function sinks feature
.
addPlugin
data RegistryAddPluginMethodInfo Source #
Instances
((~) * signature (b -> m Bool), MonadIO m, IsRegistry a, IsPlugin b) => MethodInfo * RegistryAddPluginMethodInfo a signature Source # | |
Arguments
:: (HasCallStack, MonadIO m, IsRegistry a, IsPlugin b) | |
=> a |
|
-> b |
|
-> m Bool | Returns: MT safe. |
Add the plugin to the registry. The plugin-added signal will be emitted.
This function will sink plugin
.
checkFeatureVersion
data RegistryCheckFeatureVersionMethodInfo Source #
Instances
((~) * signature (Text -> Word32 -> Word32 -> Word32 -> m Bool), MonadIO m, IsRegistry a) => MethodInfo * RegistryCheckFeatureVersionMethodInfo a signature Source # | |
registryCheckFeatureVersion Source #
Arguments
:: (HasCallStack, MonadIO m, IsRegistry a) | |
=> a |
|
-> Text |
|
-> Word32 |
|
-> Word32 |
|
-> Word32 |
|
-> m Bool | Returns: |
Checks whether a plugin feature by the given name exists in
registry
and whether its version is at least the
version required.
featureFilter
data RegistryFeatureFilterMethodInfo Source #
Instances
((~) * signature (PluginFeatureFilter -> Bool -> m [PluginFeature]), MonadIO m, IsRegistry a) => MethodInfo * RegistryFeatureFilterMethodInfo a signature Source # | |
registryFeatureFilter Source #
Arguments
:: (HasCallStack, MonadIO m, IsRegistry a) | |
=> a |
|
-> PluginFeatureFilter |
|
-> Bool |
|
-> m [PluginFeature] | Returns: a MT safe. |
Runs a filter against all features of the plugins in the registry and returns a GList with the results. If the first flag is set, only the first match is returned (as a list with a single object).
findFeature
data RegistryFindFeatureMethodInfo Source #
Instances
((~) * signature (Text -> GType -> m (Maybe PluginFeature)), MonadIO m, IsRegistry a) => MethodInfo * RegistryFindFeatureMethodInfo a signature Source # | |
Arguments
:: (HasCallStack, MonadIO m, IsRegistry a) | |
=> a |
|
-> Text |
|
-> GType |
|
-> m (Maybe PluginFeature) | Returns: the pluginfeature with the
given name and type or MT safe. |
Find the pluginfeature with the given name and type in the registry.
findPlugin
data RegistryFindPluginMethodInfo Source #
Instances
((~) * signature (Text -> m (Maybe Plugin)), MonadIO m, IsRegistry a) => MethodInfo * RegistryFindPluginMethodInfo a signature Source # | |
Arguments
:: (HasCallStack, MonadIO m, IsRegistry a) | |
=> a |
|
-> Text |
|
-> m (Maybe Plugin) | Returns: the plugin with the given name
or MT safe. |
Find the plugin with the given name in the registry. The plugin will be reffed; caller is responsible for unreffing.
forkIsEnabled
registryForkIsEnabled Source #
Arguments
:: (HasCallStack, MonadIO m) | |
=> m Bool | Returns: |
By default GStreamer will perform scanning and rebuilding of the registry file using a helper child process.
Applications might want to disable this behaviour with the
registryForkSetEnabled
function, in which case new plugins
are scanned (and loaded) into the application process.
forkSetEnabled
registryForkSetEnabled Source #
Arguments
:: (HasCallStack, MonadIO m) | |
=> Bool |
|
-> m () |
Applications might want to disable/enable spawning of a child helper process
when rebuilding the registry. See registryForkIsEnabled
for more
information.
get
Arguments
:: (HasCallStack, MonadIO m) | |
=> m Registry | Returns: the |
Retrieves the singleton plugin registry. The caller does not own a reference on the registry, as it is alive as long as GStreamer is initialized.
getFeatureList
data RegistryGetFeatureListMethodInfo Source #
Instances
((~) * signature (GType -> m [PluginFeature]), MonadIO m, IsRegistry a) => MethodInfo * RegistryGetFeatureListMethodInfo a signature Source # | |
registryGetFeatureList Source #
Arguments
:: (HasCallStack, MonadIO m, IsRegistry a) | |
=> a |
|
-> GType |
|
-> m [PluginFeature] | Returns: a MT safe. |
Retrieves a List
of PluginFeature
of type
.
getFeatureListByPlugin
data RegistryGetFeatureListByPluginMethodInfo Source #
Instances
((~) * signature (Text -> m [PluginFeature]), MonadIO m, IsRegistry a) => MethodInfo * RegistryGetFeatureListByPluginMethodInfo a signature Source # | |
registryGetFeatureListByPlugin Source #
Arguments
:: (HasCallStack, MonadIO m, IsRegistry a) | |
=> a |
|
-> Text |
|
-> m [PluginFeature] | Returns: a |
Retrieves a List
of features of the plugin with name name
.
getFeatureListCookie
data RegistryGetFeatureListCookieMethodInfo Source #
Instances
((~) * signature (m Word32), MonadIO m, IsRegistry a) => MethodInfo * RegistryGetFeatureListCookieMethodInfo a signature Source # | |
registryGetFeatureListCookie Source #
Arguments
:: (HasCallStack, MonadIO m, IsRegistry a) | |
=> a |
|
-> m Word32 | Returns: the feature list cookie. |
Returns the registry's feature list cookie. This changes every time a feature is added or removed from the registry.
getPluginList
data RegistryGetPluginListMethodInfo Source #
Instances
((~) * signature (m [Plugin]), MonadIO m, IsRegistry a) => MethodInfo * RegistryGetPluginListMethodInfo a signature Source # | |
registryGetPluginList Source #
Arguments
:: (HasCallStack, MonadIO m, IsRegistry a) | |
=> a |
|
-> m [Plugin] | Returns: a MT safe. |
Get a copy of all plugins registered in the given registry. The refcount of each element in the list in incremented.
lookup
data RegistryLookupMethodInfo Source #
Instances
((~) * signature (Text -> m (Maybe Plugin)), MonadIO m, IsRegistry a) => MethodInfo * RegistryLookupMethodInfo a signature Source # | |
Arguments
:: (HasCallStack, MonadIO m, IsRegistry a) | |
=> a |
|
-> Text |
|
-> m (Maybe Plugin) | Returns: the |
Look up a plugin in the given registry with the given filename. If found, plugin is reffed.
lookupFeature
data RegistryLookupFeatureMethodInfo Source #
Instances
((~) * signature (Text -> m PluginFeature), MonadIO m, IsRegistry a) => MethodInfo * RegistryLookupFeatureMethodInfo a signature Source # | |
registryLookupFeature Source #
Arguments
:: (HasCallStack, MonadIO m, IsRegistry a) | |
=> a |
|
-> Text |
|
-> m PluginFeature | Returns: a MT safe. |
Find a PluginFeature
with name
in registry
.
pluginFilter
data RegistryPluginFilterMethodInfo Source #
Instances
((~) * signature (PluginFilter -> Bool -> m [Plugin]), MonadIO m, IsRegistry a) => MethodInfo * RegistryPluginFilterMethodInfo a signature Source # | |
Arguments
:: (HasCallStack, MonadIO m, IsRegistry a) | |
=> a |
|
-> PluginFilter |
|
-> Bool |
|
-> m [Plugin] | Returns: a MT safe. |
Runs a filter against all plugins in the registry and returns a List
with
the results. If the first flag is set, only the first match is
returned (as a list with a single object).
Every plugin is reffed; use pluginListFree
after use, which
will unref again.
removeFeature
data RegistryRemoveFeatureMethodInfo Source #
Instances
((~) * signature (b -> m ()), MonadIO m, IsRegistry a, IsPluginFeature b) => MethodInfo * RegistryRemoveFeatureMethodInfo a signature Source # | |
registryRemoveFeature Source #
Arguments
:: (HasCallStack, MonadIO m, IsRegistry a, IsPluginFeature b) | |
=> a |
|
-> b |
|
-> m () |
Remove the feature from the registry.
MT safe.
removePlugin
data RegistryRemovePluginMethodInfo Source #
Instances
((~) * signature (b -> m ()), MonadIO m, IsRegistry a, IsPlugin b) => MethodInfo * RegistryRemovePluginMethodInfo a signature Source # | |
Arguments
:: (HasCallStack, MonadIO m, IsRegistry a, IsPlugin b) | |
=> a |
|
-> b |
|
-> m () |
Remove the plugin from the registry.
MT safe.
scanPath
data RegistryScanPathMethodInfo Source #
Instances
((~) * signature (Text -> m Bool), MonadIO m, IsRegistry a) => MethodInfo * RegistryScanPathMethodInfo a signature Source # | |
Arguments
:: (HasCallStack, MonadIO m, IsRegistry a) | |
=> a |
|
-> Text |
|
-> m Bool | Returns: |
Scan the given path for plugins to add to the registry. The syntax of the path is specific to the registry.
Signals
featureAdded
type C_RegistryFeatureAddedCallback = Ptr () -> Ptr PluginFeature -> Ptr () -> IO () Source #
type RegistryFeatureAddedCallback = PluginFeature -> IO () Source #
afterRegistryFeatureAdded :: (GObject a, MonadIO m) => a -> RegistryFeatureAddedCallback -> m SignalHandlerId Source #
mk_RegistryFeatureAddedCallback :: C_RegistryFeatureAddedCallback -> IO (FunPtr C_RegistryFeatureAddedCallback) Source #
onRegistryFeatureAdded :: (GObject a, MonadIO m) => a -> RegistryFeatureAddedCallback -> m SignalHandlerId Source #
wrap_RegistryFeatureAddedCallback :: RegistryFeatureAddedCallback -> Ptr () -> Ptr PluginFeature -> Ptr () -> IO () Source #
pluginAdded
type RegistryPluginAddedCallback = Plugin -> IO () Source #
afterRegistryPluginAdded :: (GObject a, MonadIO m) => a -> RegistryPluginAddedCallback -> m SignalHandlerId Source #
mk_RegistryPluginAddedCallback :: C_RegistryPluginAddedCallback -> IO (FunPtr C_RegistryPluginAddedCallback) Source #
onRegistryPluginAdded :: (GObject a, MonadIO m) => a -> RegistryPluginAddedCallback -> m SignalHandlerId Source #
wrap_RegistryPluginAddedCallback :: RegistryPluginAddedCallback -> Ptr () -> Ptr Plugin -> Ptr () -> IO () Source #