GstMemory is a lightweight refcounted object that wraps a region of memory. They are typically used to manage the data of a gstreamer.Buffer
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 Allocator.alloc method call. When NULL is used as the allocator, the default allocator will be used.
New memory can be created with Memory.newWrapped that wraps the memory allocated elsewhere.
Getting access to the data of the memory is performed with Memory.map. The call will return a pointer to offset bytes into the region of memory. After the memory access is completed, Memory.unmap should be called.
Memory can be copied with Memory.copy, which will return a writable copy. 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 Memory.isSpan returns TRUE.
Sets our main struct and passes it to the parent class.
Allocate a new memory block that wraps the given data.
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.
Get the main Gtk struct
Get the current size, offset and maxsize of mem.
the main Gtk struct as a void*
Initializes a newly allocated mem with the given parameters. This function will call MiniObject.init with the default memory parameters.
Check if mem1 and mem2 share the memory with a common parent memory object and that the memory is contiguous.
Check if mem if allocated with an allocator for mem_type.
Create a gstreamer.Memory 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.
Fill info with the pointer and sizes of the memory in mem that can be accessed according to flags.
Resize the memory region. mem should be writable and offset + size should be less than the maxsize of mem.
Return a shared copy of size bytes from mem starting from offset. No memory copy is performed and the memory region is simply shared. The result is guaranteed to be non-writable. size can be set to -1 to return a shared copy from offset to the end of the memory region.
Release the memory obtained with Memory.map
the main Gtk struct