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

'GI.Gst.Structs.CapsFeatures.CapsFeatures' can optionally be set on a 'GI.Gst.Structs.Caps.Caps' to add requirements
for additional features for a specific 'GI.Gst.Structs.Structure.Structure'. Caps structures with
the same name but with a non-equal set of caps features are not compatible.
If a pad supports multiple sets of features it has to add multiple equal
structures with different feature sets to the caps.

Empty 'GI.Gst.Structs.CapsFeatures.CapsFeatures' are equivalent with the 'GI.Gst.Structs.CapsFeatures.CapsFeatures' that only
contain 'GI.Gst.Constants.CAPS_FEATURE_MEMORY_SYSTEM_MEMORY'. ANY 'GI.Gst.Structs.CapsFeatures.CapsFeatures' as
created by 'GI.Gst.Structs.CapsFeatures.capsFeaturesNewAny' are equal to any other 'GI.Gst.Structs.CapsFeatures.CapsFeatures'
and can be used to specify that any 'GI.Gst.Structs.CapsFeatures.CapsFeatures' would be supported, e.g.
for elements that don\'t touch buffer memory. 'GI.Gst.Structs.Caps.Caps' with ANY 'GI.Gst.Structs.CapsFeatures.CapsFeatures'
are considered non-fixed and during negotiation some 'GI.Gst.Structs.CapsFeatures.CapsFeatures' have
to be selected.

Examples for caps features would be the requirement of a specific 'GI.Gst.Structs.Memory.Memory'
types or the requirement of having a specific 'GI.Gst.Structs.Meta.Meta' on the buffer. Features
are given as a string of the format \"memory:GstMemoryTypeName\" or
\"meta:GstMetaAPIName\".

/Since: 1.2/
-}

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

module GI.Gst.Structs.CapsFeatures
    (

-- * Exported types
    CapsFeatures(..)                        ,
    noCapsFeatures                          ,


 -- * Methods
-- ** add #method:add#

#if ENABLE_OVERLOADING
    CapsFeaturesAddMethodInfo               ,
#endif
    capsFeaturesAdd                         ,


-- ** addId #method:addId#

#if ENABLE_OVERLOADING
    CapsFeaturesAddIdMethodInfo             ,
#endif
    capsFeaturesAddId                       ,


-- ** contains #method:contains#

#if ENABLE_OVERLOADING
    CapsFeaturesContainsMethodInfo          ,
#endif
    capsFeaturesContains                    ,


-- ** containsId #method:containsId#

#if ENABLE_OVERLOADING
    CapsFeaturesContainsIdMethodInfo        ,
#endif
    capsFeaturesContainsId                  ,


-- ** copy #method:copy#

#if ENABLE_OVERLOADING
    CapsFeaturesCopyMethodInfo              ,
#endif
    capsFeaturesCopy                        ,


-- ** free #method:free#

#if ENABLE_OVERLOADING
    CapsFeaturesFreeMethodInfo              ,
#endif
    capsFeaturesFree                        ,


-- ** fromString #method:fromString#

    capsFeaturesFromString                  ,


-- ** getNth #method:getNth#

#if ENABLE_OVERLOADING
    CapsFeaturesGetNthMethodInfo            ,
#endif
    capsFeaturesGetNth                      ,


-- ** getNthId #method:getNthId#

#if ENABLE_OVERLOADING
    CapsFeaturesGetNthIdMethodInfo          ,
#endif
    capsFeaturesGetNthId                    ,


-- ** getSize #method:getSize#

#if ENABLE_OVERLOADING
    CapsFeaturesGetSizeMethodInfo           ,
#endif
    capsFeaturesGetSize                     ,


-- ** isAny #method:isAny#

#if ENABLE_OVERLOADING
    CapsFeaturesIsAnyMethodInfo             ,
#endif
    capsFeaturesIsAny                       ,


-- ** isEqual #method:isEqual#

#if ENABLE_OVERLOADING
    CapsFeaturesIsEqualMethodInfo           ,
#endif
    capsFeaturesIsEqual                     ,


-- ** newAny #method:newAny#

    capsFeaturesNewAny                      ,


-- ** newEmpty #method:newEmpty#

    capsFeaturesNewEmpty                    ,


-- ** remove #method:remove#

#if ENABLE_OVERLOADING
    CapsFeaturesRemoveMethodInfo            ,
#endif
    capsFeaturesRemove                      ,


-- ** removeId #method:removeId#

#if ENABLE_OVERLOADING
    CapsFeaturesRemoveIdMethodInfo          ,
#endif
    capsFeaturesRemoveId                    ,


-- ** setParentRefcount #method:setParentRefcount#

#if ENABLE_OVERLOADING
    CapsFeaturesSetParentRefcountMethodInfo ,
#endif
    capsFeaturesSetParentRefcount           ,


-- ** toString #method:toString#

#if ENABLE_OVERLOADING
    CapsFeaturesToStringMethodInfo          ,
#endif
    capsFeaturesToString                    ,




    ) 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


