gi-gst-1.0.23: GStreamer bindings
CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellNone
LanguageHaskell2010

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

Exported types

newtype Allocator Source #

Memory-managed wrapper type.

Constructors

Allocator (ManagedPtr Allocator) 

Instances

Instances details
Eq Allocator Source # 
Instance details

Defined in GI.Gst.Objects.Allocator

Methods

(==) :: Allocator -> Allocator -> Bool

(/=) :: Allocator -> Allocator -> Bool

GObject Allocator Source # 
Instance details

Defined in GI.Gst.Objects.Allocator

ManagedPtrNewtype Allocator Source # 
Instance details

Defined in GI.Gst.Objects.Allocator

Methods

toManagedPtr :: Allocator -> ManagedPtr Allocator

TypedObject Allocator Source # 
Instance details

Defined in GI.Gst.Objects.Allocator

Methods

glibType :: IO GType

IsGValue Allocator Source #

Convert Allocator to and from GValue with toGValue and fromGValue.

Instance details

Defined in GI.Gst.Objects.Allocator

Methods

toGValue :: Allocator -> IO GValue

fromGValue :: GValue -> IO Allocator

HasParentTypes Allocator Source # 
Instance details

Defined in GI.Gst.Objects.Allocator

type ParentTypes Allocator Source # 
Instance details

Defined in GI.Gst.Objects.Allocator

type ParentTypes Allocator = '[Object, Object]

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

Instances details
(GObject o, IsDescendantOf Allocator o) => IsAllocator o Source # 
Instance details

Defined in GI.Gst.Objects.Allocator

toAllocator :: (MonadIO m, IsAllocator o) => o -> m Allocator Source #

Cast to Allocator, for types for which this is known to be safe. For general casts, use castTo.

Methods

Overloaded methods

alloc

allocatorAlloc Source #

Arguments

:: (HasCallStack, MonadIO m, IsAllocator a) 
=> a

allocator: a Allocator to use

-> Word64

size: size of the visible memory area

-> Maybe AllocationParams

params: optional parameters

-> m (Maybe Memory)

Returns: a new Memory.

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

allocatorFind Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Maybe Text

name: the name of the allocator

-> m (Maybe Allocator)

Returns: a Allocator or Nothing when the allocator with name was not registered. Use objectUnref to release the allocator after usage.

Find a previously registered allocator with name. When name is Nothing, the default allocator will be returned.

free

allocatorFree Source #

Arguments

:: (HasCallStack, MonadIO m, IsAllocator a) 
=> a

allocator: a Allocator to use

-> Memory

memory: the memory to free

-> m () 

Free memory that was previously allocated with allocatorAlloc.

register

allocatorRegister Source #

Arguments

:: (HasCallStack, MonadIO m, IsAllocator a) 
=> Text

name: the name of the allocator

-> a

allocator: Allocator

-> m () 

Registers the memory allocator with name. This function takes ownership of allocator.

setDefault

allocatorSetDefault Source #

Arguments

:: (HasCallStack, MonadIO m, IsAllocator a) 
=> a

allocator: a Allocator

-> m () 

Set the default allocator. This function takes ownership of allocator.