{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- Datastructure to initialize t'GI.Gst.Structs.Caps.Caps' from a string description usually
-- used in conjunction with @/GST_STATIC_CAPS()/@ and 'GI.Gst.Structs.StaticCaps.staticCapsGet' to
-- instantiate a t'GI.Gst.Structs.Caps.Caps'.

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

module GI.Gst.Structs.StaticCaps
    ( 

-- * Exported types
    StaticCaps(..)                          ,
    newZeroStaticCaps                       ,


 -- * Methods
-- ** Overloaded methods #method:Overloaded methods#

#if defined(ENABLE_OVERLOADING)
    ResolveStaticCapsMethod                 ,
#endif


-- ** cleanup #method:cleanup#

#if defined(ENABLE_OVERLOADING)
    StaticCapsCleanupMethodInfo             ,
#endif
    staticCapsCleanup                       ,


-- ** get #method:get#

#if defined(ENABLE_OVERLOADING)
    StaticCapsGetMethodInfo                 ,
#endif
    staticCapsGet                           ,




 -- * Properties
-- ** caps #attr:caps#
-- | the cached t'GI.Gst.Structs.Caps.Caps'

    clearStaticCapsCaps                     ,
    getStaticCapsCaps                       ,
    setStaticCapsCaps                       ,
#if defined(ENABLE_OVERLOADING)
    staticCaps_caps                         ,
#endif


-- ** string #attr:string#
-- | a string describing a caps

    clearStaticCapsString                   ,
    getStaticCapsString                     ,
    setStaticCapsString                     ,
#if defined(ENABLE_OVERLOADING)
    staticCaps_string                       ,
#endif




    ) 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.BasicTypes as B.Types
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.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
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 {-# SOURCE #-} qualified GI.Gst.Structs.Caps as Gst.Caps

-- | Memory-managed wrapper type.
newtype StaticCaps = StaticCaps (SP.ManagedPtr StaticCaps)
    deriving (StaticCaps -> StaticCaps -> Bool
(StaticCaps -> StaticCaps -> Bool)
-> (StaticCaps -> StaticCaps -> Bool) -> Eq StaticCaps
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StaticCaps -> StaticCaps -> Bool
$c/= :: StaticCaps -> StaticCaps -> Bool
== :: StaticCaps -> StaticCaps -> Bool
$c== :: StaticCaps -> StaticCaps -> Bool
Eq)

instance SP.ManagedPtrNewtype StaticCaps where
    toManagedPtr :: StaticCaps -> ManagedPtr StaticCaps
toManagedPtr (StaticCaps ManagedPtr StaticCaps
p) = ManagedPtr StaticCaps
p

instance BoxedPtr StaticCaps where
    boxedPtrCopy :: StaticCaps -> IO StaticCaps
boxedPtrCopy = \StaticCaps
p -> StaticCaps -> (Ptr StaticCaps -> IO StaticCaps) -> IO StaticCaps
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr StaticCaps
p (Int -> Ptr StaticCaps -> IO (Ptr StaticCaps)
forall a. (HasCallStack, CallocPtr a) => Int -> Ptr a -> IO (Ptr a)
copyBytes Int
48 (Ptr StaticCaps -> IO (Ptr StaticCaps))
-> (Ptr StaticCaps -> IO StaticCaps)
-> Ptr StaticCaps
-> IO StaticCaps
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> (ManagedPtr StaticCaps -> StaticCaps)
-> Ptr StaticCaps -> IO StaticCaps
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.wrapPtr ManagedPtr StaticCaps -> StaticCaps
StaticCaps)
    boxedPtrFree :: StaticCaps -> IO ()
boxedPtrFree = \StaticCaps
x -> StaticCaps -> (Ptr StaticCaps -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
SP.withManagedPtr StaticCaps
x Ptr StaticCaps -> IO ()
forall a. Ptr a -> IO ()
SP.freeMem
instance CallocPtr StaticCaps where
    boxedPtrCalloc :: IO (Ptr StaticCaps)
boxedPtrCalloc = Int -> IO (Ptr StaticCaps)
forall a. Int -> IO (Ptr a)
callocBytes Int
48


-- | Construct a `StaticCaps` struct initialized to zero.
newZeroStaticCaps :: MonadIO m => m StaticCaps
newZeroStaticCaps :: m StaticCaps
newZeroStaticCaps = IO StaticCaps -> m StaticCaps
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO StaticCaps -> m StaticCaps) -> IO StaticCaps -> m StaticCaps
forall a b. (a -> b) -> a -> b
$ IO (Ptr StaticCaps)
forall a. CallocPtr a => IO (Ptr a)
boxedPtrCalloc IO (Ptr StaticCaps)
-> (Ptr StaticCaps -> IO StaticCaps) -> IO StaticCaps
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ManagedPtr StaticCaps -> StaticCaps)
-> Ptr StaticCaps -> IO StaticCaps
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr StaticCaps -> StaticCaps
StaticCaps

instance tag ~ 'AttrSet => Constructible StaticCaps tag where
    new :: (ManagedPtr StaticCaps -> StaticCaps)
-> [AttrOp StaticCaps tag] -> m StaticCaps
new ManagedPtr StaticCaps -> StaticCaps
_ [AttrOp StaticCaps tag]
attrs = do
        StaticCaps
o <- m StaticCaps
forall (m :: * -> *). MonadIO m => m StaticCaps
newZeroStaticCaps
        StaticCaps -> [AttrOp StaticCaps 'AttrSet] -> m ()
forall o (m :: * -> *).
MonadIO m =>
o -> [AttrOp o 'AttrSet] -> m ()
GI.Attributes.set StaticCaps
o [AttrOp StaticCaps tag]
[AttrOp StaticCaps 'AttrSet]
attrs
        StaticCaps -> m StaticCaps
forall (m :: * -> *) a. Monad m => a -> m a
return StaticCaps
o


-- | Get the value of the “@caps@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' staticCaps #caps
-- @
getStaticCapsCaps :: MonadIO m => StaticCaps -> m (Maybe Gst.Caps.Caps)
getStaticCapsCaps :: StaticCaps -> m (Maybe Caps)
getStaticCapsCaps StaticCaps
s = IO (Maybe Caps) -> m (Maybe Caps)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Caps) -> m (Maybe Caps))
-> IO (Maybe Caps) -> m (Maybe Caps)
forall a b. (a -> b) -> a -> b
$ StaticCaps
-> (Ptr StaticCaps -> IO (Maybe Caps)) -> IO (Maybe Caps)
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr StaticCaps
s ((Ptr StaticCaps -> IO (Maybe Caps)) -> IO (Maybe Caps))
-> (Ptr StaticCaps -> IO (Maybe Caps)) -> IO (Maybe Caps)
forall a b. (a -> b) -> a -> b
$ \Ptr StaticCaps
ptr -> do
    Ptr Caps
val <- Ptr (Ptr Caps) -> IO (Ptr Caps)
forall a. Storable a => Ptr a -> IO a
peek (Ptr StaticCaps
ptr Ptr StaticCaps -> Int -> Ptr (Ptr Caps)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) :: IO (Ptr Gst.Caps.Caps)
    Maybe Caps
result <- Ptr Caps -> (Ptr Caps -> IO Caps) -> IO (Maybe Caps)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
SP.convertIfNonNull Ptr Caps
val ((Ptr Caps -> IO Caps) -> IO (Maybe Caps))
-> (Ptr Caps -> IO Caps) -> IO (Maybe Caps)
forall a b. (a -> b) -> a -> b
$ \Ptr Caps
val' -> do
        Caps
val'' <- ((ManagedPtr Caps -> Caps) -> Ptr Caps -> IO Caps
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr Caps -> Caps
Gst.Caps.Caps) Ptr Caps
val'
        Caps -> IO Caps
forall (m :: * -> *) a. Monad m => a -> m a
return Caps
val''
    Maybe Caps -> IO (Maybe Caps)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Caps
result

-- | Set the value of the “@caps@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' staticCaps [ #caps 'Data.GI.Base.Attributes.:=' value ]
-- @
setStaticCapsCaps :: MonadIO m => StaticCaps -> Ptr Gst.Caps.Caps -> m ()
setStaticCapsCaps :: StaticCaps -> Ptr Caps -> m ()
setStaticCapsCaps StaticCaps
s Ptr Caps
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ StaticCaps -> (Ptr StaticCaps -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr StaticCaps
s ((Ptr StaticCaps -> IO ()) -> IO ())
-> (Ptr StaticCaps -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr StaticCaps
ptr -> do
    Ptr (Ptr Caps) -> Ptr Caps -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr StaticCaps
ptr Ptr StaticCaps -> Int -> Ptr (Ptr Caps)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) (Ptr Caps
val :: Ptr Gst.Caps.Caps)

-- | Set the value of the “@caps@” field to `Nothing`.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.clear' #caps
-- @
clearStaticCapsCaps :: MonadIO m => StaticCaps -> m ()
clearStaticCapsCaps :: StaticCaps -> m ()
clearStaticCapsCaps StaticCaps
s = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ StaticCaps -> (Ptr StaticCaps -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr StaticCaps
s ((Ptr StaticCaps -> IO ()) -> IO ())
-> (Ptr StaticCaps -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr StaticCaps
ptr -> do
    Ptr (Ptr Caps) -> Ptr Caps -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr StaticCaps
ptr Ptr StaticCaps -> Int -> Ptr (Ptr Caps)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) (Ptr Caps
forall a. Ptr a
FP.nullPtr :: Ptr Gst.Caps.Caps)

#if defined(ENABLE_OVERLOADING)
data StaticCapsCapsFieldInfo
instance AttrInfo StaticCapsCapsFieldInfo where
    type AttrBaseTypeConstraint StaticCapsCapsFieldInfo = (~) StaticCaps
    type AttrAllowedOps StaticCapsCapsFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint StaticCapsCapsFieldInfo = (~) (Ptr Gst.Caps.Caps)
    type AttrTransferTypeConstraint StaticCapsCapsFieldInfo = (~)(Ptr Gst.Caps.Caps)
    type AttrTransferType StaticCapsCapsFieldInfo = (Ptr Gst.Caps.Caps)
    type AttrGetType StaticCapsCapsFieldInfo = Maybe Gst.Caps.Caps
    type AttrLabel StaticCapsCapsFieldInfo = "caps"
    type AttrOrigin StaticCapsCapsFieldInfo = StaticCaps
    attrGet = getStaticCapsCaps
    attrSet = setStaticCapsCaps
    attrConstruct = undefined
    attrClear = clearStaticCapsCaps
    attrTransfer _ v = do
        return v

staticCaps_caps :: AttrLabelProxy "caps"
staticCaps_caps = AttrLabelProxy

#endif


-- | Get the value of the “@string@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' staticCaps #string
-- @
getStaticCapsString :: MonadIO m => StaticCaps -> m (Maybe T.Text)
getStaticCapsString :: StaticCaps -> m (Maybe Text)
getStaticCapsString StaticCaps
s = IO (Maybe Text) -> m (Maybe Text)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ StaticCaps
-> (Ptr StaticCaps -> IO (Maybe Text)) -> IO (Maybe Text)
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr StaticCaps
s ((Ptr StaticCaps -> IO (Maybe Text)) -> IO (Maybe Text))
-> (Ptr StaticCaps -> IO (Maybe Text)) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \Ptr StaticCaps
ptr -> do
    CString
val <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek (Ptr StaticCaps
ptr Ptr StaticCaps -> Int -> Ptr CString
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8) :: IO CString
    Maybe Text
result <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
SP.convertIfNonNull CString
val ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
val' -> do
        Text
val'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
val'
        Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
val''
    Maybe Text -> IO (Maybe Text)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
result

-- | Set the value of the “@string@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' staticCaps [ #string 'Data.GI.Base.Attributes.:=' value ]
-- @
setStaticCapsString :: MonadIO m => StaticCaps -> CString -> m ()
setStaticCapsString :: StaticCaps -> CString -> m ()
setStaticCapsString StaticCaps
s CString
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ StaticCaps -> (Ptr StaticCaps -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr StaticCaps
s ((Ptr StaticCaps -> IO ()) -> IO ())
-> (Ptr StaticCaps -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr StaticCaps
ptr -> do
    Ptr CString -> CString -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr StaticCaps
ptr Ptr StaticCaps -> Int -> Ptr CString
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8) (CString
val :: CString)

-- | Set the value of the “@string@” field to `Nothing`.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.clear' #string
-- @
clearStaticCapsString :: MonadIO m => StaticCaps -> m ()
clearStaticCapsString :: StaticCaps -> m ()
clearStaticCapsString StaticCaps
s = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ StaticCaps -> (Ptr StaticCaps -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr StaticCaps
s ((Ptr StaticCaps -> IO ()) -> IO ())
-> (Ptr StaticCaps -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr StaticCaps
ptr -> do
    Ptr CString -> CString -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr StaticCaps
ptr Ptr StaticCaps -> Int -> Ptr CString
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8) (CString
forall a. Ptr a
FP.nullPtr :: CString)

#if defined(ENABLE_OVERLOADING)
data StaticCapsStringFieldInfo
instance AttrInfo StaticCapsStringFieldInfo where
    type AttrBaseTypeConstraint StaticCapsStringFieldInfo = (~) StaticCaps
    type AttrAllowedOps StaticCapsStringFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint StaticCapsStringFieldInfo = (~) CString
    type AttrTransferTypeConstraint StaticCapsStringFieldInfo = (~)CString
    type AttrTransferType StaticCapsStringFieldInfo = CString
    type AttrGetType StaticCapsStringFieldInfo = Maybe T.Text
    type AttrLabel StaticCapsStringFieldInfo = "string"
    type AttrOrigin StaticCapsStringFieldInfo = StaticCaps
    attrGet = getStaticCapsString
    attrSet = setStaticCapsString
    attrConstruct = undefined
    attrClear = clearStaticCapsString
    attrTransfer _ v = do
        return v

staticCaps_string :: AttrLabelProxy "string"
staticCaps_string = AttrLabelProxy

#endif



#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList StaticCaps
type instance O.AttributeList StaticCaps = StaticCapsAttributeList
type StaticCapsAttributeList = ('[ '("caps", StaticCapsCapsFieldInfo), '("string", StaticCapsStringFieldInfo)] :: [(Symbol, *)])
#endif

-- method StaticCaps::cleanup
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "static_caps"
--           , argType =
--               TInterface Name { namespace = "Gst" , name = "StaticCaps" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the #GstStaticCaps to clean"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_static_caps_cleanup" gst_static_caps_cleanup :: 
    Ptr StaticCaps ->                       -- static_caps : TInterface (Name {namespace = "Gst", name = "StaticCaps"})
    IO ()

-- | Clean up the cached caps contained in /@staticCaps@/.
staticCapsCleanup ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    StaticCaps
    -- ^ /@staticCaps@/: the t'GI.Gst.Structs.StaticCaps.StaticCaps' to clean
    -> m ()
staticCapsCleanup :: StaticCaps -> m ()
staticCapsCleanup StaticCaps
staticCaps = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr StaticCaps
staticCaps' <- StaticCaps -> IO (Ptr StaticCaps)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr StaticCaps
staticCaps
    Ptr StaticCaps -> IO ()
gst_static_caps_cleanup Ptr StaticCaps
staticCaps'
    StaticCaps -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr StaticCaps
staticCaps
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data StaticCapsCleanupMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo StaticCapsCleanupMethodInfo StaticCaps signature where
    overloadedMethod = staticCapsCleanup

#endif

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

foreign import ccall "gst_static_caps_get" gst_static_caps_get :: 
    Ptr StaticCaps ->                       -- static_caps : TInterface (Name {namespace = "Gst", name = "StaticCaps"})
    IO (Ptr Gst.Caps.Caps)

-- | Converts a t'GI.Gst.Structs.StaticCaps.StaticCaps' to a t'GI.Gst.Structs.Caps.Caps'.
staticCapsGet ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    StaticCaps
    -- ^ /@staticCaps@/: the t'GI.Gst.Structs.StaticCaps.StaticCaps' to convert
    -> m (Maybe Gst.Caps.Caps)
    -- ^ __Returns:__ a pointer to the t'GI.Gst.Structs.Caps.Caps'. Unref
    --     after usage. Since the core holds an additional ref to the
    --     returned caps, use @/gst_caps_make_writable()/@ on the returned caps
    --     to modify it.
staticCapsGet :: StaticCaps -> m (Maybe Caps)
staticCapsGet StaticCaps
staticCaps = IO (Maybe Caps) -> m (Maybe Caps)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Caps) -> m (Maybe Caps))
-> IO (Maybe Caps) -> m (Maybe Caps)
forall a b. (a -> b) -> a -> b
$ do
    Ptr StaticCaps
staticCaps' <- StaticCaps -> IO (Ptr StaticCaps)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr StaticCaps
staticCaps
    Ptr Caps
result <- Ptr StaticCaps -> IO (Ptr Caps)
gst_static_caps_get Ptr StaticCaps
staticCaps'
    Maybe Caps
maybeResult <- Ptr Caps -> (Ptr Caps -> IO Caps) -> IO (Maybe Caps)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr Caps
result ((Ptr Caps -> IO Caps) -> IO (Maybe Caps))
-> (Ptr Caps -> IO Caps) -> IO (Maybe Caps)
forall a b. (a -> b) -> a -> b
$ \Ptr Caps
result' -> do
        Caps
result'' <- ((ManagedPtr Caps -> Caps) -> Ptr Caps -> IO Caps
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Caps -> Caps
Gst.Caps.Caps) Ptr Caps
result'
        Caps -> IO Caps
forall (m :: * -> *) a. Monad m => a -> m a
return Caps
result''
    StaticCaps -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr StaticCaps
staticCaps
    Maybe Caps -> IO (Maybe Caps)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Caps
maybeResult

#if defined(ENABLE_OVERLOADING)
data StaticCapsGetMethodInfo
instance (signature ~ (m (Maybe Gst.Caps.Caps)), MonadIO m) => O.MethodInfo StaticCapsGetMethodInfo StaticCaps signature where
    overloadedMethod = staticCapsGet

#endif

#if defined(ENABLE_OVERLOADING)
type family ResolveStaticCapsMethod (t :: Symbol) (o :: *) :: * where
    ResolveStaticCapsMethod "cleanup" o = StaticCapsCleanupMethodInfo
    ResolveStaticCapsMethod "get" o = StaticCapsGetMethodInfo
    ResolveStaticCapsMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveStaticCapsMethod t StaticCaps, O.MethodInfo info StaticCaps p) => OL.IsLabel t (StaticCaps -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod @info
#else
    fromLabel _ = O.overloadedMethod @info
#endif

#endif