#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Gst.Objects.Allocator
(
Allocator(..) ,
IsAllocator ,
toAllocator ,
noAllocator ,
#if ENABLE_OVERLOADING
AllocatorAllocMethodInfo ,
#endif
allocatorAlloc ,
allocatorFind ,
#if ENABLE_OVERLOADING
AllocatorFreeMethodInfo ,
#endif
allocatorFree ,
allocatorRegister ,
#if ENABLE_OVERLOADING
AllocatorSetDefaultMethodInfo ,
#endif
allocatorSetDefault ,
) 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.Structs.AllocationParams as Gst.AllocationParams
import {-# SOURCE #-} qualified GI.Gst.Structs.Memory as Gst.Memory
newtype Allocator = Allocator (ManagedPtr Allocator)
foreign import ccall "gst_allocator_get_type"
c_gst_allocator_get_type :: IO GType
instance GObject Allocator where
gobjectType = c_gst_allocator_get_type
class (GObject o, O.IsDescendantOf Allocator o) => IsAllocator o
instance (GObject o, O.IsDescendantOf Allocator o) => IsAllocator o
instance O.HasParentTypes Allocator
type instance O.ParentTypes Allocator = '[Gst.Object.Object, GObject.Object.Object]
toAllocator :: (MonadIO m, IsAllocator o) => o -> m Allocator
toAllocator = liftIO . unsafeCastTo Allocator
noAllocator :: Maybe Allocator
noAllocator = Nothing
#if ENABLE_OVERLOADING
type family ResolveAllocatorMethod (t :: Symbol) (o :: *) :: * where
ResolveAllocatorMethod "addControlBinding" o = Gst.Object.ObjectAddControlBindingMethodInfo
ResolveAllocatorMethod "alloc" o = AllocatorAllocMethodInfo
ResolveAllocatorMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveAllocatorMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveAllocatorMethod "defaultError" o = Gst.Object.ObjectDefaultErrorMethodInfo
ResolveAllocatorMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveAllocatorMethod "free" o = AllocatorFreeMethodInfo
ResolveAllocatorMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveAllocatorMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveAllocatorMethod "hasActiveControlBindings" o = Gst.Object.ObjectHasActiveControlBindingsMethodInfo
ResolveAllocatorMethod "hasAncestor" o = Gst.Object.ObjectHasAncestorMethodInfo
ResolveAllocatorMethod "hasAsAncestor" o = Gst.Object.ObjectHasAsAncestorMethodInfo
ResolveAllocatorMethod "hasAsParent" o = Gst.Object.ObjectHasAsParentMethodInfo
ResolveAllocatorMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveAllocatorMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveAllocatorMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveAllocatorMethod "ref" o = Gst.Object.ObjectRefMethodInfo
ResolveAllocatorMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveAllocatorMethod "removeControlBinding" o = Gst.Object.ObjectRemoveControlBindingMethodInfo
ResolveAllocatorMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveAllocatorMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveAllocatorMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveAllocatorMethod "suggestNextSync" o = Gst.Object.ObjectSuggestNextSyncMethodInfo
ResolveAllocatorMethod "syncValues" o = Gst.Object.ObjectSyncValuesMethodInfo
ResolveAllocatorMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveAllocatorMethod "unparent" o = Gst.Object.ObjectUnparentMethodInfo
ResolveAllocatorMethod "unref" o = Gst.Object.ObjectUnrefMethodInfo
ResolveAllocatorMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveAllocatorMethod "getControlBinding" o = Gst.Object.ObjectGetControlBindingMethodInfo
ResolveAllocatorMethod "getControlRate" o = Gst.Object.ObjectGetControlRateMethodInfo
ResolveAllocatorMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveAllocatorMethod "getGValueArray" o = Gst.Object.ObjectGetGValueArrayMethodInfo
ResolveAllocatorMethod "getName" o = Gst.Object.ObjectGetNameMethodInfo
ResolveAllocatorMethod "getParent" o = Gst.Object.ObjectGetParentMethodInfo
ResolveAllocatorMethod "getPathString" o = Gst.Object.ObjectGetPathStringMethodInfo
ResolveAllocatorMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveAllocatorMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveAllocatorMethod "getValue" o = Gst.Object.ObjectGetValueMethodInfo
ResolveAllocatorMethod "setControlBindingDisabled" o = Gst.Object.ObjectSetControlBindingDisabledMethodInfo
ResolveAllocatorMethod "setControlBindingsDisabled" o = Gst.Object.ObjectSetControlBindingsDisabledMethodInfo
ResolveAllocatorMethod "setControlRate" o = Gst.Object.ObjectSetControlRateMethodInfo
ResolveAllocatorMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveAllocatorMethod "setDefault" o = AllocatorSetDefaultMethodInfo
ResolveAllocatorMethod "setName" o = Gst.Object.ObjectSetNameMethodInfo
ResolveAllocatorMethod "setParent" o = Gst.Object.ObjectSetParentMethodInfo
ResolveAllocatorMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveAllocatorMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveAllocatorMethod t Allocator, O.MethodInfo info Allocator p) => OL.IsLabel t (Allocator -> 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 Allocator
type instance O.AttributeList Allocator = AllocatorAttributeList
type AllocatorAttributeList = ('[ '("name", Gst.Object.ObjectNamePropertyInfo), '("parent", Gst.Object.ObjectParentPropertyInfo)] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
#endif
#if ENABLE_OVERLOADING
type instance O.SignalList Allocator = AllocatorSignalList
type AllocatorSignalList = ('[ '("deepNotify", Gst.Object.ObjectDeepNotifySignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "gst_allocator_alloc" gst_allocator_alloc ::
Ptr Allocator ->
Word64 ->
Ptr Gst.AllocationParams.AllocationParams ->
IO (Ptr Gst.Memory.Memory)
allocatorAlloc ::
(B.CallStack.HasCallStack, MonadIO m, IsAllocator a) =>
a
-> Word64
-> Maybe (Gst.AllocationParams.AllocationParams)
-> m (Maybe Gst.Memory.Memory)
allocatorAlloc allocator size params = liftIO $ do
allocator' <- unsafeManagedPtrCastPtr allocator
maybeParams <- case params of
Nothing -> return nullPtr
Just jParams -> do
jParams' <- unsafeManagedPtrGetPtr jParams
return jParams'
result <- gst_allocator_alloc allocator' size maybeParams
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (wrapBoxed Gst.Memory.Memory) result'
return result''
touchManagedPtr allocator
whenJust params touchManagedPtr
return maybeResult
#if ENABLE_OVERLOADING
data AllocatorAllocMethodInfo
instance (signature ~ (Word64 -> Maybe (Gst.AllocationParams.AllocationParams) -> m (Maybe Gst.Memory.Memory)), MonadIO m, IsAllocator a) => O.MethodInfo AllocatorAllocMethodInfo a signature where
overloadedMethod _ = allocatorAlloc
#endif
foreign import ccall "gst_allocator_free" gst_allocator_free ::
Ptr Allocator ->
Ptr Gst.Memory.Memory ->
IO ()
allocatorFree ::
(B.CallStack.HasCallStack, MonadIO m, IsAllocator a) =>
a
-> Gst.Memory.Memory
-> m ()
allocatorFree allocator memory = liftIO $ do
allocator' <- unsafeManagedPtrCastPtr allocator
memory' <- B.ManagedPtr.disownBoxed memory
gst_allocator_free allocator' memory'
touchManagedPtr allocator
touchManagedPtr memory
return ()
#if ENABLE_OVERLOADING
data AllocatorFreeMethodInfo
instance (signature ~ (Gst.Memory.Memory -> m ()), MonadIO m, IsAllocator a) => O.MethodInfo AllocatorFreeMethodInfo a signature where
overloadedMethod _ = allocatorFree
#endif
foreign import ccall "gst_allocator_set_default" gst_allocator_set_default ::
Ptr Allocator ->
IO ()
allocatorSetDefault ::
(B.CallStack.HasCallStack, MonadIO m, IsAllocator a) =>
a
-> m ()
allocatorSetDefault allocator = liftIO $ do
allocator' <- B.ManagedPtr.disownObject allocator
gst_allocator_set_default allocator'
touchManagedPtr allocator
return ()
#if ENABLE_OVERLOADING
data AllocatorSetDefaultMethodInfo
instance (signature ~ (m ()), MonadIO m, IsAllocator a) => O.MethodInfo AllocatorSetDefaultMethodInfo a signature where
overloadedMethod _ = allocatorSetDefault
#endif
foreign import ccall "gst_allocator_find" gst_allocator_find ::
CString ->
IO (Ptr Allocator)
allocatorFind ::
(B.CallStack.HasCallStack, MonadIO m) =>
Maybe (T.Text)
-> m (Maybe Allocator)
allocatorFind name = liftIO $ do
maybeName <- case name of
Nothing -> return nullPtr
Just jName -> do
jName' <- textToCString jName
return jName'
result <- gst_allocator_find maybeName
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (wrapObject Allocator) result'
return result''
freeMem maybeName
return maybeResult
#if ENABLE_OVERLOADING
#endif
foreign import ccall "gst_allocator_register" gst_allocator_register ::
CString ->
Ptr Allocator ->
IO ()
allocatorRegister ::
(B.CallStack.HasCallStack, MonadIO m, IsAllocator a) =>
T.Text
-> a
-> m ()
allocatorRegister name allocator = liftIO $ do
name' <- textToCString name
allocator' <- B.ManagedPtr.disownObject allocator
gst_allocator_register name' allocator'
touchManagedPtr allocator
freeMem name'
return ()
#if ENABLE_OVERLOADING
#endif