{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)

One registry holds the metadata of a set of plugins.

\<emphasis role=\"bold\">Design:\<\/emphasis>

The 'GI.Gst.Objects.Registry.Registry' object is a list of plugins and some functions for dealing
with them. Each 'GI.Gst.Objects.Plugin.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:

* location from --gst-plugin-path commandline option.
* the GST_PLUGIN_PATH environment variable.
* the GST_PLUGIN_SYSTEM_PATH environment variable.
* default locations (if GST_PLUGIN_SYSTEM_PATH is not set).
  Those default locations are:
  @$XDG_DATA_HOME\/gstreamer-$GST_API_VERSION\/plugins\/@
  and @$prefix\/libs\/gstreamer-$GST_API_VERSION\/@.
  <http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html $XDG_DATA_HOME> defaults to
  @$HOME\/.local\/share@.

The registry cache file is loaded from
@$XDG_CACHE_HOME\/gstreamer-$GST_API_VERSION\/registry-$ARCH.bin@
(where $XDG_CACHE_HOME defaults to @$HOME\/.cache@) 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:

  * the cache may not contain information about a given file.
  * the cache may have stale information.
  * the cache may have current information.

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.

== Implementation notes:

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 'GI.Gst.Flags.PluginFlagsCached' bit. These plugins are
removed at the end of initialization.
-}

