gi-gst-0.1.6.13: GI/Gst/Structs/AllocationParams.hs
{- |
Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)
Parameters to control the allocation of memory
-}
module GI.Gst.Structs.AllocationParams
(
-- * Exported types
AllocationParams(..) ,
newZeroAllocationParams ,
noAllocationParams ,
-- * Methods
-- ** allocationParamsCopy
AllocationParamsCopyMethodInfo ,
allocationParamsCopy ,
-- ** allocationParamsFree
AllocationParamsFreeMethodInfo ,
allocationParamsFree ,
-- ** allocationParamsInit
AllocationParamsInitMethodInfo ,
allocationParamsInit ,
-- * Properties
-- ** Align
allocationParamsReadAlign ,
-- ** Flags
allocationParamsReadFlags ,
-- ** Padding
allocationParamsReadPadding ,
-- ** Prefix
allocationParamsReadPrefix ,
) where
import Prelude ()
import Data.GI.Base.ShortPrelude
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import GI.Gst.Types
import GI.Gst.Callbacks
newtype AllocationParams = AllocationParams (ForeignPtr AllocationParams)
foreign import ccall "gst_allocation_params_get_type" c_gst_allocation_params_get_type ::
IO GType
instance BoxedObject AllocationParams where
boxedType _ = c_gst_allocation_params_get_type
-- | Construct a `AllocationParams` struct initialized to zero.
newZeroAllocationParams :: MonadIO m => m AllocationParams
newZeroAllocationParams = liftIO $ callocBoxedBytes 64 >>= wrapBoxed AllocationParams
noAllocationParams :: Maybe AllocationParams
noAllocationParams = Nothing
allocationParamsReadFlags :: AllocationParams -> IO [MemoryFlags]
allocationParamsReadFlags s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 0) :: IO CUInt
let val' = wordToGFlags val
return val'
allocationParamsReadAlign :: AllocationParams -> IO Word64
allocationParamsReadAlign s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 8) :: IO Word64
return val
allocationParamsReadPrefix :: AllocationParams -> IO Word64
allocationParamsReadPrefix s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 16) :: IO Word64
return val
allocationParamsReadPadding :: AllocationParams -> IO Word64
allocationParamsReadPadding s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 24) :: IO Word64
return val
-- method AllocationParams::copy
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "_obj", argType = TInterface "Gst" "AllocationParams", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : TInterface "Gst" "AllocationParams"
-- throws : False
-- Skip return : False
foreign import ccall "gst_allocation_params_copy" gst_allocation_params_copy ::
Ptr AllocationParams -> -- _obj : TInterface "Gst" "AllocationParams"
IO (Ptr AllocationParams)
allocationParamsCopy ::
(MonadIO m) =>
AllocationParams -- _obj
-> m AllocationParams -- result
allocationParamsCopy _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
result <- gst_allocation_params_copy _obj'
checkUnexpectedReturnNULL "gst_allocation_params_copy" result
result' <- (wrapBoxed AllocationParams) result
touchManagedPtr _obj
return result'
data AllocationParamsCopyMethodInfo
instance (signature ~ (m AllocationParams), MonadIO m) => MethodInfo AllocationParamsCopyMethodInfo AllocationParams signature where
overloadedMethod _ = allocationParamsCopy
-- method AllocationParams::free
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "_obj", argType = TInterface "Gst" "AllocationParams", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "gst_allocation_params_free" gst_allocation_params_free ::
Ptr AllocationParams -> -- _obj : TInterface "Gst" "AllocationParams"
IO ()
allocationParamsFree ::
(MonadIO m) =>
AllocationParams -- _obj
-> m () -- result
allocationParamsFree _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
gst_allocation_params_free _obj'
touchManagedPtr _obj
return ()
data AllocationParamsFreeMethodInfo
instance (signature ~ (m ()), MonadIO m) => MethodInfo AllocationParamsFreeMethodInfo AllocationParams signature where
overloadedMethod _ = allocationParamsFree
-- method AllocationParams::init
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "_obj", argType = TInterface "Gst" "AllocationParams", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "gst_allocation_params_init" gst_allocation_params_init ::
Ptr AllocationParams -> -- _obj : TInterface "Gst" "AllocationParams"
IO ()
allocationParamsInit ::
(MonadIO m) =>
AllocationParams -- _obj
-> m () -- result
allocationParamsInit _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
gst_allocation_params_init _obj'
touchManagedPtr _obj
return ()
data AllocationParamsInitMethodInfo
instance (signature ~ (m ()), MonadIO m) => MethodInfo AllocationParamsInitMethodInfo AllocationParams signature where
overloadedMethod _ = allocationParamsInit
type family ResolveAllocationParamsMethod (t :: Symbol) (o :: *) :: * where
ResolveAllocationParamsMethod "copy" o = AllocationParamsCopyMethodInfo
ResolveAllocationParamsMethod "free" o = AllocationParamsFreeMethodInfo
ResolveAllocationParamsMethod "init" o = AllocationParamsInitMethodInfo
ResolveAllocationParamsMethod l o = MethodResolutionFailed l o
instance (info ~ ResolveAllocationParamsMethod t AllocationParams, MethodInfo info AllocationParams p) => IsLabelProxy t (AllocationParams -> p) where
fromLabelProxy _ = overloadedMethod (MethodProxy :: MethodProxy info)
#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveAllocationParamsMethod t AllocationParams, MethodInfo info AllocationParams p) => IsLabel t (AllocationParams -> p) where
fromLabel _ = overloadedMethod (MethodProxy :: MethodProxy info)
#endif