Package ch.bailu.gtk.gst
Klasse Memory
java.lang.Object
ch.bailu.gtk.type.Type
ch.bailu.gtk.type.Pointer
ch.bailu.gtk.type.Record
ch.bailu.gtk.gst.Memory
- Alle implementierten Schnittstellen:
PointerInterface
GstMemory is a lightweight refcounted object that wraps a region of memory.
They are typically used to manage the data of a #GstBuffer.
A GstMemory object has an allocated region of memory of maxsize. The maximum
size does not change during the lifetime of the memory object. The memory
also has an offset and size property that specifies the valid range of memory
in the allocated region.
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.
Refcounting of the memory block is performed with gst_memory_ref() and
gst_memory_unref().
The size of the memory can be retrieved and changed with
gst_memory_get_sizes() and gst_memory_resize() respectively.
Getting access to the data of the memory is performed with gst_memory_map().
The call will return a pointer to offset bytes into the region of memory.
After the memory access is completed, gst_memory_unmap() should be called.
Memory can be copied with gst_memory_copy(), which will return a writable
copy. gst_memory_share() will create a new memory block that shares the
memory with an existing memory block at a custom offset and with a custom
size.
Memory can be efficiently merged when gst_memory_is_span() returns %TRUE.
They are typically used to manage the data of a #GstBuffer.
A GstMemory object has an allocated region of memory of maxsize. The maximum
size does not change during the lifetime of the memory object. The memory
also has an offset and size property that specifies the valid range of memory
in the allocated region.
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.
Refcounting of the memory block is performed with gst_memory_ref() and
gst_memory_unref().
The size of the memory can be retrieved and changed with
gst_memory_get_sizes() and gst_memory_resize() respectively.
Getting access to the data of the memory is performed with gst_memory_map().
The call will return a pointer to offset bytes into the region of memory.
After the memory access is completed, gst_memory_unmap() should be called.
Memory can be copied with gst_memory_copy(), which will return a writable
copy. gst_memory_share() will create a new memory block that shares the
memory with an existing memory block at a custom offset and with a custom
size.
Memory can be efficiently merged when gst_memory_is_span() returns %TRUE.
https://gstreamer.freedesktop.org/documentation/gstreamer/gi-index.html
-
Verschachtelte Klassen - Übersicht
Verschachtelte Klassen -
Feldübersicht
FelderModifizierer und TypFeldBeschreibungstatic final String
the alignment of the memorystatic final String
pointer to the #GstAllocatorstatic final String
the maximum size allocatedstatic final String
parent structure
Private field: direct-typestatic final String
the offset where valid data startsstatic final String
parent memory blockstatic final String
the size of valid data -
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungcopy
(long offset, long size) Return a copy of @size bytes from @mem starting from @offset.static ClassHandler
long
the alignment of the memorypointer to the #GstAllocatorlong
the maximum size allocatedlong
the offset where valid data startsparent memory blocklong
the size of valid datastatic int
static long
static TypeSystem.TypeSize
long
Get the current @size, @offset and @maxsize of @mem.static long
static TypeSystem.TypeSize
void
init
(int flags, Allocator allocator, Memory parent, long maxsize, long align, long offset, long size) Initializes a newly allocated @mem with the given parameters.boolean
Check if @mem1 and mem2 share the memory with a common parent memory object
and that the memory is contiguous.boolean
Check if @mem if allocated with an allocator for @mem_type.boolean
Check if @mem if allocated with an allocator for @mem_type.makeMapped
(MapInfo info, int flags) Create a #GstMemory object that is mapped with @flags.boolean
Fill @info with the pointer and sizes of the memory in @mem that can be
accessed according to @flags.static Memory
newWrappedMemory
(int flags, Pointer data, long maxsize, long offset, long size, Pointer user_data, Memory.OnDestroyNotify notify) Allocate a new memory block that wraps the given @data.void
resize
(long offset, long size) Resize the memory region.void
setFieldAlign
(long align) the alignment of the memoryvoid
setFieldAllocator
(Allocator allocator) pointer to the #GstAllocatorvoid
setFieldMaxsize
(long maxsize) the maximum size allocatedvoid
setFieldOffset
(long offset) the offset where valid data startsvoid
setFieldParent
(Memory parent) parent memory blockvoid
setFieldSize
(long size) the size of valid datashare
(long offset, long size) Return a shared copy of @size bytes from @mem starting from @offset.void
Release the memory obtained with gst_memory_map()Von Klasse geerbte Methoden ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacks
Von Klasse geerbte Methoden ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
Von Klasse geerbte Methoden java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Von Schnittstelle geerbte Methoden ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Felddetails
-
MINI_OBJECT
parent structure
Private field: direct-type- Siehe auch:
-
ALLOCATOR
pointer to the #GstAllocator- Siehe auch:
-
PARENT
parent memory block- Siehe auch:
-
MAXSIZE
the maximum size allocated- Siehe auch:
-
ALIGN
the alignment of the memory- Siehe auch:
-
OFFSET
the offset where valid data starts- Siehe auch:
-
SIZE
the size of valid data- Siehe auch:
-
-
Konstruktordetails
-
Memory
-
Memory
public Memory()
-
-
Methodendetails
-
getClassHandler
-
setFieldAllocator
pointer to the #GstAllocator -
getFieldAllocator
pointer to the #GstAllocator -
setFieldParent
parent memory block -
getFieldParent
parent memory block -
setFieldMaxsize
public void setFieldMaxsize(long maxsize) the maximum size allocated -
getFieldMaxsize
public long getFieldMaxsize()the maximum size allocated -
setFieldAlign
public void setFieldAlign(long align) the alignment of the memory -
getFieldAlign
public long getFieldAlign()the alignment of the memory -
setFieldOffset
public void setFieldOffset(long offset) the offset where valid data starts -
getFieldOffset
public long getFieldOffset()the offset where valid data starts -
setFieldSize
public void setFieldSize(long size) the size of valid data -
getFieldSize
public long getFieldSize()the size of valid data -
newWrappedMemory
public static Memory newWrappedMemory(int flags, @Nonnull Pointer data, long maxsize, long offset, long size, @Nullable Pointer user_data, Memory.OnDestroyNotify notify) Allocate a new memory block that wraps the given @data.
The prefix/padding must be filled with 0 if @flags contains
#GST_MEMORY_FLAG_ZERO_PREFIXED and #GST_MEMORY_FLAG_ZERO_PADDED respectively.- Parameter:
flags
- #GstMemoryFlagsdata
- data to wrapmaxsize
- allocated size of @dataoffset
- offset in @datasize
- size of valid datauser_data
- user_datanotify
- called with @user_data when the memory is freed- Gibt zurück:
- a new #GstMemory.
-
copy
Return a copy of @size bytes from @mem starting from @offset. This copy is
guaranteed to be writable. @size can be set to -1 to return a copy
from @offset to the end of the memory region.- Parameter:
offset
- offset to copy fromsize
- size to copy, or -1 to copy to the end of the memory region- Gibt zurück:
- a new copy of @mem if the copy succeeded, %NULL otherwise.
-
getSizes
Get the current @size, @offset and @maxsize of @mem.- Parameter:
offset
- pointer to offsetmaxsize
- pointer to maxsize- Gibt zurück:
- the current size of @mem
-
init
public void init(int flags, @Nonnull Allocator allocator, @Nonnull Memory parent, long maxsize, long align, long offset, long size) Initializes a newly allocated @mem with the given parameters. This function
will call gst_mini_object_init() with the default memory parameters.- Parameter:
flags
- #GstMemoryFlagsallocator
- the #GstAllocatorparent
- the parent of @memmaxsize
- the total size of the memoryalign
- the alignment of the memoryoffset
- The offset in the memorysize
- the size of valid data in the memory
-
isSpan
Check if @mem1 and mem2 share the memory with a common parent memory object
and that the memory is contiguous.
If this is the case, the memory of @mem1 and @mem2 can be merged
efficiently by performing gst_memory_share() on the parent object from
the returned @offset.- Parameter:
mem2
- a #GstMemoryoffset
- a pointer to a result offset- Gibt zurück:
- %TRUE if the memory is contiguous and of a common parent.
-
isType
Check if @mem if allocated with an allocator for @mem_type.- Parameter:
mem_type
- a memory type- Gibt zurück:
- %TRUE if @mem was allocated from an allocator for @mem_type.
-
isType
Check if @mem if allocated with an allocator for @mem_type.- Parameter:
mem_type
- a memory type- Gibt zurück:
- %TRUE if @mem was allocated from an allocator for @mem_type.
-
makeMapped
Create a #GstMemory object that is mapped with @flags. If @mem is mappable
with @flags, this function returns the mapped @mem directly. Otherwise a
mapped copy of @mem is returned.
This function takes ownership of old @mem and returns a reference to a new
#GstMemory.- Parameter:
info
- pointer for infoflags
- mapping flags- Gibt zurück:
- a #GstMemory object mapped with @flags or %NULL when a mapping is not possible.
-
map
Fill @info with the pointer and sizes of the memory in @mem that can be
accessed according to @flags.
This function can return %FALSE for various reasons:
- the memory backed by @mem is not accessible with the given @flags.
- the memory was already mapped with a different mapping.
@info and its contents remain valid for as long as @mem is valid and
until gst_memory_unmap() is called.
For each gst_memory_map() call, a corresponding gst_memory_unmap() call
should be done.- Parameter:
info
- pointer for infoflags
- mapping flags- Gibt zurück:
- %TRUE if the map operation was successful.
-
resize
public void resize(long offset, long size) Resize the memory region. @mem should be writable and offset + size should be
less than the maxsize of @mem.
#GST_MEMORY_FLAG_ZERO_PREFIXED and #GST_MEMORY_FLAG_ZERO_PADDED will be
cleared when offset or padding is increased respectively.- Parameter:
offset
- a new offsetsize
- a new size
-
unmap
Release the memory obtained with gst_memory_map()- Parameter:
info
- a #GstMapInfo
-
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-