-- | Memory-managed wrapper type.
newtype CapsFeatures = CapsFeatures (ManagedPtr CapsFeatures)
foreign import ccall "gst_caps_features_get_type" c_gst_caps_features_get_type ::
    IO GType

instance BoxedObject CapsFeatures where
    boxedType _ = c_gst_caps_features_get_type

-- | A convenience alias for `Nothing` :: `Maybe` `CapsFeatures`.
noCapsFeatures :: Maybe CapsFeatures
noCapsFeatures = Nothing


#if ENABLE_OVERLOADING
instance O.HasAttributeList CapsFeatures
type instance O.AttributeList CapsFeatures = CapsFeaturesAttributeList
type CapsFeaturesAttributeList = ('[ ] :: [(Symbol, *)])
#endif

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

foreign import ccall "gst_caps_features_new_any" gst_caps_features_new_any ::
    IO (Ptr CapsFeatures)

{- |
Creates a new, ANY 'GI.Gst.Structs.CapsFeatures.CapsFeatures'. This will be equal
to any other 'GI.Gst.Structs.CapsFeatures.CapsFeatures' but caps with these are
unfixed.

Free-function: gst_caps_features_free

/Since: 1.2/
-}
capsFeaturesNewAny ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m CapsFeatures
    {- ^ __Returns:__ a new, ANY 'GI.Gst.Structs.CapsFeatures.CapsFeatures' -}
capsFeaturesNewAny  = liftIO $ do
    result <- gst_caps_features_new_any
    checkUnexpectedReturnNULL "capsFeaturesNewAny" result
    result' <- (wrapBoxed CapsFeatures) result
    return result'

#if ENABLE_OVERLOADING
#endif

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

foreign import ccall "gst_caps_features_new_empty" gst_caps_features_new_empty ::
    IO (Ptr CapsFeatures)

{- |
Creates a new, empty 'GI.Gst.Structs.CapsFeatures.CapsFeatures'.

Free-function: gst_caps_features_free

/Since: 1.2/
-}
capsFeaturesNewEmpty ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m CapsFeatures
    {- ^ __Returns:__ a new, empty 'GI.Gst.Structs.CapsFeatures.CapsFeatures' -}
capsFeaturesNewEmpty  = liftIO $ do
    result <- gst_caps_features_new_empty
    checkUnexpectedReturnNULL "capsFeaturesNewEmpty" result
    result' <- (wrapBoxed CapsFeatures) result
    return result'

#if ENABLE_OVERLOADING
#endif

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

foreign import ccall "gst_caps_features_add" gst_caps_features_add ::
    Ptr CapsFeatures ->                     -- features : TInterface (Name {namespace = "Gst", name = "CapsFeatures"})
    CString ->                              -- feature : TBasicType TUTF8
    IO ()

{- |
Adds /@feature@/ to /@features@/.

/Since: 1.2/
-}
capsFeaturesAdd ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    CapsFeatures
    {- ^ /@features@/: a 'GI.Gst.Structs.CapsFeatures.CapsFeatures'. -}
    -> T.Text
    {- ^ /@feature@/: a feature. -}
    -> m ()
capsFeaturesAdd features feature = liftIO $ do
    features' <- unsafeManagedPtrGetPtr features
    feature' <- textToCString feature
    gst_caps_features_add features' feature'
    touchManagedPtr features
    freeMem feature'
    return ()

#if ENABLE_OVERLOADING
data CapsFeaturesAddMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m) => O.MethodInfo CapsFeaturesAddMethodInfo CapsFeatures signature where
    overloadedMethod _ = capsFeaturesAdd

