tizbuffer¶
-
group
tizbuffer
Dynamically re-sizeable buffer of contiguous binary data.
Typedefs
-
typedef struct tiz_buffer
tiz_buffer_t
¶ Dynamic buffer object opaque handle.
Functions
-
OMX_ERRORTYPE
tiz_buffer_init
(tiz_buffer_ptr_t *app_buf, const size_t a_nbytes)¶ Create a new dynamic buffer object.
- Return
OMX_ErrorNone if success, OMX_ErrorUndefined otherwise.
- Parameters
app_buf
: A dynamic buffer handle to be initialised.a_nbytes
: Initial size of the data store.
-
void
tiz_buffer_destroy
(tiz_buffer_t *ap_buf)¶ Destroy a dynamic buffer object.
- Parameters
ap_buf
: A dynamic buffer handle to be destroyed.
-
int
tiz_buffer_seek_mode
(tiz_buffer_t *ap_buf, const int a_seek_mode)¶ Set a new overwrite mode.
- Return
The old seek mode, or -1 on error.
- Parameters
ap_buf
: The dynamic buffer handle.a_seek_mode
: TIZ_BUFFER_NON_SEEKABLE (default) or TIZ_BUFFER_SEEKABLE.
-
int
tiz_buffer_push
(tiz_buffer_t *ap_buf, const void *ap_data, const size_t a_nbytes)¶ Copy data at the back the buffer.
- Return
The number of bytes actually stored.
- Parameters
ap_buf
: The dynamic buffer handle.ap_data
: The data to be stored.a_nbytes
: The number of bytes to store.
-
void
tiz_buffer_clear
(tiz_buffer_t *ap_buf)¶ Reset the position marker.
After this operation, tiz_buffer_available returns zero.
- Parameters
ap_buf
: The dynamic buffer handle.
-
int
tiz_buffer_available
(const tiz_buffer_t *ap_buf)¶ Retrieve the number of bytes available in the buffer.
- Return
The total number of bytes currently available.
- Parameters
ap_buf
: The dynamic buffer handle.
-
int
tiz_buffer_offset
(const tiz_buffer_t *ap_buf)¶ Retrieve the current position marker.
- Return
The offset in bytes that marks the current position in the buffer.
- Parameters
ap_buf
: The buffer handle.
-
void *
tiz_buffer_get
(const tiz_buffer_t *ap_buf)¶ Retrieve the current position in the buffer where data can be read from.
If the buffer is empty, i.e. tiz_buffer_available returns zero, the pointer returned is the position of the start of the buffer.
- Return
The pointer to the current position in the buffer.
- Parameters
ap_buf
: The dynamic buffer handle.
-
int
tiz_buffer_advance
(tiz_buffer_t *ap_buf, const int nbytes)¶ Advance the current position in the buffer.
- Return
The number of bytes actually advanced.
- Parameters
ap_buf
: The dynamic buffer handle.nbytes
: The number of bytes to increment the position marker by.
-
int
tiz_buffer_seek
(tiz_buffer_t *ap_buf, const long a_offset, const int a_whence)¶ Re-position the position marker.
The new position, measured in bytes, is obtained by adding offset bytes to the position specified by whence. If whence is set to TIZ_BUFFER_SEEK_SET, TIZ_BUFFER_SEEK_CUR, or TIZ_BUFFER_SEEK_END, the offset is relative to the start of the buffer, the current position indicator, or end-of-data marker, respectively.
- Return
0 on success, -1 on error (e.g. the whence argument was not TIZ_BUFFER_SEEK_SET, TIZ_BUFFER_SEEK_END, or TIZ_BUFFER_SEEK_CUR. Or the resulting buffer offset would be negative).
- Parameters
ap_buf
: The dynamic buffer handle.a_offset
: The new position is obtained by adding a_offset bytes to the position specified by a_whence.a_whence
: TIZ_BUFFER_SEEK_SET, TIZ_BUFFER_SEEK_CUR, or TIZ_BUFFER_SEEK_END.
-
typedef struct tiz_buffer