gst.memory
Module for [Memory] class
Types 1
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.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.Allocator.register]. Allocators are identified by name and can be retrieved with [gst.allocator.Allocator.find]. [gst.allocator.Allocator.setDefault] can be used to change the default allocator.
New memory can be created with [gst.memory.Memory.newWrapped] 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.Memory.getSizes] and [gst.memory.Memory.resize] respectively.
Getting access to the data of the memory is performed with [gst.memory.Memory.map]. The call will return a pointer to offset bytes into the region of memory. After the memory access is completed, [gst.memory.Memory.unmap] should be called.
Memory can be copied with [gst.memory.Memory.copy], which will return a writable copy. [gst.memory.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.Memory.isSpan] returns true.
Memory self()Returns `this`, for use in `with` statements.gst.allocator.Allocator allocator() @propertyGet `allocator` field. Returns: pointer to the #GstAllocatorvoid allocator(gst.allocator.Allocator propval) @propertySet `allocator` field. Params: propval = pointer to the #GstAllocatorvoid parent(gst.memory.Memory propval) @propertySet `parent` field. Params: propval = parent memory blockvoid maxsize(size_t propval) @propertySet `maxsize` field. Params: propval = the maximum size allocatedvoid align_(size_t propval) @propertySet `align_` field. Params: propval = the alignment of the memoryvoid offset(size_t propval) @propertySet `offset` field. Params: propval = the offset where valid data startsgst.memory.Memory newWrapped(gst.types.MemoryFlags flags, ubyte[] data, size_t maxsize, size_t offset, glib.types.DestroyNotify notify = null)Allocate a new memory block that wraps the given data.gst.memory.Memory copy(ptrdiff_t offset, ptrdiff_t size)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.size_t getSizes(out size_t offset, out size_t maxsize)Get the current size, offset and maxsize of mem.bool isSpan(gst.memory.Memory mem2, out size_t offset)Check if mem1 and mem2 share the memory with a common parent memory object and that the memory is contiguous.bool isType(string memType)Check if mem if allocated with an allocator for mem_type.gst.memory.Memory makeMapped(out gst.map_info.MapInfo info, gst.types.MapFlags flags)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.bool map(out gst.map_info.MapInfo info, gst.types.MapFlags flags)Fill info with the pointer and sizes of the memory in mem that can be accessed according to flags.void resize(ptrdiff_t offset, size_t size)Resize the memory region. mem should be writable and offset + size should be less than the maxsize of mem.gst.memory.Memory share(ptrdiff_t offset, ptrdiff_t size)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...void unmap(gst.map_info.MapInfo info)Release the memory obtained with [gst.memory.Memory.map]this(gst.allocator.Allocator allocator = gst.allocator.Allocator.init, gst.memory.Memory parent = gst.memory.Memory.init, size_t maxsize = size_t.init, size_t align_ = size_t.init, size_t offset = size_t.init, size_t size = size_t.init)Create a `memory.Memory` boxed type. Params: allocator = pointer to the #GstAllocator parent = parent memory block maxsize = the maximum size allocated align_ = the alignment of the memory offset =...