Copyright | Will Thompson, Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (garetxe@gmail.com) |
Safe Haskell | None |
Language | Haskell2010 |
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.
- newtype Memory = Memory (ForeignPtr Memory)
- newZeroMemory :: MonadIO m => m Memory
- noMemory :: Maybe Memory
- data MemoryCopyMethodInfo
- memoryCopy :: MonadIO m => Memory -> Int64 -> Int64 -> m Memory
- data MemoryGetSizesMethodInfo
- memoryGetSizes :: MonadIO m => Memory -> Word64 -> Word64 -> m Word64
- data MemoryIsSpanMethodInfo
- memoryIsSpan :: MonadIO m => Memory -> Memory -> Word64 -> m Bool
- data MemoryIsTypeMethodInfo
- memoryIsType :: MonadIO m => Memory -> Text -> m Bool
- data MemoryMakeMappedMethodInfo
- memoryMakeMapped :: MonadIO m => Memory -> [MapFlags] -> m (Memory, MapInfo)
- data MemoryMapMethodInfo
- memoryMap :: MonadIO m => Memory -> [MapFlags] -> m (Bool, MapInfo)
- memoryNewWrapped :: MonadIO m => [MemoryFlags] -> ByteString -> Word64 -> Word64 -> Maybe DestroyNotify -> m Memory
- data MemoryResizeMethodInfo
- memoryResize :: MonadIO m => Memory -> Int64 -> Word64 -> m ()
- data MemoryShareMethodInfo
- memoryShare :: MonadIO m => Memory -> Int64 -> Int64 -> m Memory
- data MemoryUnmapMethodInfo
- memoryUnmap :: MonadIO m => Memory -> MapInfo -> m ()
- memoryReadAlign :: Memory -> IO Word64
- memoryReadAllocator :: Memory -> IO Allocator
- memoryReadMaxsize :: Memory -> IO Word64
- memoryReadMiniObject :: Memory -> IO MiniObject
- memoryReadOffset :: Memory -> IO Word64
- memoryReadParent :: Memory -> IO Memory
- memoryReadSize :: Memory -> IO Word64
Exported types
newZeroMemory :: MonadIO m => m Memory Source
Construct a Memory
struct initialized to zero.
Methods
memoryCopy
memoryGetSizes
memoryIsSpan
memoryIsType
memoryMakeMapped
memoryMap
memoryNewWrapped
memoryNewWrapped :: MonadIO m => [MemoryFlags] -> ByteString -> Word64 -> Word64 -> Maybe DestroyNotify -> m Memory Source
memoryResize
memoryShare
memoryUnmap
data MemoryUnmapMethodInfo Source
((~) (TYPE Lifted) signature (MapInfo -> m ()), MonadIO m) => MethodInfo (TYPE Lifted) MemoryUnmapMethodInfo Memory signature Source | |
memoryUnmap :: MonadIO m => Memory -> MapInfo -> m () Source
Properties
Align
memoryReadAlign :: Memory -> IO Word64 Source
Allocator
Maxsize
memoryReadMaxsize :: Memory -> IO Word64 Source
MiniObject
Offset
memoryReadOffset :: Memory -> IO Word64 Source
Parent
memoryReadParent :: Memory -> IO Memory Source
Size
memoryReadSize :: Memory -> IO Word64 Source