module GI.Gst.Objects.Registry
    ( 

-- * Exported types
    Registry(..)                            ,
    IsRegistry                              ,
    toRegistry                              ,
    noRegistry                              ,


 -- * Methods
-- ** addFeature #method:addFeature#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    RegistryAddFeatureMethodInfo            ,
#endif
    registryAddFeature                      ,


-- ** addPlugin #method:addPlugin#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    RegistryAddPluginMethodInfo             ,
#endif
    registryAddPlugin                       ,


-- ** checkFeatureVersion #method:checkFeatureVersion#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    RegistryCheckFeatureVersionMethodInfo   ,
#endif
    registryCheckFeatureVersion             ,


-- ** featureFilter #method:featureFilter#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    RegistryFeatureFilterMethodInfo         ,
#endif
    registryFeatureFilter                   ,


-- ** findFeature #method:findFeature#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    RegistryFindFeatureMethodInfo           ,
#endif
    registryFindFeature                     ,


-- ** findPlugin #method:findPlugin#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    RegistryFindPluginMethodInfo            ,
#endif
    registryFindPlugin                      ,


-- ** forkIsEnabled #method:forkIsEnabled#
    registryForkIsEnabled                   ,


-- ** forkSetEnabled #method:forkSetEnabled#
    registryForkSetEnabled                  ,


-- ** get #method:get#
    registryGet                             ,


-- ** getFeatureList #method:getFeatureList#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    RegistryGetFeatureListMethodInfo        ,
#endif
    registryGetFeatureList                  ,


-- ** getFeatureListByPlugin #method:getFeatureListByPlugin#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    RegistryGetFeatureListByPluginMethodInfo,
#endif
    registryGetFeatureListByPlugin          ,


-- ** getFeatureListCookie #method:getFeatureListCookie#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    RegistryGetFeatureListCookieMethodInfo  ,
#endif
    registryGetFeatureListCookie            ,


-- ** getPluginList #method:getPluginList#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    RegistryGetPluginListMethodInfo         ,
#endif
    registryGetPluginList                   ,


-- ** lookup #method:lookup#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    RegistryLookupMethodInfo                ,
#endif
    registryLookup                          ,


-- ** lookupFeature #method:lookupFeature#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    RegistryLookupFeatureMethodInfo         ,
#endif
    registryLookupFeature                   ,


-- ** pluginFilter #method:pluginFilter#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    RegistryPluginFilterMethodInfo          ,
#endif
    registryPluginFilter                    ,


-- ** removeFeature #method:removeFeature#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    RegistryRemoveFeatureMethodInfo         ,
#endif
    registryRemoveFeature                   ,


-- ** removePlugin #method:removePlugin#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    RegistryRemovePluginMethodInfo          ,
#endif
    registryRemovePlugin                    ,


-- ** scanPath #method:scanPath#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    RegistryScanPathMethodInfo              ,
#endif
    registryScanPath                        ,




 -- * Signals
-- ** featureAdded #signal:featureAdded#
    C_RegistryFeatureAddedCallback          ,
    RegistryFeatureAddedCallback            ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    RegistryFeatureAddedSignalInfo          ,
#endif
    afterRegistryFeatureAdded               ,
    genClosure_RegistryFeatureAdded         ,
    mk_RegistryFeatureAddedCallback         ,
    noRegistryFeatureAddedCallback          ,
    onRegistryFeatureAdded                  ,
    wrap_RegistryFeatureAddedCallback       ,


-- ** pluginAdded #signal:pluginAdded#
    C_RegistryPluginAddedCallback           ,
    RegistryPluginAddedCallback             ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    RegistryPluginAddedSignalInfo           ,
#endif
    afterRegistryPluginAdded                ,
    genClosure_RegistryPluginAdded          ,
    mk_RegistryPluginAddedCallback          ,
    noRegistryPluginAddedCallback           ,
    onRegistryPluginAdded                   ,
    wrap_RegistryPluginAddedCallback        ,




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP

import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gst.Callbacks as Gst.Callbacks
import {-# SOURCE #-} qualified GI.Gst.Objects.Object as Gst.Object
import {-# SOURCE #-} qualified GI.Gst.Objects.Plugin as Gst.Plugin
import {-# SOURCE #-} qualified GI.Gst.Objects.PluginFeature as Gst.PluginFeature

newtype Registry = Registry (ManagedPtr Registry)
foreign import ccall "gst_registry_get_type"
    c_gst_registry_get_type :: IO GType

instance GObject Registry where
    gobjectType _ = c_gst_registry_get_type
    

class GObject o => IsRegistry o
#if MIN_VERSION_base(4,9,0)
instance {-# OVERLAPPABLE #-} (GObject a, O.UnknownAncestorError Registry a) =>
    IsRegistry a
#endif
instance IsRegistry Registry
instance Gst.Object.IsObject Registry
instance GObject.Object.IsObject Registry

toRegistry :: (MonadIO m, IsRegistry o) => o -> m Registry
toRegistry = liftIO . unsafeCastTo Registry

noRegistry :: Maybe Registry
noRegistry = Nothing

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
type family ResolveRegistryMethod (t :: Symbol) (o :: *) :: * where
    ResolveRegistryMethod "addControlBinding" o = Gst.Object.ObjectAddControlBindingMethodInfo
    ResolveRegistryMethod "addFeature" o = RegistryAddFeatureMethodInfo
    ResolveRegistryMethod "addPlugin" o = RegistryAddPluginMethodInfo
    ResolveRegistryMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveRegistryMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveRegistryMethod "checkFeatureVersion" o = RegistryCheckFeatureVersionMethodInfo
    ResolveRegistryMethod "defaultError" o = Gst.Object.ObjectDefaultErrorMethodInfo
    ResolveRegistryMethod "featureFilter" o = RegistryFeatureFilterMethodInfo
    ResolveRegistryMethod "findFeature" o = RegistryFindFeatureMethodInfo
    ResolveRegistryMethod "findPlugin" o = RegistryFindPluginMethodInfo
    ResolveRegistryMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveRegistryMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveRegistryMethod "hasActiveControlBindings" o = Gst.Object.ObjectHasActiveControlBindingsMethodInfo
    ResolveRegistryMethod "hasAncestor" o = Gst.Object.ObjectHasAncestorMethodInfo
    ResolveRegistryMethod "hasAsAncestor" o = Gst.Object.ObjectHasAsAncestorMethodInfo
    ResolveRegistryMethod "hasAsParent" o = Gst.Object.ObjectHasAsParentMethodInfo
    ResolveRegistryMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveRegistryMethod "lookup" o = RegistryLookupMethodInfo
    ResolveRegistryMethod "lookupFeature" o = RegistryLookupFeatureMethodInfo
    ResolveRegistryMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveRegistryMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveRegistryMethod "pluginFilter" o = RegistryPluginFilterMethodInfo
    ResolveRegistryMethod "ref" o = Gst.Object.ObjectRefMethodInfo
    ResolveRegistryMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveRegistryMethod "removeControlBinding" o = Gst.Object.ObjectRemoveControlBindingMethodInfo
    ResolveRegistryMethod "removeFeature" o = RegistryRemoveFeatureMethodInfo
    ResolveRegistryMethod "removePlugin" o = RegistryRemovePluginMethodInfo
    ResolveRegistryMethod "replaceData" o = GObject.Object.ObjectReplaceDataMethodInfo
    ResolveRegistryMethod "replaceQdata" o = GObject.Object.ObjectReplaceQdataMethodInfo
    ResolveRegistryMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveRegistryMethod "scanPath" o = RegistryScanPathMethodInfo
    ResolveRegistryMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveRegistryMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveRegistryMethod "suggestNextSync" o = Gst.Object.ObjectSuggestNextSyncMethodInfo
    ResolveRegistryMethod "syncValues" o = Gst.Object.ObjectSyncValuesMethodInfo
    ResolveRegistryMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveRegistryMethod "unparent" o = Gst.Object.ObjectUnparentMethodInfo
    ResolveRegistryMethod "unref" o = Gst.Object.ObjectUnrefMethodInfo
    ResolveRegistryMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveRegistryMethod "getControlBinding" o = Gst.Object.ObjectGetControlBindingMethodInfo
    ResolveRegistryMethod "getControlRate" o = Gst.Object.ObjectGetControlRateMethodInfo
    ResolveRegistryMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveRegistryMethod "getFeatureList" o = RegistryGetFeatureListMethodInfo
    ResolveRegistryMethod "getFeatureListByPlugin" o = RegistryGetFeatureListByPluginMethodInfo
    ResolveRegistryMethod "getFeatureListCookie" o = RegistryGetFeatureListCookieMethodInfo
    ResolveRegistryMethod "getGValueArray" o = Gst.Object.ObjectGetGValueArrayMethodInfo
    ResolveRegistryMethod "getName" o = Gst.Object.ObjectGetNameMethodInfo
    ResolveRegistryMethod "getParent" o = Gst.Object.ObjectGetParentMethodInfo
    ResolveRegistryMethod "getPathString" o = Gst.Object.ObjectGetPathStringMethodInfo
    ResolveRegistryMethod "getPluginList" o = RegistryGetPluginListMethodInfo
    ResolveRegistryMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveRegistryMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveRegistryMethod "getValue" o = Gst.Object.ObjectGetValueMethodInfo
    ResolveRegistryMethod "setControlBindingDisabled" o = Gst.Object.ObjectSetControlBindingDisabledMethodInfo
    ResolveRegistryMethod "setControlBindingsDisabled" o = Gst.Object.ObjectSetControlBindingsDisabledMethodInfo
    ResolveRegistryMethod "setControlRate" o = Gst.Object.ObjectSetControlRateMethodInfo
    ResolveRegistryMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveRegistryMethod "setName" o = Gst.Object.ObjectSetNameMethodInfo
    ResolveRegistryMethod "setParent" o = Gst.Object.ObjectSetParentMethodInfo
    ResolveRegistryMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveRegistryMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveRegistryMethod t Registry, O.MethodInfo info Registry p) => O.IsLabelProxy t (Registry -> p) where
    fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveRegistryMethod t Registry, O.MethodInfo info Registry p) => O.IsLabel t (Registry -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif
#endif

#endif

-- signal Registry::feature-added
type RegistryFeatureAddedCallback =
    Gst.PluginFeature.PluginFeature ->
    IO ()

noRegistryFeatureAddedCallback :: Maybe RegistryFeatureAddedCallback
noRegistryFeatureAddedCallback = Nothing

type C_RegistryFeatureAddedCallback =
    Ptr () ->                               -- object
    Ptr Gst.PluginFeature.PluginFeature ->
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_RegistryFeatureAddedCallback :: C_RegistryFeatureAddedCallback -> IO (FunPtr C_RegistryFeatureAddedCallback)

genClosure_RegistryFeatureAdded :: RegistryFeatureAddedCallback -> IO Closure
genClosure_RegistryFeatureAdded cb = do
    let cb' = wrap_RegistryFeatureAddedCallback cb
    mk_RegistryFeatureAddedCallback cb' >>= newCClosure


wrap_RegistryFeatureAddedCallback ::
    RegistryFeatureAddedCallback ->
    Ptr () ->
    Ptr Gst.PluginFeature.PluginFeature ->
    Ptr () ->
    IO ()
wrap_RegistryFeatureAddedCallback _cb _ feature _ = do
    feature' <- (newObject Gst.PluginFeature.PluginFeature) feature
    _cb  feature'


onRegistryFeatureAdded :: (IsRegistry a, MonadIO m) => a -> RegistryFeatureAddedCallback -> m SignalHandlerId
onRegistryFeatureAdded obj cb = liftIO $ do
    let cb' = wrap_RegistryFeatureAddedCallback cb
    cb'' <- mk_RegistryFeatureAddedCallback cb'
    connectSignalFunPtr obj "feature-added" cb'' SignalConnectBefore

afterRegistryFeatureAdded :: (IsRegistry a, MonadIO m) => a -> RegistryFeatureAddedCallback -> m SignalHandlerId
afterRegistryFeatureAdded obj cb = liftIO $ do
    let cb' = wrap_RegistryFeatureAddedCallback cb
    cb'' <- mk_RegistryFeatureAddedCallback cb'
    connectSignalFunPtr obj "feature-added" cb'' SignalConnectAfter


-- signal Registry::plugin-added
type RegistryPluginAddedCallback =
    Gst.Plugin.Plugin ->
    IO ()

noRegistryPluginAddedCallback :: Maybe RegistryPluginAddedCallback
noRegistryPluginAddedCallback = Nothing

type C_RegistryPluginAddedCallback =
    Ptr () ->                               -- object
    Ptr Gst.Plugin.Plugin ->
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_RegistryPluginAddedCallback :: C_RegistryPluginAddedCallback -> IO (FunPtr C_RegistryPluginAddedCallback)

genClosure_RegistryPluginAdded :: RegistryPluginAddedCallback -> IO Closure
genClosure_RegistryPluginAdded cb = do
    let cb' = wrap_RegistryPluginAddedCallback cb
    mk_RegistryPluginAddedCallback cb' >>= newCClosure


wrap_RegistryPluginAddedCallback ::
    RegistryPluginAddedCallback ->
    Ptr () ->
    Ptr Gst.Plugin.Plugin ->
    Ptr () ->
    IO ()
wrap_RegistryPluginAddedCallback _cb _ plugin _ = do
    plugin' <- (newObject Gst.Plugin.Plugin) plugin
    _cb  plugin'


onRegistryPluginAdded :: (IsRegistry a, MonadIO m) => a -> RegistryPluginAddedCallback -> m SignalHandlerId
onRegistryPluginAdded obj cb = liftIO $ do
    let cb' = wrap_RegistryPluginAddedCallback cb
    cb'' <- mk_RegistryPluginAddedCallback cb'
    connectSignalFunPtr obj "plugin-added" cb'' SignalConnectBefore

afterRegistryPluginAdded :: (IsRegistry a, MonadIO m) => a -> RegistryPluginAddedCallback -> m SignalHandlerId
afterRegistryPluginAdded obj cb = liftIO $ do
    let cb' = wrap_RegistryPluginAddedCallback cb
    cb'' <- mk_RegistryPluginAddedCallback cb'
    connectSignalFunPtr obj "plugin-added" cb'' SignalConnectAfter


#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
instance O.HasAttributeList Registry
type instance O.AttributeList Registry = RegistryAttributeList
type RegistryAttributeList = ('[ '("name", Gst.Object.ObjectNamePropertyInfo), '("parent", Gst.Object.ObjectParentPropertyInfo)] :: [(Symbol, *)])
#endif

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
#endif

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data RegistryFeatureAddedSignalInfo
instance SignalInfo RegistryFeatureAddedSignalInfo where
    type HaskellCallbackType RegistryFeatureAddedSignalInfo = RegistryFeatureAddedCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_RegistryFeatureAddedCallback cb
        cb'' <- mk_RegistryFeatureAddedCallback cb'
        connectSignalFunPtr obj "feature-added" cb'' connectMode

data RegistryPluginAddedSignalInfo
instance SignalInfo RegistryPluginAddedSignalInfo where
    type HaskellCallbackType RegistryPluginAddedSignalInfo = RegistryPluginAddedCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_RegistryPluginAddedCallback cb
        cb'' <- mk_RegistryPluginAddedCallback cb'
        connectSignalFunPtr obj "plugin-added" cb'' connectMode

type instance O.SignalList Registry = RegistrySignalList
type RegistrySignalList = ('[ '("deepNotify", Gst.Object.ObjectDeepNotifySignalInfo), '("featureAdded", RegistryFeatureAddedSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo), '("pluginAdded", RegistryPluginAddedSignalInfo)] :: [(Symbol, *)])

#endif

-- method Registry::add_feature
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "registry", argType = TInterface (Name {namespace = "Gst", name = "Registry"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the registry to add the plugin to", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "feature", argType = TInterface (Name {namespace = "Gst", name = "PluginFeature"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the feature to add", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_registry_add_feature" gst_registry_add_feature :: 
    Ptr Registry ->                         -- registry : TInterface (Name {namespace = "Gst", name = "Registry"})
    Ptr Gst.PluginFeature.PluginFeature ->  -- feature : TInterface (Name {namespace = "Gst", name = "PluginFeature"})
    IO CInt

{- |
Add the feature to the registry. The feature-added signal will be emitted.
This function sinks /@feature@/.
-}
registryAddFeature ::
    (B.CallStack.HasCallStack, MonadIO m, IsRegistry a, Gst.PluginFeature.IsPluginFeature b) =>
    a
    {- ^ /@registry@/: the registry to add the plugin to -}
    -> b
    {- ^ /@feature@/: the feature to add -}
    -> m Bool
    {- ^ __Returns:__ 'True' on success.

MT safe. -}
registryAddFeature registry feature = liftIO $ do
    registry' <- unsafeManagedPtrCastPtr registry
    feature' <- B.ManagedPtr.disownObject feature
    result <- gst_registry_add_feature registry' feature'
    let result' = (/= 0) result
    touchManagedPtr registry
    touchManagedPtr feature
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data RegistryAddFeatureMethodInfo
instance (signature ~ (b -> m Bool), MonadIO m, IsRegistry a, Gst.PluginFeature.IsPluginFeature b) => O.MethodInfo RegistryAddFeatureMethodInfo a signature where
    overloadedMethod _ = registryAddFeature

#endif

-- method Registry::add_plugin
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "registry", argType = TInterface (Name {namespace = "Gst", name = "Registry"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the registry to add the plugin to", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "plugin", argType = TInterface (Name {namespace = "Gst", name = "Plugin"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the plugin to add", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_registry_add_plugin" gst_registry_add_plugin :: 
    Ptr Registry ->                         -- registry : TInterface (Name {namespace = "Gst", name = "Registry"})
    Ptr Gst.Plugin.Plugin ->                -- plugin : TInterface (Name {namespace = "Gst", name = "Plugin"})
    IO CInt

{- |
Add the plugin to the registry. The plugin-added signal will be emitted.
This function will sink /@plugin@/.
-}
registryAddPlugin ::
    (B.CallStack.HasCallStack, MonadIO m, IsRegistry a, Gst.Plugin.IsPlugin b) =>
    a
    {- ^ /@registry@/: the registry to add the plugin to -}
    -> b
    {- ^ /@plugin@/: the plugin to add -}
    -> m Bool
    {- ^ __Returns:__ 'True' on success.

MT safe. -}
registryAddPlugin registry plugin = liftIO $ do
    registry' <- unsafeManagedPtrCastPtr registry
    plugin' <- B.ManagedPtr.disownObject plugin
    result <- gst_registry_add_plugin registry' plugin'
    let result' = (/= 0) result
    touchManagedPtr registry
    touchManagedPtr plugin
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data RegistryAddPluginMethodInfo
instance (signature ~ (b -> m Bool), MonadIO m, IsRegistry a, Gst.Plugin.IsPlugin b) => O.MethodInfo RegistryAddPluginMethodInfo a signature where
    overloadedMethod _ = registryAddPlugin

#endif

-- method Registry::check_feature_version
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "registry", argType = TInterface (Name {namespace = "Gst", name = "Registry"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstRegistry", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "feature_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the feature (e.g. \"oggdemux\")", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "min_major", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the minimum major version number", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "min_minor", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the minimum minor version number", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "min_micro", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the minimum micro version number", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_registry_check_feature_version" gst_registry_check_feature_version :: 
    Ptr Registry ->                         -- registry : TInterface (Name {namespace = "Gst", name = "Registry"})
    CString ->                              -- feature_name : TBasicType TUTF8
    Word32 ->                               -- min_major : TBasicType TUInt
    Word32 ->                               -- min_minor : TBasicType TUInt
    Word32 ->                               -- min_micro : TBasicType TUInt
    IO CInt

{- |
Checks whether a plugin feature by the given name exists in
/@registry@/ and whether its version is at least the
version required.
-}
registryCheckFeatureVersion ::
    (B.CallStack.HasCallStack, MonadIO m, IsRegistry a) =>
    a
    {- ^ /@registry@/: a 'GI.Gst.Objects.Registry.Registry' -}
    -> T.Text
    {- ^ /@featureName@/: the name of the feature (e.g. \"oggdemux\") -}
    -> Word32
    {- ^ /@minMajor@/: the minimum major version number -}
    -> Word32
    {- ^ /@minMinor@/: the minimum minor version number -}
    -> Word32
    {- ^ /@minMicro@/: the minimum micro version number -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the feature could be found and the version is
the same as the required version or newer, and 'False' otherwise. -}
registryCheckFeatureVersion registry featureName minMajor minMinor minMicro = liftIO $ do
    registry' <- unsafeManagedPtrCastPtr registry
    featureName' <- textToCString featureName
    result <- gst_registry_check_feature_version registry' featureName' minMajor minMinor minMicro
    let result' = (/= 0) result
    touchManagedPtr registry
    freeMem featureName'
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data RegistryCheckFeatureVersionMethodInfo
instance (signature ~ (T.Text -> Word32 -> Word32 -> Word32 -> m Bool), MonadIO m, IsRegistry a) => O.MethodInfo RegistryCheckFeatureVersionMethodInfo a signature where
    overloadedMethod _ = registryCheckFeatureVersion

#endif

-- method Registry::feature_filter
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "registry", argType = TInterface (Name {namespace = "Gst", name = "Registry"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "registry to query", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "filter", argType = TInterface (Name {namespace = "Gst", name = "PluginFeatureFilter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the filter to use", sinceVersion = Nothing}, argScope = ScopeTypeCall, argClosure = 3, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "first", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "only return first match", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user data passed to the filter function", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TGList (TInterface (Name {namespace = "Gst", name = "PluginFeature"})))
-- throws : False
-- Skip return : False

foreign import ccall "gst_registry_feature_filter" gst_registry_feature_filter :: 
    Ptr Registry ->                         -- registry : TInterface (Name {namespace = "Gst", name = "Registry"})
    FunPtr Gst.Callbacks.C_PluginFeatureFilter -> -- filter : TInterface (Name {namespace = "Gst", name = "PluginFeatureFilter"})
    CInt ->                                 -- first : TBasicType TBoolean
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO (Ptr (GList (Ptr Gst.PluginFeature.PluginFeature)))

{- |
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).
-}
registryFeatureFilter ::
    (B.CallStack.HasCallStack, MonadIO m, IsRegistry a) =>
    a
    {- ^ /@registry@/: registry to query -}
    -> Gst.Callbacks.PluginFeatureFilter
    {- ^ /@filter@/: the filter to use -}
    -> Bool
    {- ^ /@first@/: only return first match -}
    -> m [Gst.PluginFeature.PluginFeature]
    {- ^ __Returns:__ a 'GI.GLib.Structs.List.List' of
    'GI.Gst.Objects.PluginFeature.PluginFeature'. Use 'GI.Gst.Objects.PluginFeature.pluginFeatureListFree' after usage.

MT safe. -}
registryFeatureFilter registry filter first = liftIO $ do
    registry' <- unsafeManagedPtrCastPtr registry
    filter' <- Gst.Callbacks.mk_PluginFeatureFilter (Gst.Callbacks.wrap_PluginFeatureFilter Nothing (Gst.Callbacks.drop_closures_PluginFeatureFilter filter))
    let first' = (fromIntegral . fromEnum) first
    let userData = nullPtr
    result <- gst_registry_feature_filter registry' filter' first' userData
    result' <- unpackGList result
    result'' <- mapM (wrapObject Gst.PluginFeature.PluginFeature) result'
    g_list_free result
    safeFreeFunPtr $ castFunPtrToPtr filter'
    touchManagedPtr registry
    return result''

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data RegistryFeatureFilterMethodInfo
instance (signature ~ (Gst.Callbacks.PluginFeatureFilter -> Bool -> m [Gst.PluginFeature.PluginFeature]), MonadIO m, IsRegistry a) => O.MethodInfo RegistryFeatureFilterMethodInfo a signature where
    overloadedMethod _ = registryFeatureFilter

#endif

-- method Registry::find_feature
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "registry", argType = TInterface (Name {namespace = "Gst", name = "Registry"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the registry to search", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the pluginfeature name to find", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "type", argType = TBasicType TGType, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the pluginfeature type to find", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "PluginFeature"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_registry_find_feature" gst_registry_find_feature :: 
    Ptr Registry ->                         -- registry : TInterface (Name {namespace = "Gst", name = "Registry"})
    CString ->                              -- name : TBasicType TUTF8
    CGType ->                               -- type : TBasicType TGType
    IO (Ptr Gst.PluginFeature.PluginFeature)

{- |
Find the pluginfeature with the given name and type in the registry.
-}
registryFindFeature ::
    (B.CallStack.HasCallStack, MonadIO m, IsRegistry a) =>
    a
    {- ^ /@registry@/: the registry to search -}
    -> T.Text
    {- ^ /@name@/: the pluginfeature name to find -}
    -> GType
    {- ^ /@type@/: the pluginfeature type to find -}
    -> m (Maybe Gst.PluginFeature.PluginFeature)
    {- ^ __Returns:__ the pluginfeature with the
    given name and type or 'Nothing' if the plugin was not
    found. 'GI.Gst.Objects.Object.objectUnref' after usage.

MT safe. -}
registryFindFeature registry name type_ = liftIO $ do
    registry' <- unsafeManagedPtrCastPtr registry
    name' <- textToCString name
    let type_' = gtypeToCGType type_
    result <- gst_registry_find_feature registry' name' type_'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapObject Gst.PluginFeature.PluginFeature) result'
        return result''
    touchManagedPtr registry
    freeMem name'
    return maybeResult

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data RegistryFindFeatureMethodInfo
instance (signature ~ (T.Text -> GType -> m (Maybe Gst.PluginFeature.PluginFeature)), MonadIO m, IsRegistry a) => O.MethodInfo RegistryFindFeatureMethodInfo a signature where
    overloadedMethod _ = registryFindFeature

#endif

-- method Registry::find_plugin
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "registry", argType = TInterface (Name {namespace = "Gst", name = "Registry"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the registry to search", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the plugin name to find", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Plugin"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_registry_find_plugin" gst_registry_find_plugin :: 
    Ptr Registry ->                         -- registry : TInterface (Name {namespace = "Gst", name = "Registry"})
    CString ->                              -- name : TBasicType TUTF8
    IO (Ptr Gst.Plugin.Plugin)

{- |
Find the plugin with the given name in the registry.
The plugin will be reffed; caller is responsible for unreffing.
-}
registryFindPlugin ::
    (B.CallStack.HasCallStack, MonadIO m, IsRegistry a) =>
    a
    {- ^ /@registry@/: the registry to search -}
    -> T.Text
    {- ^ /@name@/: the plugin name to find -}
    -> m (Maybe Gst.Plugin.Plugin)
    {- ^ __Returns:__ the plugin with the given name
    or 'Nothing' if the plugin was not found. 'GI.Gst.Objects.Object.objectUnref' after
    usage.

MT safe. -}
registryFindPlugin registry name = liftIO $ do
    registry' <- unsafeManagedPtrCastPtr registry
    name' <- textToCString name
    result <- gst_registry_find_plugin registry' name'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapObject Gst.Plugin.Plugin) result'
        return result''
    touchManagedPtr registry
    freeMem name'
    return maybeResult

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data RegistryFindPluginMethodInfo
instance (signature ~ (T.Text -> m (Maybe Gst.Plugin.Plugin)), MonadIO m, IsRegistry a) => O.MethodInfo RegistryFindPluginMethodInfo a signature where
    overloadedMethod _ = registryFindPlugin

#endif

-- method Registry::get_feature_list
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "registry", argType = TInterface (Name {namespace = "Gst", name = "Registry"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstRegistry", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "type", argType = TBasicType TGType, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GType.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TGList (TInterface (Name {namespace = "Gst", name = "PluginFeature"})))
-- throws : False
-- Skip return : False

foreign import ccall "gst_registry_get_feature_list" gst_registry_get_feature_list :: 
    Ptr Registry ->                         -- registry : TInterface (Name {namespace = "Gst", name = "Registry"})
    CGType ->                               -- type : TBasicType TGType
    IO (Ptr (GList (Ptr Gst.PluginFeature.PluginFeature)))

{- |
Retrieves a 'GI.GLib.Structs.List.List' of 'GI.Gst.Objects.PluginFeature.PluginFeature' of /@type@/.
-}
registryGetFeatureList ::
    (B.CallStack.HasCallStack, MonadIO m, IsRegistry a) =>
    a
    {- ^ /@registry@/: a 'GI.Gst.Objects.Registry.Registry' -}
    -> GType
    {- ^ /@type@/: a 'GType'. -}
    -> m [Gst.PluginFeature.PluginFeature]
    {- ^ __Returns:__ a 'GI.GLib.Structs.List.List' of
    'GI.Gst.Objects.PluginFeature.PluginFeature' of /@type@/. Use 'GI.Gst.Objects.PluginFeature.pluginFeatureListFree' after use

MT safe. -}
registryGetFeatureList registry type_ = liftIO $ do
    registry' <- unsafeManagedPtrCastPtr registry
    let type_' = gtypeToCGType type_
    result <- gst_registry_get_feature_list registry' type_'
    result' <- unpackGList result
    result'' <- mapM (wrapObject Gst.PluginFeature.PluginFeature) result'
    g_list_free result
    touchManagedPtr registry
    return result''

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data RegistryGetFeatureListMethodInfo
instance (signature ~ (GType -> m [Gst.PluginFeature.PluginFeature]), MonadIO m, IsRegistry a) => O.MethodInfo RegistryGetFeatureListMethodInfo a signature where
    overloadedMethod _ = registryGetFeatureList

#endif

-- method Registry::get_feature_list_by_plugin
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "registry", argType = TInterface (Name {namespace = "Gst", name = "Registry"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstRegistry.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a plugin name.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TGList (TInterface (Name {namespace = "Gst", name = "PluginFeature"})))
-- throws : False
-- Skip return : False

foreign import ccall "gst_registry_get_feature_list_by_plugin" gst_registry_get_feature_list_by_plugin :: 
    Ptr Registry ->                         -- registry : TInterface (Name {namespace = "Gst", name = "Registry"})
    CString ->                              -- name : TBasicType TUTF8
    IO (Ptr (GList (Ptr Gst.PluginFeature.PluginFeature)))

{- |
Retrieves a 'GI.GLib.Structs.List.List' of features of the plugin with name /@name@/.
-}
registryGetFeatureListByPlugin ::
    (B.CallStack.HasCallStack, MonadIO m, IsRegistry a) =>
    a
    {- ^ /@registry@/: a 'GI.Gst.Objects.Registry.Registry'. -}
    -> T.Text
    {- ^ /@name@/: a plugin name. -}
    -> m [Gst.PluginFeature.PluginFeature]
    {- ^ __Returns:__ a 'GI.GLib.Structs.List.List' of
    'GI.Gst.Objects.PluginFeature.PluginFeature'. Use 'GI.Gst.Objects.PluginFeature.pluginFeatureListFree' after usage. -}
registryGetFeatureListByPlugin registry name = liftIO $ do
    registry' <- unsafeManagedPtrCastPtr registry
    name' <- textToCString name
    result <- gst_registry_get_feature_list_by_plugin registry' name'
    result' <- unpackGList result
    result'' <- mapM (wrapObject Gst.PluginFeature.PluginFeature) result'
    g_list_free result
    touchManagedPtr registry
    freeMem name'
    return result''

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data RegistryGetFeatureListByPluginMethodInfo
instance (signature ~ (T.Text -> m [Gst.PluginFeature.PluginFeature]), MonadIO m, IsRegistry a) => O.MethodInfo RegistryGetFeatureListByPluginMethodInfo a signature where
    overloadedMethod _ = registryGetFeatureListByPlugin

#endif

-- method Registry::get_feature_list_cookie
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "registry", argType = TInterface (Name {namespace = "Gst", name = "Registry"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the registry", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt32)
-- throws : False
-- Skip return : False

foreign import ccall "gst_registry_get_feature_list_cookie" gst_registry_get_feature_list_cookie :: 
    Ptr Registry ->                         -- registry : TInterface (Name {namespace = "Gst", name = "Registry"})
    IO Word32

{- |
Returns the registry\'s feature list cookie. This changes
every time a feature is added or removed from the registry.
-}
registryGetFeatureListCookie ::
    (B.CallStack.HasCallStack, MonadIO m, IsRegistry a) =>
    a
    {- ^ /@registry@/: the registry -}
    -> m Word32
    {- ^ __Returns:__ the feature list cookie. -}
registryGetFeatureListCookie registry = liftIO $ do
    registry' <- unsafeManagedPtrCastPtr registry
    result <- gst_registry_get_feature_list_cookie registry'
    touchManagedPtr registry
    return result

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data RegistryGetFeatureListCookieMethodInfo
instance (signature ~ (m Word32), MonadIO m, IsRegistry a) => O.MethodInfo RegistryGetFeatureListCookieMethodInfo a signature where
    overloadedMethod _ = registryGetFeatureListCookie

#endif

-- method Registry::get_plugin_list
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "registry", argType = TInterface (Name {namespace = "Gst", name = "Registry"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the registry to search", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TGList (TInterface (Name {namespace = "Gst", name = "Plugin"})))
-- throws : False
-- Skip return : False

foreign import ccall "gst_registry_get_plugin_list" gst_registry_get_plugin_list :: 
    Ptr Registry ->                         -- registry : TInterface (Name {namespace = "Gst", name = "Registry"})
    IO (Ptr (GList (Ptr Gst.Plugin.Plugin)))

{- |
Get a copy of all plugins registered in the given registry. The refcount
of each element in the list in incremented.
-}
registryGetPluginList ::
    (B.CallStack.HasCallStack, MonadIO m, IsRegistry a) =>
    a
    {- ^ /@registry@/: the registry to search -}
    -> m [Gst.Plugin.Plugin]
    {- ^ __Returns:__ a 'GI.GLib.Structs.List.List' of 'GI.Gst.Objects.Plugin.Plugin'.
    Use 'GI.Gst.Objects.Plugin.pluginListFree' after usage.

MT safe. -}
registryGetPluginList registry = liftIO $ do
    registry' <- unsafeManagedPtrCastPtr registry
    result <- gst_registry_get_plugin_list registry'
    result' <- unpackGList result
    result'' <- mapM (wrapObject Gst.Plugin.Plugin) result'
    g_list_free result
    touchManagedPtr registry
    return result''

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data RegistryGetPluginListMethodInfo
instance (signature ~ (m [Gst.Plugin.Plugin]), MonadIO m, IsRegistry a) => O.MethodInfo RegistryGetPluginListMethodInfo a signature where
    overloadedMethod _ = registryGetPluginList

#endif

-- method Registry::lookup
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "registry", argType = TInterface (Name {namespace = "Gst", name = "Registry"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the registry to look up in", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "filename", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the file to look up", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Plugin"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_registry_lookup" gst_registry_lookup :: 
    Ptr Registry ->                         -- registry : TInterface (Name {namespace = "Gst", name = "Registry"})
    CString ->                              -- filename : TBasicType TUTF8
    IO (Ptr Gst.Plugin.Plugin)

{- |
Look up a plugin in the given registry with the given filename.
If found, plugin is reffed.
-}
registryLookup ::
    (B.CallStack.HasCallStack, MonadIO m, IsRegistry a) =>
    a
    {- ^ /@registry@/: the registry to look up in -}
    -> T.Text
    {- ^ /@filename@/: the name of the file to look up -}
    -> m (Maybe Gst.Plugin.Plugin)
    {- ^ __Returns:__ the 'GI.Gst.Objects.Plugin.Plugin' if found, or
    'Nothing' if not.  'GI.Gst.Objects.Object.objectUnref' after usage. -}
registryLookup registry filename = liftIO $ do
    registry' <- unsafeManagedPtrCastPtr registry
    filename' <- textToCString filename
    result <- gst_registry_lookup registry' filename'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapObject Gst.Plugin.Plugin) result'
        return result''
    touchManagedPtr registry
    freeMem filename'
    return maybeResult

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data RegistryLookupMethodInfo
instance (signature ~ (T.Text -> m (Maybe Gst.Plugin.Plugin)), MonadIO m, IsRegistry a) => O.MethodInfo RegistryLookupMethodInfo a signature where
    overloadedMethod _ = registryLookup

#endif

-- method Registry::lookup_feature
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "registry", argType = TInterface (Name {namespace = "Gst", name = "Registry"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstRegistry", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstPluginFeature name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "PluginFeature"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_registry_lookup_feature" gst_registry_lookup_feature :: 
    Ptr Registry ->                         -- registry : TInterface (Name {namespace = "Gst", name = "Registry"})
    CString ->                              -- name : TBasicType TUTF8
    IO (Ptr Gst.PluginFeature.PluginFeature)

{- |
Find a 'GI.Gst.Objects.PluginFeature.PluginFeature' with /@name@/ in /@registry@/.
-}
registryLookupFeature ::
    (B.CallStack.HasCallStack, MonadIO m, IsRegistry a) =>
    a
    {- ^ /@registry@/: a 'GI.Gst.Objects.Registry.Registry' -}
    -> T.Text
    {- ^ /@name@/: a 'GI.Gst.Objects.PluginFeature.PluginFeature' name -}
    -> m Gst.PluginFeature.PluginFeature
    {- ^ __Returns:__ a 'GI.Gst.Objects.PluginFeature.PluginFeature' with its refcount incremented,
    use 'GI.Gst.Objects.Object.objectUnref' after usage.

MT safe. -}
registryLookupFeature registry name = liftIO $ do
    registry' <- unsafeManagedPtrCastPtr registry
    name' <- textToCString name
    result <- gst_registry_lookup_feature registry' name'
    checkUnexpectedReturnNULL "registryLookupFeature" result
    result' <- (wrapObject Gst.PluginFeature.PluginFeature) result
    touchManagedPtr registry
    freeMem name'
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data RegistryLookupFeatureMethodInfo
instance (signature ~ (T.Text -> m Gst.PluginFeature.PluginFeature), MonadIO m, IsRegistry a) => O.MethodInfo RegistryLookupFeatureMethodInfo a signature where
    overloadedMethod _ = registryLookupFeature

#endif

-- method Registry::plugin_filter
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "registry", argType = TInterface (Name {namespace = "Gst", name = "Registry"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "registry to query", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "filter", argType = TInterface (Name {namespace = "Gst", name = "PluginFilter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the filter to use", sinceVersion = Nothing}, argScope = ScopeTypeCall, argClosure = 3, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "first", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "only return first match", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user data passed to the filter function", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TGList (TInterface (Name {namespace = "Gst", name = "Plugin"})))
-- throws : False
-- Skip return : False

foreign import ccall "gst_registry_plugin_filter" gst_registry_plugin_filter :: 
    Ptr Registry ->                         -- registry : TInterface (Name {namespace = "Gst", name = "Registry"})
    FunPtr Gst.Callbacks.C_PluginFilter ->  -- filter : TInterface (Name {namespace = "Gst", name = "PluginFilter"})
    CInt ->                                 -- first : TBasicType TBoolean
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO (Ptr (GList (Ptr Gst.Plugin.Plugin)))

{- |
Runs a filter against all plugins in the registry and returns a 'GI.GLib.Structs.List.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 'GI.Gst.Objects.Plugin.pluginListFree' after use, which
will unref again.
-}
registryPluginFilter ::
    (B.CallStack.HasCallStack, MonadIO m, IsRegistry a) =>
    a
    {- ^ /@registry@/: registry to query -}
    -> Gst.Callbacks.PluginFilter
    {- ^ /@filter@/: the filter to use -}
    -> Bool
    {- ^ /@first@/: only return first match -}
    -> m [Gst.Plugin.Plugin]
    {- ^ __Returns:__ a 'GI.GLib.Structs.List.List' of 'GI.Gst.Objects.Plugin.Plugin'.
    Use 'GI.Gst.Objects.Plugin.pluginListFree' after usage.

MT safe. -}
registryPluginFilter registry filter first = liftIO $ do
    registry' <- unsafeManagedPtrCastPtr registry
    filter' <- Gst.Callbacks.mk_PluginFilter (Gst.Callbacks.wrap_PluginFilter Nothing (Gst.Callbacks.drop_closures_PluginFilter filter))
    let first' = (fromIntegral . fromEnum) first
    let userData = nullPtr
    result <- gst_registry_plugin_filter registry' filter' first' userData
    result' <- unpackGList result
    result'' <- mapM (wrapObject Gst.Plugin.Plugin) result'
    g_list_free result
    safeFreeFunPtr $ castFunPtrToPtr filter'
    touchManagedPtr registry
    return result''

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data RegistryPluginFilterMethodInfo
instance (signature ~ (Gst.Callbacks.PluginFilter -> Bool -> m [Gst.Plugin.Plugin]), MonadIO m, IsRegistry a) => O.MethodInfo RegistryPluginFilterMethodInfo a signature where
    overloadedMethod _ = registryPluginFilter

#endif

-- method Registry::remove_feature
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "registry", argType = TInterface (Name {namespace = "Gst", name = "Registry"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the registry to remove the feature from", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "feature", argType = TInterface (Name {namespace = "Gst", name = "PluginFeature"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the feature to remove", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_registry_remove_feature" gst_registry_remove_feature :: 
    Ptr Registry ->                         -- registry : TInterface (Name {namespace = "Gst", name = "Registry"})
    Ptr Gst.PluginFeature.PluginFeature ->  -- feature : TInterface (Name {namespace = "Gst", name = "PluginFeature"})
    IO ()

{- |
Remove the feature from the registry.

MT safe.
-}
registryRemoveFeature ::
    (B.CallStack.HasCallStack, MonadIO m, IsRegistry a, Gst.PluginFeature.IsPluginFeature b) =>
    a
    {- ^ /@registry@/: the registry to remove the feature from -}
    -> b
    {- ^ /@feature@/: the feature to remove -}
    -> m ()
registryRemoveFeature registry feature = liftIO $ do
    registry' <- unsafeManagedPtrCastPtr registry
    feature' <- unsafeManagedPtrCastPtr feature
    gst_registry_remove_feature registry' feature'
    touchManagedPtr registry
    touchManagedPtr feature
    return ()

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data RegistryRemoveFeatureMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsRegistry a, Gst.PluginFeature.IsPluginFeature b) => O.MethodInfo RegistryRemoveFeatureMethodInfo a signature where
    overloadedMethod _ = registryRemoveFeature

#endif

-- method Registry::remove_plugin
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "registry", argType = TInterface (Name {namespace = "Gst", name = "Registry"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the registry to remove the plugin from", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "plugin", argType = TInterface (Name {namespace = "Gst", name = "Plugin"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the plugin to remove", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_registry_remove_plugin" gst_registry_remove_plugin :: 
    Ptr Registry ->                         -- registry : TInterface (Name {namespace = "Gst", name = "Registry"})
    Ptr Gst.Plugin.Plugin ->                -- plugin : TInterface (Name {namespace = "Gst", name = "Plugin"})
    IO ()

{- |
Remove the plugin from the registry.

MT safe.
-}
registryRemovePlugin ::
    (B.CallStack.HasCallStack, MonadIO m, IsRegistry a, Gst.Plugin.IsPlugin b) =>
    a
    {- ^ /@registry@/: the registry to remove the plugin from -}
    -> b
    {- ^ /@plugin@/: the plugin to remove -}
    -> m ()
registryRemovePlugin registry plugin = liftIO $ do
    registry' <- unsafeManagedPtrCastPtr registry
    plugin' <- unsafeManagedPtrCastPtr plugin
    gst_registry_remove_plugin registry' plugin'
    touchManagedPtr registry
    touchManagedPtr plugin
    return ()

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data RegistryRemovePluginMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsRegistry a, Gst.Plugin.IsPlugin b) => O.MethodInfo RegistryRemovePluginMethodInfo a signature where
    overloadedMethod _ = registryRemovePlugin

#endif

-- method Registry::scan_path
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "registry", argType = TInterface (Name {namespace = "Gst", name = "Registry"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the registry to add found plugins to", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the path to scan", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_registry_scan_path" gst_registry_scan_path :: 
    Ptr Registry ->                         -- registry : TInterface (Name {namespace = "Gst", name = "Registry"})
    CString ->                              -- path : TBasicType TUTF8
    IO CInt

{- |
Scan the given path for plugins to add to the registry. The syntax of the
path is specific to the registry.
-}
registryScanPath ::
    (B.CallStack.HasCallStack, MonadIO m, IsRegistry a) =>
    a
    {- ^ /@registry@/: the registry to add found plugins to -}
    -> T.Text
    {- ^ /@path@/: the path to scan -}
    -> m Bool
    {- ^ __Returns:__ 'True' if registry changed -}
registryScanPath registry path = liftIO $ do
    registry' <- unsafeManagedPtrCastPtr registry
    path' <- textToCString path
    result <- gst_registry_scan_path registry' path'
    let result' = (/= 0) result
    touchManagedPtr registry
    freeMem path'
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data RegistryScanPathMethodInfo
instance (signature ~ (T.Text -> m Bool), MonadIO m, IsRegistry a) => O.MethodInfo RegistryScanPathMethodInfo a signature where
    overloadedMethod _ = registryScanPath

#endif

-- method Registry::fork_is_enabled
-- method type : MemberFunction
-- Args : []
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_registry_fork_is_enabled" gst_registry_fork_is_enabled :: 
    IO CInt

{- |
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
'GI.Gst.Objects.Registry.registryForkSetEnabled' function, in which case new plugins
are scanned (and loaded) into the application process.
-}
registryForkIsEnabled ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Bool
    {- ^ __Returns:__ 'True' if GStreamer will use the child helper process when
rebuilding the registry. -}
registryForkIsEnabled  = liftIO $ do
    result <- gst_registry_fork_is_enabled
    let result' = (/= 0) result
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
#endif

-- method Registry::fork_set_enabled
-- method type : MemberFunction
-- Args : [Arg {argCName = "enabled", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "whether rebuilding the registry can use a temporary child helper process.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_registry_fork_set_enabled" gst_registry_fork_set_enabled :: 
    CInt ->                                 -- enabled : TBasicType TBoolean
    IO ()

{- |
Applications might want to disable\/enable spawning of a child helper process
when rebuilding the registry. See 'GI.Gst.Objects.Registry.registryForkIsEnabled' for more
information.
-}
registryForkSetEnabled ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Bool
    {- ^ /@enabled@/: whether rebuilding the registry can use a temporary child helper process. -}
    -> m ()
registryForkSetEnabled enabled = liftIO $ do
    let enabled' = (fromIntegral . fromEnum) enabled
    gst_registry_fork_set_enabled enabled'
    return ()

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
#endif

-- method Registry::get
-- method type : MemberFunction
-- Args : []
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Registry"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_registry_get" gst_registry_get :: 
    IO (Ptr Registry)

{- |
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.
-}
registryGet ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Registry
    {- ^ __Returns:__ the 'GI.Gst.Objects.Registry.Registry'. -}
registryGet  = liftIO $ do
    result <- gst_registry_get
    checkUnexpectedReturnNULL "registryGet" result
    result' <- (newObject Registry) result
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
#endif