module GI.Gst.Objects.Allocator
(
Allocator(..) ,
IsAllocator ,
toAllocator ,
noAllocator ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
AllocatorAllocMethodInfo ,
#endif
allocatorAlloc ,
allocatorFind ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
AllocatorFreeMethodInfo ,
#endif
allocatorFree ,
allocatorRegister ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
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.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
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 GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gst.Objects.Object as Gst.Object
import qualified GI.Gst.Structs.AllocationParams as Gst.AllocationParams
import 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 => IsAllocator o
#if MIN_VERSION_base(4,9,0)
instance (GObject a, O.UnknownAncestorError Allocator a) =>
IsAllocator a
#endif
instance IsAllocator Allocator
instance Gst.Object.IsObject Allocator
instance GObject.Object.IsObject Allocator
toAllocator :: (MonadIO m, IsAllocator o) => o -> m Allocator
toAllocator = liftIO . unsafeCastTo Allocator
noAllocator :: Maybe Allocator
noAllocator = Nothing
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
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 "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 "replaceData" o = GObject.Object.ObjectReplaceDataMethodInfo
ResolveAllocatorMethod "replaceQdata" o = GObject.Object.ObjectReplaceQdataMethodInfo
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) => O.IsLabelProxy t (Allocator -> p) where
fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveAllocatorMethod t Allocator, O.MethodInfo info Allocator p) => O.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
#endif
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
instance O.HasAttributeList Allocator
type instance O.AttributeList Allocator = AllocatorAttributeList
type AllocatorAttributeList = ('[ '("name", Gst.Object.ObjectNamePropertyInfo), '("parent", Gst.Object.ObjectParentPropertyInfo)] :: [(Symbol, *)])
#endif
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
#endif
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
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 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
checkUnexpectedReturnNULL "allocatorAlloc" result
result' <- (wrapBoxed Gst.Memory.Memory) result
touchManagedPtr allocator
whenJust params touchManagedPtr
return result'
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data AllocatorAllocMethodInfo
instance (signature ~ (Word64 -> Maybe (Gst.AllocationParams.AllocationParams) -> m 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 defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
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 defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
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 defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
#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 defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
#endif