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

This is a base class for anything that can be added to a 'GI.Gst.Objects.Plugin.Plugin'.
-}

#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
       && !defined(__HADDOCK_VERSION__))

module GI.Gst.Objects.PluginFeature
    (

-- * Exported types
    PluginFeature(..)                       ,
    IsPluginFeature                         ,
    toPluginFeature                         ,
    noPluginFeature                         ,


 -- * Methods
-- ** checkVersion #method:checkVersion#

#if ENABLE_OVERLOADING
    PluginFeatureCheckVersionMethodInfo     ,
#endif
    pluginFeatureCheckVersion               ,


-- ** getPlugin #method:getPlugin#

#if ENABLE_OVERLOADING
    PluginFeatureGetPluginMethodInfo        ,
#endif
    pluginFeatureGetPlugin                  ,


-- ** getPluginName #method:getPluginName#

#if ENABLE_OVERLOADING
    PluginFeatureGetPluginNameMethodInfo    ,
#endif
    pluginFeatureGetPluginName              ,


-- ** getRank #method:getRank#

#if ENABLE_OVERLOADING
    PluginFeatureGetRankMethodInfo          ,
#endif
    pluginFeatureGetRank                    ,


-- ** listCopy #method:listCopy#

    pluginFeatureListCopy                   ,


-- ** listDebug #method:listDebug#

    pluginFeatureListDebug                  ,


-- ** listFree #method:listFree#

    pluginFeatureListFree                   ,


-- ** load #method:load#

#if ENABLE_OVERLOADING
    PluginFeatureLoadMethodInfo             ,
#endif
    pluginFeatureLoad                       ,


-- ** rankCompareFunc #method:rankCompareFunc#

    pluginFeatureRankCompareFunc            ,


-- ** setRank #method:setRank#

#if ENABLE_OVERLOADING
    PluginFeatureSetRankMethodInfo          ,
#endif
    pluginFeatureSetRank                    ,




    ) 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.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
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 GHC.OverloadedLabels as OL

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

-- | Memory-managed wrapper type.
newtype PluginFeature = PluginFeature (ManagedPtr PluginFeature)
foreign import ccall "gst_plugin_feature_get_type"
    c_gst_plugin_feature_get_type :: IO GType

instance GObject PluginFeature where
    gobjectType = c_gst_plugin_feature_get_type


-- | Type class for types which can be safely cast to `PluginFeature`, for instance with `toPluginFeature`.
class (GObject o, O.IsDescendantOf PluginFeature o) => IsPluginFeature o
instance (GObject o, O.IsDescendantOf PluginFeature o) => IsPluginFeature o

instance O.HasParentTypes PluginFeature
type instance O.ParentTypes PluginFeature = '[Gst.Object.Object, GObject.Object.Object]

-- | Cast to `PluginFeature`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toPluginFeature :: (MonadIO m, IsPluginFeature o) => o -> m PluginFeature
toPluginFeature = liftIO . unsafeCastTo PluginFeature

-- | A convenience alias for `Nothing` :: `Maybe` `PluginFeature`.
noPluginFeature :: Maybe PluginFeature
noPluginFeature = Nothing

