diff options
Diffstat (limited to 'bin/common')
-rw-r--r-- | bin/common/ring-buffer.c | 8 | ||||
-rw-r--r-- | bin/common/ring-buffer.h | 2 |
2 files changed, 10 insertions, 0 deletions
diff --git a/bin/common/ring-buffer.c b/bin/common/ring-buffer.c index 039024f..850dfc0 100644 --- a/bin/common/ring-buffer.c +++ b/bin/common/ring-buffer.c @@ -44,6 +44,14 @@ ring_buffer_get_current_pointer (RingBuffer *buffer) return buffer->data + (buffer->current_index % buffer->n_blocks_total) * buffer->block_size; } +void +ring_buffer_set_current_pointer (RingBuffer *buffer, + guint index) +{ + g_assert (index < buffer->n_blocks_total); + buffer->current_index = index; +} + gpointer ring_buffer_get_pointer (RingBuffer *buffer, guint index) diff --git a/bin/common/ring-buffer.h b/bin/common/ring-buffer.h index a3758cb..fafe5ec 100644 --- a/bin/common/ring-buffer.h +++ b/bin/common/ring-buffer.h @@ -19,6 +19,8 @@ void ring_buffer_free (RingBuffer *buffer); void ring_buffer_reset (RingBuffer *buffer); gsize ring_buffer_get_block_size (RingBuffer *buffer); gpointer ring_buffer_get_current_pointer (RingBuffer *buffer); +void ring_buffer_set_current_pointer (RingBuffer *buffer, + guint index); gpointer ring_buffer_get_pointer (RingBuffer *buffer, guint index); guint ring_buffer_get_num_blocks (RingBuffer *buffer); |