mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 09:55:36 +00:00
buffermemory: keep track of buffer size and current offset
Added the possibility to get current offset and the total size of the buffer.
This commit is contained in:
parent
d9aaa15a30
commit
54b6ee0c55
2 changed files with 6 additions and 0 deletions
|
@ -45,6 +45,8 @@ gst_buffer_memory_map (GstBuffer * buffer, GstBufferMemoryMap * map)
|
|||
map->data = map->map.data;
|
||||
map->size = map->map.size;
|
||||
map->index = 0;
|
||||
map->total_size = gst_buffer_get_size (buffer);
|
||||
map->offset = 0;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -90,6 +92,8 @@ gst_buffer_memory_advance_bytes (GstBufferMemoryMap * map, gsize size)
|
|||
|
||||
g_return_val_if_fail (map != NULL, FALSE);
|
||||
|
||||
map->offset += size;
|
||||
|
||||
while (offset >= map->size) {
|
||||
offset -= map->size;
|
||||
GST_DEBUG ("switching memory");
|
||||
|
|
|
@ -32,11 +32,13 @@ struct _GstBufferMemoryMap
|
|||
GstMemory *mem;
|
||||
GstMapInfo map;
|
||||
guint index;
|
||||
gsize total_size;
|
||||
|
||||
/* public datas */
|
||||
|
||||
/* data of the currently mapped memory */
|
||||
const guint8 *data;
|
||||
guint offset;
|
||||
|
||||
/* size of the currently mapped memory */
|
||||
gsize size;
|
||||
|
|
Loading…
Reference in a new issue