| Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
|---|---|
| License | LGPL-2.1 |
| Maintainer | Iñaki García Etxebarria (inaki@blueleaf.cc) |
| Safe Haskell | None |
| Language | Haskell2010 |
GI.Gst.Objects.Allocator
Description
Memory is usually created by allocators with a allocatorAlloc
method call. When Nothing is used as the allocator, the default allocator will
be used.
New allocators can be registered with allocatorRegister.
Allocators are identified by name and can be retrieved with
allocatorFind. allocatorSetDefault can be used to change the
default allocator.
New memory can be created with memoryNewWrapped that wraps the memory
allocated elsewhere.
Synopsis
- newtype Allocator = Allocator (ManagedPtr Allocator)
- class (GObject o, IsDescendantOf Allocator o) => IsAllocator o
- toAllocator :: (MonadIO m, IsAllocator o) => o -> m Allocator
- noAllocator :: Maybe Allocator
- allocatorAlloc :: (HasCallStack, MonadIO m, IsAllocator a) => a -> Word64 -> Maybe AllocationParams -> m (Maybe Memory)
- allocatorFind :: (HasCallStack, MonadIO m) => Maybe Text -> m (Maybe Allocator)
- allocatorFree :: (HasCallStack, MonadIO m, IsAllocator a) => a -> Memory -> m ()
- allocatorRegister :: (HasCallStack, MonadIO m, IsAllocator a) => Text -> a -> m ()
- allocatorSetDefault :: (HasCallStack, MonadIO m, IsAllocator a) => a -> m ()
Exported types
Memory-managed wrapper type.
Constructors
| Allocator (ManagedPtr Allocator) |
Instances
| GObject Allocator Source # | |
Defined in GI.Gst.Objects.Allocator Methods gobjectType :: IO GType # | |
| HasParentTypes Allocator Source # | |
Defined in GI.Gst.Objects.Allocator | |
| type ParentTypes Allocator Source # | |
Defined in GI.Gst.Objects.Allocator | |
class (GObject o, IsDescendantOf Allocator o) => IsAllocator o Source #
Type class for types which can be safely cast to Allocator, for instance with toAllocator.
Instances
| (GObject o, IsDescendantOf Allocator o) => IsAllocator o Source # | |
Defined in GI.Gst.Objects.Allocator | |
toAllocator :: (MonadIO m, IsAllocator o) => o -> m Allocator Source #
Methods
alloc
Arguments
| :: (HasCallStack, MonadIO m, IsAllocator a) | |
| => a |
|
| -> Word64 |
|
| -> Maybe AllocationParams |
|
| -> m (Maybe Memory) | Returns: a new |
Use allocator to allocate a new memory block with memory that is at least
size big.
The optional params can specify the prefix and padding for the memory. If
Nothing is passed, no flags, no extra prefix/padding and a default alignment is
used.
The prefix/padding will be filled with 0 if flags contains
GST_MEMORY_FLAG_ZERO_PREFIXED and GST_MEMORY_FLAG_ZERO_PADDED respectively.
When allocator is Nothing, the default allocator will be used.
The alignment in params is given as a bitmask so that align + 1 equals
the amount of bytes to align to. For example, to align to 8 bytes,
use an alignment of 7.
find
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Maybe Text |
|
| -> m (Maybe Allocator) | Returns: a |
Find a previously registered allocator with name. When name is Nothing, the
default allocator will be returned.
free
Arguments
| :: (HasCallStack, MonadIO m, IsAllocator a) | |
| => a |
|
| -> Memory |
|
| -> m () |
Free memory that was previously allocated with allocatorAlloc.
register
Arguments
| :: (HasCallStack, MonadIO m, IsAllocator a) | |
| => Text |
|
| -> a |
|
| -> m () |
Registers the memory allocator with name. This function takes ownership of
allocator.
setDefault
Arguments
| :: (HasCallStack, MonadIO m, IsAllocator a) | |
| => a |
|
| -> m () |
Set the default allocator. This function takes ownership of allocator.