mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 10:41:04 +00:00
design: memory: assorted formatting and markup fixes
This commit is contained in:
parent
1687511e4e
commit
b4e0ffdfd7
1 changed files with 21 additions and 22 deletions
|
@ -12,13 +12,13 @@ multimedia data passed around in the pipeline.
|
||||||
|
|
||||||
## Memory layout
|
## Memory layout
|
||||||
|
|
||||||
`GstMemory` manages a memory region. The accessible part of the managed region is
|
`GstMemory` manages a memory region. The accessible part of the managed region
|
||||||
defined by an offset relative to the start of the region and a size. This
|
is defined by an offset relative to the start of the region and a size. This
|
||||||
means that the managed region can be larger than what is visible to the user of
|
means that the managed region can be larger than what is visible to the user of
|
||||||
`GstMemory` API.
|
`GstMemory` API.
|
||||||
|
|
||||||
Schematically, `GstMemory` has a pointer to a memory region of _maxsize_. The area
|
Schematically, `GstMemory` has a pointer to a memory region of _maxsize_. The
|
||||||
starting from `offset` and `size` is accessible.
|
area starting from `offset` and `size` is accessible.
|
||||||
|
|
||||||
```
|
```
|
||||||
memory
|
memory
|
||||||
|
@ -32,13 +32,13 @@ GstMemory ->*----------------------------------------------------*
|
||||||
The current properties of the accessible memory can be retrieved with:
|
The current properties of the accessible memory can be retrieved with:
|
||||||
|
|
||||||
``` c
|
``` c
|
||||||
gsize gst_memory_get_sizes (GstMemory *mem, gsize *offset, gsize *maxsize);
|
gsize gst_memory_get_sizes (GstMemory *mem, gsize *offset, gsize *maxsize);
|
||||||
```
|
```
|
||||||
|
|
||||||
The offset and size can be changed with:
|
The offset and size can be changed with:
|
||||||
|
|
||||||
``` c
|
``` c
|
||||||
void gst_memory_resize (GstMemory *mem, gssize offset, gsize size);
|
void gst_memory_resize (GstMemory *mem, gssize offset, gsize size);
|
||||||
```
|
```
|
||||||
|
|
||||||
## Allocators
|
## Allocators
|
||||||
|
@ -79,9 +79,8 @@ GStreamer system. This way, the allocator can be retrieved by name.
|
||||||
After an allocator is created, new `GstMemory` can be created with
|
After an allocator is created, new `GstMemory` can be created with
|
||||||
|
|
||||||
``` c
|
``` c
|
||||||
GstMemory * gst_allocator_alloc (const GstAllocator * allocator,
|
GstMemory * gst_allocator_alloc (const GstAllocator * allocator,
|
||||||
gsize size,
|
gsize size, GstAllocationParams *params);
|
||||||
GstAllocationParams *params);
|
|
||||||
```
|
```
|
||||||
|
|
||||||
`GstAllocationParams` contain extra info such as flags, alignment, prefix and
|
`GstAllocationParams` contain extra info such as flags, alignment, prefix and
|
||||||
|
@ -99,11 +98,11 @@ It is also possible to create a new `GstMemory` object that wraps existing
|
||||||
memory with:
|
memory with:
|
||||||
|
|
||||||
``` c
|
``` c
|
||||||
GstMemory * gst_memory_new_wrapped (GstMemoryFlags flags,
|
GstMemory * gst_memory_new_wrapped (GstMemoryFlags flags,
|
||||||
gpointer data, gsize maxsize,
|
gpointer data, gsize maxsize,
|
||||||
gsize offset, gsize size,
|
gsize offset, gsize size,
|
||||||
gpointer user_data,
|
gpointer user_data,
|
||||||
GDestroyNotify notify);
|
GDestroyNotify notify);
|
||||||
```
|
```
|
||||||
|
|
||||||
## Lifecycle
|
## Lifecycle
|
||||||
|
@ -131,16 +130,16 @@ After the data has been accessed in the object, the `unmap()` call must be
|
||||||
performed, which will unlock the memory again.
|
performed, which will unlock the memory again.
|
||||||
|
|
||||||
It is allowed to recursively map multiple times with the same or narrower
|
It is allowed to recursively map multiple times with the same or narrower
|
||||||
access modes. For each of the map calls, a corresponding unmap call needs to
|
access modes. For each of the `map()` calls, a corresponding `unmap()` call
|
||||||
be made. WRITE-only memory cannot be mapped in READ mode and READ-only memory
|
needs to be made. WRITE-only memory cannot be mapped in READ mode and
|
||||||
cannot be mapped in WRITE mode.
|
READ-only memory cannot be mapped in WRITE mode.
|
||||||
|
|
||||||
The memory pointer returned from the map call is guaranteed to remain valid in
|
The memory pointer returned from the `map()` call is guaranteed to remain
|
||||||
the requested mapping mode until the corresponding unmap call is performed on
|
valid in the requested mapping mode until the corresponding `unmap()` call is
|
||||||
the pointer.
|
performed on the pointer.
|
||||||
|
|
||||||
When multiple map operations are nested and return the same pointer, the pointer
|
When multiple `map()` operations are nested and return the same pointer, the
|
||||||
is valid until the last unmap call is done.
|
pointer is valid until the last `unmap()` call is done.
|
||||||
|
|
||||||
When the final reference on a memory object is dropped, all outstanding
|
When the final reference on a memory object is dropped, all outstanding
|
||||||
mappings should have been unmapped.
|
mappings should have been unmapped.
|
||||||
|
|
Loading…
Reference in a new issue