#if ENABLE_OVERLOADING
type family ResolvePluginFeatureMethod (t :: Symbol) (o :: *) :: * where
    ResolvePluginFeatureMethod "addControlBinding" o = Gst.Object.ObjectAddControlBindingMethodInfo
    ResolvePluginFeatureMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolvePluginFeatureMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolvePluginFeatureMethod "checkVersion" o = PluginFeatureCheckVersionMethodInfo
    ResolvePluginFeatureMethod "defaultError" o = Gst.Object.ObjectDefaultErrorMethodInfo
    ResolvePluginFeatureMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolvePluginFeatureMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolvePluginFeatureMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolvePluginFeatureMethod "hasActiveControlBindings" o = Gst.Object.ObjectHasActiveControlBindingsMethodInfo
    ResolvePluginFeatureMethod "hasAncestor" o = Gst.Object.ObjectHasAncestorMethodInfo
    ResolvePluginFeatureMethod "hasAsAncestor" o = Gst.Object.ObjectHasAsAncestorMethodInfo
    ResolvePluginFeatureMethod "hasAsParent" o = Gst.Object.ObjectHasAsParentMethodInfo
    ResolvePluginFeatureMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolvePluginFeatureMethod "load" o = PluginFeatureLoadMethodInfo
    ResolvePluginFeatureMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolvePluginFeatureMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolvePluginFeatureMethod "ref" o = Gst.Object.ObjectRefMethodInfo
    ResolvePluginFeatureMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolvePluginFeatureMethod "removeControlBinding" o = Gst.Object.ObjectRemoveControlBindingMethodInfo
    ResolvePluginFeatureMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolvePluginFeatureMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolvePluginFeatureMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolvePluginFeatureMethod "suggestNextSync" o = Gst.Object.ObjectSuggestNextSyncMethodInfo
    ResolvePluginFeatureMethod "syncValues" o = Gst.Object.ObjectSyncValuesMethodInfo
    ResolvePluginFeatureMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolvePluginFeatureMethod "unparent" o = Gst.Object.ObjectUnparentMethodInfo
    ResolvePluginFeatureMethod "unref" o = Gst.Object.ObjectUnrefMethodInfo
    ResolvePluginFeatureMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolvePluginFeatureMethod "getControlBinding" o = Gst.Object.ObjectGetControlBindingMethodInfo
    ResolvePluginFeatureMethod "getControlRate" o = Gst.Object.ObjectGetControlRateMethodInfo
    ResolvePluginFeatureMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolvePluginFeatureMethod "getGValueArray" o = Gst.Object.ObjectGetGValueArrayMethodInfo
    ResolvePluginFeatureMethod "getName" o = Gst.Object.ObjectGetNameMethodInfo
    ResolvePluginFeatureMethod "getParent" o = Gst.Object.ObjectGetParentMethodInfo
    ResolvePluginFeatureMethod "getPathString" o = Gst.Object.ObjectGetPathStringMethodInfo
    ResolvePluginFeatureMethod "getPlugin" o = PluginFeatureGetPluginMethodInfo
    ResolvePluginFeatureMethod "getPluginName" o = PluginFeatureGetPluginNameMethodInfo
    ResolvePluginFeatureMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolvePluginFeatureMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolvePluginFeatureMethod "getRank" o = PluginFeatureGetRankMethodInfo
    ResolvePluginFeatureMethod "getValue" o = Gst.Object.ObjectGetValueMethodInfo
    ResolvePluginFeatureMethod "setControlBindingDisabled" o = Gst.Object.ObjectSetControlBindingDisabledMethodInfo
    ResolvePluginFeatureMethod "setControlBindingsDisabled" o = Gst.Object.ObjectSetControlBindingsDisabledMethodInfo
    ResolvePluginFeatureMethod "setControlRate" o = Gst.Object.ObjectSetControlRateMethodInfo
    ResolvePluginFeatureMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolvePluginFeatureMethod "setName" o = Gst.Object.ObjectSetNameMethodInfo
    ResolvePluginFeatureMethod "setParent" o = Gst.Object.ObjectSetParentMethodInfo
    ResolvePluginFeatureMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolvePluginFeatureMethod "setRank" o = PluginFeatureSetRankMethodInfo
    ResolvePluginFeatureMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolvePluginFeatureMethod t PluginFeature, O.MethodInfo info PluginFeature p) => OL.IsLabel t (PluginFeature -> 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

#if ENABLE_OVERLOADING
instance O.HasAttributeList PluginFeature
type instance O.AttributeList PluginFeature = PluginFeatureAttributeList
type PluginFeatureAttributeList = ('[ '("name", Gst.Object.ObjectNamePropertyInfo), '("parent", Gst.Object.ObjectParentPropertyInfo)] :: [(Symbol, *)])
#endif

#if ENABLE_OVERLOADING
#endif

#if ENABLE_OVERLOADING
type instance O.SignalList PluginFeature = PluginFeatureSignalList
type PluginFeatureSignalList = ('[ '("deepNotify", Gst.Object.ObjectDeepNotifySignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif

-- method PluginFeature::check_version
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "feature", argType = TInterface (Name {namespace = "Gst", name = "PluginFeature"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a feature", 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 "minimum required major version", 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 "minimum required minor version", 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 "minimum required micro version", 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_plugin_feature_check_version" gst_plugin_feature_check_version ::
    Ptr PluginFeature ->                    -- feature : TInterface (Name {namespace = "Gst", name = "PluginFeature"})
    Word32 ->                               -- min_major : TBasicType TUInt
    Word32 ->                               -- min_minor : TBasicType TUInt
    Word32 ->                               -- min_micro : TBasicType TUInt
    IO CInt

{- |
Checks whether the given plugin feature is at least
 the required version
-}
pluginFeatureCheckVersion ::
    (B.CallStack.HasCallStack, MonadIO m, IsPluginFeature a) =>
    a
    {- ^ /@feature@/: a feature -}
    -> Word32
    {- ^ /@minMajor@/: minimum required major version -}
    -> Word32
    {- ^ /@minMinor@/: minimum required minor version -}
    -> Word32
    {- ^ /@minMicro@/: minimum required micro version -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the plugin feature has at least
 the required version, otherwise 'False'. -}
pluginFeatureCheckVersion feature minMajor minMinor minMicro = liftIO $ do
    feature' <- unsafeManagedPtrCastPtr feature
    result <- gst_plugin_feature_check_version feature' minMajor minMinor minMicro
    let result' = (/= 0) result
    touchManagedPtr feature
    return result'

#if ENABLE_OVERLOADING
data PluginFeatureCheckVersionMethodInfo
instance (signature ~ (Word32 -> Word32 -> Word32 -> m Bool), MonadIO m, IsPluginFeature a) => O.MethodInfo PluginFeatureCheckVersionMethodInfo a signature where
    overloadedMethod _ = pluginFeatureCheckVersion

#endif

-- method PluginFeature::get_plugin
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "feature", argType = TInterface (Name {namespace = "Gst", name = "PluginFeature"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a feature", 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_plugin_feature_get_plugin" gst_plugin_feature_get_plugin ::
    Ptr PluginFeature ->                    -- feature : TInterface (Name {namespace = "Gst", name = "PluginFeature"})
    IO (Ptr Gst.Plugin.Plugin)

{- |
Get the plugin that provides this feature.
-}
pluginFeatureGetPlugin ::
    (B.CallStack.HasCallStack, MonadIO m, IsPluginFeature a) =>
    a
    {- ^ /@feature@/: a feature -}
    -> m (Maybe Gst.Plugin.Plugin)
    {- ^ __Returns:__ the plugin that provides this
    feature, or 'Nothing'.  Unref with 'GI.Gst.Objects.Object.objectUnref' when no
    longer needed. -}
pluginFeatureGetPlugin feature = liftIO $ do
    feature' <- unsafeManagedPtrCastPtr feature
    result <- gst_plugin_feature_get_plugin feature'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapObject Gst.Plugin.Plugin) result'
        return result''
    touchManagedPtr feature
    return maybeResult

#if ENABLE_OVERLOADING
data PluginFeatureGetPluginMethodInfo
instance (signature ~ (m (Maybe Gst.Plugin.Plugin)), MonadIO m, IsPluginFeature a) => O.MethodInfo PluginFeatureGetPluginMethodInfo a signature where
    overloadedMethod _ = pluginFeatureGetPlugin

#endif

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

foreign import ccall "gst_plugin_feature_get_plugin_name" gst_plugin_feature_get_plugin_name ::
    Ptr PluginFeature ->                    -- feature : TInterface (Name {namespace = "Gst", name = "PluginFeature"})
    IO CString

{- |
Get the name of the plugin that provides this feature.

/Since: 1.2/
-}
pluginFeatureGetPluginName ::
    (B.CallStack.HasCallStack, MonadIO m, IsPluginFeature a) =>
    a
    {- ^ /@feature@/: a feature -}
    -> m (Maybe T.Text)
    {- ^ __Returns:__ the name of the plugin that provides this
    feature, or 'Nothing' if the feature is not associated with a
    plugin. -}
pluginFeatureGetPluginName feature = liftIO $ do
    feature' <- unsafeManagedPtrCastPtr feature
    result <- gst_plugin_feature_get_plugin_name feature'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- cstringToText result'
        return result''
    touchManagedPtr feature
    return maybeResult

#if ENABLE_OVERLOADING
data PluginFeatureGetPluginNameMethodInfo
instance (signature ~ (m (Maybe T.Text)), MonadIO m, IsPluginFeature a) => O.MethodInfo PluginFeatureGetPluginNameMethodInfo a signature where
    overloadedMethod _ = pluginFeatureGetPluginName

#endif

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

foreign import ccall "gst_plugin_feature_get_rank" gst_plugin_feature_get_rank ::
    Ptr PluginFeature ->                    -- feature : TInterface (Name {namespace = "Gst", name = "PluginFeature"})
    IO Word32

{- |
Gets the rank of a plugin feature.
-}
pluginFeatureGetRank ::
    (B.CallStack.HasCallStack, MonadIO m, IsPluginFeature a) =>
    a
    {- ^ /@feature@/: a feature -}
    -> m Word32
    {- ^ __Returns:__ The rank of the feature -}
pluginFeatureGetRank feature = liftIO $ do
    feature' <- unsafeManagedPtrCastPtr feature
    result <- gst_plugin_feature_get_rank feature'
    touchManagedPtr feature
    return result

#if ENABLE_OVERLOADING
data PluginFeatureGetRankMethodInfo
instance (signature ~ (m Word32), MonadIO m, IsPluginFeature a) => O.MethodInfo PluginFeatureGetRankMethodInfo a signature where
    overloadedMethod _ = pluginFeatureGetRank

#endif

-- method PluginFeature::load
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "feature", argType = TInterface (Name {namespace = "Gst", name = "PluginFeature"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the plugin feature to check", 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_plugin_feature_load" gst_plugin_feature_load ::
    Ptr PluginFeature ->                    -- feature : TInterface (Name {namespace = "Gst", name = "PluginFeature"})
    IO (Ptr PluginFeature)

{- |
Loads the plugin containing /@feature@/ if it\'s not already loaded. /@feature@/ is
unaffected; use the return value instead.

Normally this function is used like this:

=== /C code/
>
>GstPluginFeature *loaded_feature;
>
>loaded_feature = gst_plugin_feature_load (feature);
>// presumably, we're no longer interested in the potentially-unloaded feature
>gst_object_unref (feature);
>feature = loaded_feature;
-}
pluginFeatureLoad ::
    (B.CallStack.HasCallStack, MonadIO m, IsPluginFeature a) =>
    a
    {- ^ /@feature@/: the plugin feature to check -}
    -> m (Maybe PluginFeature)
    {- ^ __Returns:__ a reference to the loaded
feature, or 'Nothing' on error -}
pluginFeatureLoad feature = liftIO $ do
    feature' <- unsafeManagedPtrCastPtr feature
    result <- gst_plugin_feature_load feature'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapObject PluginFeature) result'
        return result''
    touchManagedPtr feature
    return maybeResult

#if ENABLE_OVERLOADING
data PluginFeatureLoadMethodInfo
instance (signature ~ (m (Maybe PluginFeature)), MonadIO m, IsPluginFeature a) => O.MethodInfo PluginFeatureLoadMethodInfo a signature where
    overloadedMethod _ = pluginFeatureLoad

#endif

-- method PluginFeature::set_rank
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "feature", argType = TInterface (Name {namespace = "Gst", name = "PluginFeature"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "feature to rank", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "rank", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "rank value - higher number means more priority rank", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_plugin_feature_set_rank" gst_plugin_feature_set_rank ::
    Ptr PluginFeature ->                    -- feature : TInterface (Name {namespace = "Gst", name = "PluginFeature"})
    Word32 ->                               -- rank : TBasicType TUInt
    IO ()

{- |
Specifies a rank for a plugin feature, so that autoplugging uses
the most appropriate feature.
-}
pluginFeatureSetRank ::
    (B.CallStack.HasCallStack, MonadIO m, IsPluginFeature a) =>
    a
    {- ^ /@feature@/: feature to rank -}
    -> Word32
    {- ^ /@rank@/: rank value - higher number means more priority rank -}
    -> m ()
pluginFeatureSetRank feature rank = liftIO $ do
    feature' <- unsafeManagedPtrCastPtr feature
    gst_plugin_feature_set_rank feature' rank
    touchManagedPtr feature
    return ()

#if ENABLE_OVERLOADING
data PluginFeatureSetRankMethodInfo
instance (signature ~ (Word32 -> m ()), MonadIO m, IsPluginFeature a) => O.MethodInfo PluginFeatureSetRankMethodInfo a signature where
    overloadedMethod _ = pluginFeatureSetRank

#endif

-- method PluginFeature::list_copy
-- method type : MemberFunction
-- Args : [Arg {argCName = "list", argType = TGList (TInterface (Name {namespace = "Gst", name = "PluginFeature"})), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "list\n    of #GstPluginFeature", 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_plugin_feature_list_copy" gst_plugin_feature_list_copy ::
    Ptr (GList (Ptr PluginFeature)) ->      -- list : TGList (TInterface (Name {namespace = "Gst", name = "PluginFeature"}))
    IO (Ptr (GList (Ptr PluginFeature)))

{- |
Copies the list of features. Caller should call /@gstPluginFeatureListFree@/
when done with the list.
-}
pluginFeatureListCopy ::
    (B.CallStack.HasCallStack, MonadIO m, IsPluginFeature a) =>
    [a]
    {- ^ /@list@/: list
    of 'GI.Gst.Objects.PluginFeature.PluginFeature' -}
    -> m [PluginFeature]
    {- ^ __Returns:__ a copy of /@list@/,
    with each feature\'s reference count incremented. -}
pluginFeatureListCopy list = liftIO $ do
    list' <- mapM unsafeManagedPtrCastPtr list
    list'' <- packGList list'
    result <- gst_plugin_feature_list_copy list''
    result' <- unpackGList result
    result'' <- mapM (wrapObject PluginFeature) result'
    g_list_free result
    mapM_ touchManagedPtr list
    g_list_free list''
    return result''

#if ENABLE_OVERLOADING
#endif

-- method PluginFeature::list_debug
-- method type : MemberFunction
-- Args : [Arg {argCName = "list", argType = TGList (TInterface (Name {namespace = "Gst", name = "PluginFeature"})), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GList of\n    plugin features", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_plugin_feature_list_debug" gst_plugin_feature_list_debug ::
    Ptr (GList (Ptr PluginFeature)) ->      -- list : TGList (TInterface (Name {namespace = "Gst", name = "PluginFeature"}))
    IO ()

{- |
Debug the plugin feature names in /@list@/.
-}
pluginFeatureListDebug ::
    (B.CallStack.HasCallStack, MonadIO m, IsPluginFeature a) =>
    [a]
    {- ^ /@list@/: a 'GI.GLib.Structs.List.List' of
    plugin features -}
    -> m ()
pluginFeatureListDebug list = liftIO $ do
    list' <- mapM unsafeManagedPtrCastPtr list
    list'' <- packGList list'
    gst_plugin_feature_list_debug list''
    mapM_ touchManagedPtr list
    g_list_free list''
    return ()

#if ENABLE_OVERLOADING
#endif

-- method PluginFeature::list_free
-- method type : MemberFunction
-- Args : [Arg {argCName = "list", argType = TGList (TInterface (Name {namespace = "Gst", name = "PluginFeature"})), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "list\n    of #GstPluginFeature", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_plugin_feature_list_free" gst_plugin_feature_list_free ::
    Ptr (GList (Ptr PluginFeature)) ->      -- list : TGList (TInterface (Name {namespace = "Gst", name = "PluginFeature"}))
    IO ()

{- |
Unrefs each member of /@list@/, then frees the list.
-}
pluginFeatureListFree ::
    (B.CallStack.HasCallStack, MonadIO m, IsPluginFeature a) =>
    [a]
    {- ^ /@list@/: list
    of 'GI.Gst.Objects.PluginFeature.PluginFeature' -}
    -> m ()
pluginFeatureListFree list = liftIO $ do
    list' <- mapM B.ManagedPtr.disownObject list
    list'' <- packGList list'
    gst_plugin_feature_list_free list''
    mapM_ touchManagedPtr list
    return ()

#if ENABLE_OVERLOADING
#endif

-- method PluginFeature::rank_compare_func
-- method type : MemberFunction
-- Args : [Arg {argCName = "p1", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #GstPluginFeature", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "p2", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #GstPluginFeature", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "gst_plugin_feature_rank_compare_func" gst_plugin_feature_rank_compare_func ::
    Ptr () ->                               -- p1 : TBasicType TPtr
    Ptr () ->                               -- p2 : TBasicType TPtr
    IO Int32

{- |
Compares the two given 'GI.Gst.Objects.PluginFeature.PluginFeature' instances. This function can be
used as a 'GI.GLib.Callbacks.CompareFunc' when sorting by rank and then by name.
-}
pluginFeatureRankCompareFunc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Ptr ()
    {- ^ /@p1@/: a 'GI.Gst.Objects.PluginFeature.PluginFeature' -}
    -> Ptr ()
    {- ^ /@p2@/: a 'GI.Gst.Objects.PluginFeature.PluginFeature' -}
    -> m Int32
    {- ^ __Returns:__ negative value if the rank of p1 > the rank of p2 or the ranks are
equal but the name of p1 comes before the name of p2; zero if the rank
and names are equal; positive value if the rank of p1 \< the rank of p2 or the
ranks are equal but the name of p2 comes before the name of p1 -}
pluginFeatureRankCompareFunc p1 p2 = liftIO $ do
    result <- gst_plugin_feature_rank_compare_func p1 p2
    return result

#if ENABLE_OVERLOADING
#endif