#include <stdbool.h>#include <stdint.h>
Go to the source code of this file.
Typedefs | |
| typedef struct pv_circular_buffer | pv_circular_buffer_t |
Functions | |
| void | pv_circular_buffer_delete (pv_circular_buffer_t *object) |
| pv_circular_buffer_status_t | pv_circular_buffer_init (int32_t capacity, int32_t element_size, pv_circular_buffer_t **object) |
| int32_t | pv_circular_buffer_read (pv_circular_buffer_t *object, void *buffer, int32_t length) |
| void | pv_circular_buffer_reset (pv_circular_buffer_t *object) |
| const char * | pv_circular_buffer_status_to_string (pv_circular_buffer_status_t status) |
| pv_circular_buffer_status_t | pv_circular_buffer_write (pv_circular_buffer_t *object, const void *buffer, int32_t length) |
| typedef struct pv_circular_buffer pv_circular_buffer_t |
Forward declaration of PV_circular_buffer object. It handles reading and writing to a buffer.
Definition at line 21 of file pvrecorder/include/pv_circular_buffer.h.
Status codes.
Definition at line 26 of file pvrecorder/include/pv_circular_buffer.h.
| void pv_circular_buffer_delete | ( | pv_circular_buffer_t * | object | ) |
Destructor for PV_circular_buffer object.
| object | Circular buffer object. |
Definition at line 61 of file porcupine/demo/c/pvrecorder/src/pv_circular_buffer.c.
| pv_circular_buffer_status_t pv_circular_buffer_init | ( | int32_t | capacity, |
| int32_t | element_size, | ||
| pv_circular_buffer_t ** | object | ||
| ) |
Constructor for PV_circular_buffer object.
| capacity | Capacity of the buffer to read and write. |
| element_size | Size of each element in the buffer. |
| object[out] | Circular buffer object. |
Definition at line 26 of file porcupine/demo/c/pvrecorder/src/pv_circular_buffer.c.
| int32_t pv_circular_buffer_read | ( | pv_circular_buffer_t * | object, |
| void * | buffer, | ||
| int32_t | length | ||
| ) |
Reads and copies the elements to the provided buffer.
| object | Circular buffer object. |
| buffer[out] | A pointer to copy the elements into. |
| length | The amount to copy to read from the buffer. is not PV_CIRCULAR_BUFFER_STATUS_SUCCESS. |
Definition at line 68 of file porcupine/demo/c/pvrecorder/src/pv_circular_buffer.c.
| void pv_circular_buffer_reset | ( | pv_circular_buffer_t * | object | ) |
Reset the buffer pointers to start.
| object | Circular buffer object. |
Definition at line 152 of file porcupine/demo/c/pvrecorder/src/pv_circular_buffer.c.
| const char* pv_circular_buffer_status_to_string | ( | pv_circular_buffer_status_t | status | ) |
Provides string representations of status codes.
| status | Status code. |
Definition at line 158 of file porcupine/demo/c/pvrecorder/src/pv_circular_buffer.c.
| pv_circular_buffer_status_t pv_circular_buffer_write | ( | pv_circular_buffer_t * | object, |
| const void * | buffer, | ||
| int32_t | length | ||
| ) |
Writes and copies the elements of param ${buffer} to the object's buffer. Overwrites existing frames if the buffer is full and returns PV_CIRCULAR_BUFFER_STATUS_WRITE_OVERFLOW which is not a failure.
| object | Circular buffer object. |
| buffer | A pointer to copy its elements to the object's buffer. |
| length | The amount of elements to copy. |
Definition at line 108 of file porcupine/demo/c/pvrecorder/src/pv_circular_buffer.c.