#endif

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

foreign import ccall "gst_caps_features_add_id" gst_caps_features_add_id ::
    Ptr CapsFeatures ->                     -- features : TInterface (Name {namespace = "Gst", name = "CapsFeatures"})
    Word32 ->                               -- feature : TBasicType TUInt32
    IO ()

{- |
Adds /@feature@/ to /@features@/.

/Since: 1.2/
-}
capsFeaturesAddId ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    CapsFeatures
    {- ^ /@features@/: a 'GI.Gst.Structs.CapsFeatures.CapsFeatures'. -}
    -> Word32
    {- ^ /@feature@/: a feature. -}
    -> m ()
capsFeaturesAddId features feature = liftIO $ do
    features' <- unsafeManagedPtrGetPtr features
    gst_caps_features_add_id features' feature
    touchManagedPtr features
    return ()

#if ENABLE_OVERLOADING
data CapsFeaturesAddIdMethodInfo
instance (signature ~ (Word32 -> m ()), MonadIO m) => O.MethodInfo CapsFeaturesAddIdMethodInfo CapsFeatures signature where
    overloadedMethod _ = capsFeaturesAddId

#endif

-- method CapsFeatures::contains
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "features", argType = TInterface (Name {namespace = "Gst", name = "CapsFeatures"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstCapsFeatures.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "feature", argType = TBasicType TUTF8, 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 TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_caps_features_contains" gst_caps_features_contains ::
    Ptr CapsFeatures ->                     -- features : TInterface (Name {namespace = "Gst", name = "CapsFeatures"})
    CString ->                              -- feature : TBasicType TUTF8
    IO CInt

{- |
Check if /@features@/ contains /@feature@/.

/Since: 1.2/
-}
capsFeaturesContains ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    CapsFeatures
    {- ^ /@features@/: a 'GI.Gst.Structs.CapsFeatures.CapsFeatures'. -}
    -> T.Text
    {- ^ /@feature@/: a feature -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@features@/ contains /@feature@/. -}
capsFeaturesContains features feature = liftIO $ do
    features' <- unsafeManagedPtrGetPtr features
    feature' <- textToCString feature
    result <- gst_caps_features_contains features' feature'
    let result' = (/= 0) result
    touchManagedPtr features
    freeMem feature'
    return result'

#if ENABLE_OVERLOADING
data CapsFeaturesContainsMethodInfo
instance (signature ~ (T.Text -> m Bool), MonadIO m) => O.MethodInfo CapsFeaturesContainsMethodInfo CapsFeatures signature where
    overloadedMethod _ = capsFeaturesContains

#endif

-- method CapsFeatures::contains_id
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "features", argType = TInterface (Name {namespace = "Gst", name = "CapsFeatures"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstCapsFeatures.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "feature", argType = TBasicType TUInt32, 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 TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_caps_features_contains_id" gst_caps_features_contains_id ::
    Ptr CapsFeatures ->                     -- features : TInterface (Name {namespace = "Gst", name = "CapsFeatures"})
    Word32 ->                               -- feature : TBasicType TUInt32
    IO CInt

{- |
Check if /@features@/ contains /@feature@/.

/Since: 1.2/
-}
capsFeaturesContainsId ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    CapsFeatures
    {- ^ /@features@/: a 'GI.Gst.Structs.CapsFeatures.CapsFeatures'. -}
    -> Word32
    {- ^ /@feature@/: a feature -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@features@/ contains /@feature@/. -}
capsFeaturesContainsId features feature = liftIO $ do
    features' <- unsafeManagedPtrGetPtr features
    result <- gst_caps_features_contains_id features' feature
    let result' = (/= 0) result
    touchManagedPtr features
    return result'

#if ENABLE_OVERLOADING
data CapsFeaturesContainsIdMethodInfo
instance (signature ~ (Word32 -> m Bool), MonadIO m) => O.MethodInfo CapsFeaturesContainsIdMethodInfo CapsFeatures signature where
    overloadedMethod _ = capsFeaturesContainsId

#endif

-- method CapsFeatures::copy
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "features", argType = TInterface (Name {namespace = "Gst", name = "CapsFeatures"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstCapsFeatures to duplicate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "CapsFeatures"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_caps_features_copy" gst_caps_features_copy ::
    Ptr CapsFeatures ->                     -- features : TInterface (Name {namespace = "Gst", name = "CapsFeatures"})
    IO (Ptr CapsFeatures)

{- |
Duplicates a 'GI.Gst.Structs.CapsFeatures.CapsFeatures' and all its values.

Free-function: gst_caps_features_free

/Since: 1.2/
-}
capsFeaturesCopy ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    CapsFeatures
    {- ^ /@features@/: a 'GI.Gst.Structs.CapsFeatures.CapsFeatures' to duplicate -}
    -> m CapsFeatures
    {- ^ __Returns:__ a new 'GI.Gst.Structs.CapsFeatures.CapsFeatures'. -}
capsFeaturesCopy features = liftIO $ do
    features' <- unsafeManagedPtrGetPtr features
    result <- gst_caps_features_copy features'
    checkUnexpectedReturnNULL "capsFeaturesCopy" result
    result' <- (wrapBoxed CapsFeatures) result
    touchManagedPtr features
    return result'

#if ENABLE_OVERLOADING
data CapsFeaturesCopyMethodInfo
instance (signature ~ (m CapsFeatures), MonadIO m) => O.MethodInfo CapsFeaturesCopyMethodInfo CapsFeatures signature where
    overloadedMethod _ = capsFeaturesCopy

#endif

-- method CapsFeatures::free
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "features", argType = TInterface (Name {namespace = "Gst", name = "CapsFeatures"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstCapsFeatures to free", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_caps_features_free" gst_caps_features_free ::
    Ptr CapsFeatures ->                     -- features : TInterface (Name {namespace = "Gst", name = "CapsFeatures"})
    IO ()

{- |
Frees a 'GI.Gst.Structs.CapsFeatures.CapsFeatures' and all its values. The caps features must not
have a parent when this function is called.

/Since: 1.2/
-}
capsFeaturesFree ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    CapsFeatures
    {- ^ /@features@/: the 'GI.Gst.Structs.CapsFeatures.CapsFeatures' to free -}
    -> m ()
capsFeaturesFree features = liftIO $ do
    features' <- B.ManagedPtr.disownBoxed features
    gst_caps_features_free features'
    touchManagedPtr features
    return ()

#if ENABLE_OVERLOADING
data CapsFeaturesFreeMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo CapsFeaturesFreeMethodInfo CapsFeatures signature where
    overloadedMethod _ = capsFeaturesFree

#endif

-- method CapsFeatures::get_nth
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "features", argType = TInterface (Name {namespace = "Gst", name = "CapsFeatures"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstCapsFeatures.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "i", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "index of the 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_caps_features_get_nth" gst_caps_features_get_nth ::
    Ptr CapsFeatures ->                     -- features : TInterface (Name {namespace = "Gst", name = "CapsFeatures"})
    Word32 ->                               -- i : TBasicType TUInt
    IO CString

{- |
Returns the /@i@/-th feature of /@features@/.

/Since: 1.2/
-}
capsFeaturesGetNth ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    CapsFeatures
    {- ^ /@features@/: a 'GI.Gst.Structs.CapsFeatures.CapsFeatures'. -}
    -> Word32
    {- ^ /@i@/: index of the feature -}
    -> m (Maybe T.Text)
    {- ^ __Returns:__ The /@i@/-th feature of /@features@/. -}
capsFeaturesGetNth features i = liftIO $ do
    features' <- unsafeManagedPtrGetPtr features
    result <- gst_caps_features_get_nth features' i
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- cstringToText result'
        return result''
    touchManagedPtr features
    return maybeResult

#if ENABLE_OVERLOADING
data CapsFeaturesGetNthMethodInfo
instance (signature ~ (Word32 -> m (Maybe T.Text)), MonadIO m) => O.MethodInfo CapsFeaturesGetNthMethodInfo CapsFeatures signature where
    overloadedMethod _ = capsFeaturesGetNth

#endif

-- method CapsFeatures::get_nth_id
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "features", argType = TInterface (Name {namespace = "Gst", name = "CapsFeatures"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstCapsFeatures.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "i", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "index of the feature", 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_caps_features_get_nth_id" gst_caps_features_get_nth_id ::
    Ptr CapsFeatures ->                     -- features : TInterface (Name {namespace = "Gst", name = "CapsFeatures"})
    Word32 ->                               -- i : TBasicType TUInt
    IO Word32

{- |
Returns the /@i@/-th feature of /@features@/.

/Since: 1.2/
-}
capsFeaturesGetNthId ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    CapsFeatures
    {- ^ /@features@/: a 'GI.Gst.Structs.CapsFeatures.CapsFeatures'. -}
    -> Word32
    {- ^ /@i@/: index of the feature -}
    -> m Word32
    {- ^ __Returns:__ The /@i@/-th feature of /@features@/. -}
capsFeaturesGetNthId features i = liftIO $ do
    features' <- unsafeManagedPtrGetPtr features
    result <- gst_caps_features_get_nth_id features' i
    touchManagedPtr features
    return result

#if ENABLE_OVERLOADING
data CapsFeaturesGetNthIdMethodInfo
instance (signature ~ (Word32 -> m Word32), MonadIO m) => O.MethodInfo CapsFeaturesGetNthIdMethodInfo CapsFeatures signature where
    overloadedMethod _ = capsFeaturesGetNthId

#endif

-- method CapsFeatures::get_size
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "features", argType = TInterface (Name {namespace = "Gst", name = "CapsFeatures"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstCapsFeatures.", 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_caps_features_get_size" gst_caps_features_get_size ::
    Ptr CapsFeatures ->                     -- features : TInterface (Name {namespace = "Gst", name = "CapsFeatures"})
    IO Word32

{- |
Returns the number of features in /@features@/.

/Since: 1.2/
-}
capsFeaturesGetSize ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    CapsFeatures
    {- ^ /@features@/: a 'GI.Gst.Structs.CapsFeatures.CapsFeatures'. -}
    -> m Word32
    {- ^ __Returns:__ The number of features in /@features@/. -}
capsFeaturesGetSize features = liftIO $ do
    features' <- unsafeManagedPtrGetPtr features
    result <- gst_caps_features_get_size features'
    touchManagedPtr features
    return result

#if ENABLE_OVERLOADING
data CapsFeaturesGetSizeMethodInfo
instance (signature ~ (m Word32), MonadIO m) => O.MethodInfo CapsFeaturesGetSizeMethodInfo CapsFeatures signature where
    overloadedMethod _ = capsFeaturesGetSize

#endif

-- method CapsFeatures::is_any
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "features", argType = TInterface (Name {namespace = "Gst", name = "CapsFeatures"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstCapsFeatures.", 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_caps_features_is_any" gst_caps_features_is_any ::
    Ptr CapsFeatures ->                     -- features : TInterface (Name {namespace = "Gst", name = "CapsFeatures"})
    IO CInt

{- |
Check if /@features@/ is @/GST_CAPS_FEATURES_ANY/@.

/Since: 1.2/
-}
capsFeaturesIsAny ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    CapsFeatures
    {- ^ /@features@/: a 'GI.Gst.Structs.CapsFeatures.CapsFeatures'. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@features@/ is @/GST_CAPS_FEATURES_ANY/@. -}
capsFeaturesIsAny features = liftIO $ do
    features' <- unsafeManagedPtrGetPtr features
    result <- gst_caps_features_is_any features'
    let result' = (/= 0) result
    touchManagedPtr features
    return result'

#if ENABLE_OVERLOADING
data CapsFeaturesIsAnyMethodInfo
instance (signature ~ (m Bool), MonadIO m) => O.MethodInfo CapsFeaturesIsAnyMethodInfo CapsFeatures signature where
    overloadedMethod _ = capsFeaturesIsAny

#endif

-- method CapsFeatures::is_equal
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "features1", argType = TInterface (Name {namespace = "Gst", name = "CapsFeatures"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstCapsFeatures.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "features2", argType = TInterface (Name {namespace = "Gst", name = "CapsFeatures"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstCapsFeatures.", 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_caps_features_is_equal" gst_caps_features_is_equal ::
    Ptr CapsFeatures ->                     -- features1 : TInterface (Name {namespace = "Gst", name = "CapsFeatures"})
    Ptr CapsFeatures ->                     -- features2 : TInterface (Name {namespace = "Gst", name = "CapsFeatures"})
    IO CInt

{- |
Check if /@features1@/ and /@features2@/ are equal.

/Since: 1.2/
-}
capsFeaturesIsEqual ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    CapsFeatures
    {- ^ /@features1@/: a 'GI.Gst.Structs.CapsFeatures.CapsFeatures'. -}
    -> CapsFeatures
    {- ^ /@features2@/: a 'GI.Gst.Structs.CapsFeatures.CapsFeatures'. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@features1@/ and /@features2@/ are equal. -}
capsFeaturesIsEqual features1 features2 = liftIO $ do
    features1' <- unsafeManagedPtrGetPtr features1
    features2' <- unsafeManagedPtrGetPtr features2
    result <- gst_caps_features_is_equal features1' features2'
    let result' = (/= 0) result
    touchManagedPtr features1
    touchManagedPtr features2
    return result'

#if ENABLE_OVERLOADING
data CapsFeaturesIsEqualMethodInfo
instance (signature ~ (CapsFeatures -> m Bool), MonadIO m) => O.MethodInfo CapsFeaturesIsEqualMethodInfo CapsFeatures signature where
    overloadedMethod _ = capsFeaturesIsEqual

#endif

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

foreign import ccall "gst_caps_features_remove" gst_caps_features_remove ::
    Ptr CapsFeatures ->                     -- features : TInterface (Name {namespace = "Gst", name = "CapsFeatures"})
    CString ->                              -- feature : TBasicType TUTF8
    IO ()

{- |
Removes /@feature@/ from /@features@/.

/Since: 1.2/
-}
capsFeaturesRemove ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    CapsFeatures
    {- ^ /@features@/: a 'GI.Gst.Structs.CapsFeatures.CapsFeatures'. -}
    -> T.Text
    {- ^ /@feature@/: a feature. -}
    -> m ()
capsFeaturesRemove features feature = liftIO $ do
    features' <- unsafeManagedPtrGetPtr features
    feature' <- textToCString feature
    gst_caps_features_remove features' feature'
    touchManagedPtr features
    freeMem feature'
    return ()

#if ENABLE_OVERLOADING
data CapsFeaturesRemoveMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m) => O.MethodInfo CapsFeaturesRemoveMethodInfo CapsFeatures signature where
    overloadedMethod _ = capsFeaturesRemove

#endif

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

foreign import ccall "gst_caps_features_remove_id" gst_caps_features_remove_id ::
    Ptr CapsFeatures ->                     -- features : TInterface (Name {namespace = "Gst", name = "CapsFeatures"})
    Word32 ->                               -- feature : TBasicType TUInt32
    IO ()

{- |
Removes /@feature@/ from /@features@/.

/Since: 1.2/
-}
capsFeaturesRemoveId ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    CapsFeatures
    {- ^ /@features@/: a 'GI.Gst.Structs.CapsFeatures.CapsFeatures'. -}
    -> Word32
    {- ^ /@feature@/: a feature. -}
    -> m ()
capsFeaturesRemoveId features feature = liftIO $ do
    features' <- unsafeManagedPtrGetPtr features
    gst_caps_features_remove_id features' feature
    touchManagedPtr features
    return ()

#if ENABLE_OVERLOADING
data CapsFeaturesRemoveIdMethodInfo
instance (signature ~ (Word32 -> m ()), MonadIO m) => O.MethodInfo CapsFeaturesRemoveIdMethodInfo CapsFeatures signature where
    overloadedMethod _ = capsFeaturesRemoveId

#endif

-- method CapsFeatures::set_parent_refcount
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "features", argType = TInterface (Name {namespace = "Gst", name = "CapsFeatures"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstCapsFeatures", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "refcount", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pointer to the parent's refcount", 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_caps_features_set_parent_refcount" gst_caps_features_set_parent_refcount ::
    Ptr CapsFeatures ->                     -- features : TInterface (Name {namespace = "Gst", name = "CapsFeatures"})
    Int32 ->                                -- refcount : TBasicType TInt
    IO CInt

{- |
Sets the parent_refcount field of 'GI.Gst.Structs.CapsFeatures.CapsFeatures'. This field is used to
determine whether a caps features is mutable or not. This function should only be
called by code implementing parent objects of 'GI.Gst.Structs.CapsFeatures.CapsFeatures', as described in
the MT Refcounting section of the design documents.

/Since: 1.2/
-}
capsFeaturesSetParentRefcount ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    CapsFeatures
    {- ^ /@features@/: a 'GI.Gst.Structs.CapsFeatures.CapsFeatures' -}
    -> Int32
    {- ^ /@refcount@/: a pointer to the parent\'s refcount -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the parent refcount could be set. -}
capsFeaturesSetParentRefcount features refcount = liftIO $ do
    features' <- unsafeManagedPtrGetPtr features
    result <- gst_caps_features_set_parent_refcount features' refcount
    let result' = (/= 0) result
    touchManagedPtr features
    return result'

#if ENABLE_OVERLOADING
data CapsFeaturesSetParentRefcountMethodInfo
instance (signature ~ (Int32 -> m Bool), MonadIO m) => O.MethodInfo CapsFeaturesSetParentRefcountMethodInfo CapsFeatures signature where
    overloadedMethod _ = capsFeaturesSetParentRefcount

#endif

-- method CapsFeatures::to_string
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "features", argType = TInterface (Name {namespace = "Gst", name = "CapsFeatures"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstCapsFeatures", 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_caps_features_to_string" gst_caps_features_to_string ::
    Ptr CapsFeatures ->                     -- features : TInterface (Name {namespace = "Gst", name = "CapsFeatures"})
    IO CString

{- |
Converts /@features@/ to a human-readable string representation.

For debugging purposes its easier to do something like this:

=== /C code/
>
>GST_LOG ("features is %" GST_PTR_FORMAT, features);

This prints the features in human readable form.

Free-function: g_free

/Since: 1.2/
-}
capsFeaturesToString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    CapsFeatures
    {- ^ /@features@/: a 'GI.Gst.Structs.CapsFeatures.CapsFeatures' -}
    -> m T.Text
    {- ^ __Returns:__ a pointer to string allocated by 'GI.GLib.Functions.malloc'.
    'GI.GLib.Functions.free' after usage. -}
capsFeaturesToString features = liftIO $ do
    features' <- unsafeManagedPtrGetPtr features
    result <- gst_caps_features_to_string features'
    checkUnexpectedReturnNULL "capsFeaturesToString" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr features
    return result'

#if ENABLE_OVERLOADING
data CapsFeaturesToStringMethodInfo
instance (signature ~ (m T.Text), MonadIO m) => O.MethodInfo CapsFeaturesToStringMethodInfo CapsFeatures signature where
    overloadedMethod _ = capsFeaturesToString

#endif

-- method CapsFeatures::from_string
-- method type : MemberFunction
-- Args : [Arg {argCName = "features", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a string representation of a #GstCapsFeatures.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "CapsFeatures"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_caps_features_from_string" gst_caps_features_from_string ::
    CString ->                              -- features : TBasicType TUTF8
    IO (Ptr CapsFeatures)

{- |
Creates a 'GI.Gst.Structs.CapsFeatures.CapsFeatures' from a string representation.

Free-function: gst_caps_features_free

/Since: 1.2/
-}
capsFeaturesFromString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@features@/: a string representation of a 'GI.Gst.Structs.CapsFeatures.CapsFeatures'. -}
    -> m (Maybe CapsFeatures)
    {- ^ __Returns:__ a new 'GI.Gst.Structs.CapsFeatures.CapsFeatures' or
    'Nothing' when the string could not be parsed. Free with
    'GI.Gst.Structs.CapsFeatures.capsFeaturesFree' after use. -}
capsFeaturesFromString features = liftIO $ do
    features' <- textToCString features
    result <- gst_caps_features_from_string features'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapBoxed CapsFeatures) result'
        return result''
    freeMem features'
    return maybeResult

#if ENABLE_OVERLOADING
#endif

#if ENABLE_OVERLOADING
type family ResolveCapsFeaturesMethod (t :: Symbol) (o :: *) :: * where
    ResolveCapsFeaturesMethod "add" o = CapsFeaturesAddMethodInfo
    ResolveCapsFeaturesMethod "addId" o = CapsFeaturesAddIdMethodInfo
    ResolveCapsFeaturesMethod "contains" o = CapsFeaturesContainsMethodInfo
    ResolveCapsFeaturesMethod "containsId" o = CapsFeaturesContainsIdMethodInfo
    ResolveCapsFeaturesMethod "copy" o = CapsFeaturesCopyMethodInfo
    ResolveCapsFeaturesMethod "free" o = CapsFeaturesFreeMethodInfo
    ResolveCapsFeaturesMethod "isAny" o = CapsFeaturesIsAnyMethodInfo
    ResolveCapsFeaturesMethod "isEqual" o = CapsFeaturesIsEqualMethodInfo
    ResolveCapsFeaturesMethod "remove" o = CapsFeaturesRemoveMethodInfo
    ResolveCapsFeaturesMethod "removeId" o = CapsFeaturesRemoveIdMethodInfo
    ResolveCapsFeaturesMethod "toString" o = CapsFeaturesToStringMethodInfo
    ResolveCapsFeaturesMethod "getNth" o = CapsFeaturesGetNthMethodInfo
    ResolveCapsFeaturesMethod "getNthId" o = CapsFeaturesGetNthIdMethodInfo
    ResolveCapsFeaturesMethod "getSize" o = CapsFeaturesGetSizeMethodInfo
    ResolveCapsFeaturesMethod "setParentRefcount" o = CapsFeaturesSetParentRefcountMethodInfo
    ResolveCapsFeaturesMethod l o = O.MethodResolutionFailed l o

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