Class Allocator
- All Implemented Interfaces:
Proxy
- Direct Known Subclasses:
Allocator.Allocator$Impl
Memory is usually created by allocators with a gst_allocator_alloc()
method call. When null is used as the allocator, the default allocator will
be used.
New allocators can be registered with gst_allocator_register(). Allocators are identified by name and can be retrieved with gst_allocator_find(). gst_allocator_set_default() can be used to change the default allocator.
New memory can be created with gst_memory_new_wrapped() that wraps the memory allocated elsewhere.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThe Allocator$Impl type represents a native instance of the abstract Allocator class.static classTheGstAllocatoris used to create new memory.static classAllocator.Builder<B extends Allocator.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.Nested classes/interfaces inherited from class GstObject
GstObject.DeepNotifyCallback, GstObject.Object$Impl, GstObject.ObjectClassNested classes/interfaces inherited from class InitiallyUnowned
InitiallyUnowned.InitiallyUnownedClassNested classes/interfaces inherited from class GObject
GObject.NotifyCallback -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new Allocator.Allocator(MemorySegment address) Create a Allocator instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescription@Nullable Memoryalloc(long size, @Nullable AllocationParams params) Use this Allocator to allocate a new memory block with memory that is at leastsizebig.protected AllocatorasParent()Return this instance as if it were its parent type.static @Nullable AllocatorFind a previously registered allocator withname.Whennameisnull, the default allocator will be returned.voidFreememorythat was previously allocated with gst_allocator_alloc().static MemoryLayoutThe memory layout of the native struct.static @Nullable TypegetType()Get the GType of the Allocator class.static voidRegisters the memoryallocatorwithname.voidSet the default allocator.Methods inherited from class GstObject
addControlBinding, checkUniqueness, deepNotify, defaultDeepNotify, defaultError, emitDeepNotify, getControlBinding, getControlRate, getGValueArray, getName, getParent, getPathString, getValue, getValueArray, hasActiveControlBindings, hasAncestor, hasAsAncestor, hasAsParent, onDeepNotify, ref, refSink, removeControlBinding, replace, setControlBindingDisabled, setControlBindingsDisabled, setControlRate, setName, setParent, suggestNextSync, syncValues, unparent, unrefMethods inherited from class InitiallyUnowned
builderMethods inherited from class GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newv, notify, notify, notifyByPspec, onNotify, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, watchClosure, weakRef, weakUnref, withPropertiesMethods inherited from class TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
Allocator
Create a Allocator instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
Allocator
public Allocator()Create a new Allocator.
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
asParent
-
find
-
register
-
alloc
Use this Allocator to allocate a new memory block with memory that is at least
sizebig.The optional
paramscan specify the prefix and padding for the memory. Ifnullis 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_PREFIXEDandGST_MEMORY_FLAG_ZERO_PADDEDrespectively.When this Allocator is
null, the default allocator will be used.The alignment in
paramsis given as a bitmask so thatalign+ 1 equals the amount of bytes to align to. For example, to align to 8 bytes, use an alignment of 7.- Parameters:
size- size of the visible memory areaparams- optional parameters- Returns:
- a new
GstMemory.
-
free
Freememorythat was previously allocated with gst_allocator_alloc().- Parameters:
memory- the memory to free
-
setDefault
public void setDefault()Set the default allocator.
-