summaryrefslogtreecommitdiff
path: root/media/libcubeb/src/cubeb_ring_array.h
diff options
context:
space:
mode:
Diffstat (limited to 'media/libcubeb/src/cubeb_ring_array.h')
-rw-r--r--media/libcubeb/src/cubeb_ring_array.h40
1 files changed, 22 insertions, 18 deletions
diff --git a/media/libcubeb/src/cubeb_ring_array.h b/media/libcubeb/src/cubeb_ring_array.h
index 05a8fe9620..51b3b321a3 100644
--- a/media/libcubeb/src/cubeb_ring_array.h
+++ b/media/libcubeb/src/cubeb_ring_array.h
@@ -16,16 +16,17 @@
them in the correct order. */
typedef struct {
- AudioBuffer * buffer_array; /**< Array that hold pointers of the allocated
- space for the buffers. */
- unsigned int tail; /**< Index of the last element (first to deliver). */
- unsigned int count; /**< Number of elements in the array. */
- unsigned int capacity; /**< Total length of the array. */
+ AudioBuffer * buffer_array; /**< Array that hold pointers of the allocated space for the buffers. */
+ unsigned int tail; /**< Index of the last element (first to deliver). */
+ unsigned int count; /**< Number of elements in the array. */
+ unsigned int capacity; /**< Total length of the array. */
} ring_array;
static int
-single_audiobuffer_init(AudioBuffer * buffer, uint32_t bytesPerFrame,
- uint32_t channelsPerFrame, uint32_t frames)
+single_audiobuffer_init(AudioBuffer * buffer,
+ uint32_t bytesPerFrame,
+ uint32_t channelsPerFrame,
+ uint32_t frames)
{
assert(buffer);
assert(bytesPerFrame > 0 && channelsPerFrame && frames > 0);
@@ -35,7 +36,7 @@ single_audiobuffer_init(AudioBuffer * buffer, uint32_t bytesPerFrame,
if (buffer->mData == NULL) {
return CUBEB_ERROR;
}
- PodZero(static_cast<char *>(buffer->mData), size);
+ PodZero(static_cast<char*>(buffer->mData), size);
buffer->mNumberChannels = channelsPerFrame;
buffer->mDataByteSize = size;
@@ -47,12 +48,15 @@ single_audiobuffer_init(AudioBuffer * buffer, uint32_t bytesPerFrame,
@param ra The ring_array pointer of allocated structure.
@retval 0 on success. */
int
-ring_array_init(ring_array * ra, uint32_t capacity, uint32_t bytesPerFrame,
- uint32_t channelsPerFrame, uint32_t framesPerBuffer)
+ring_array_init(ring_array * ra,
+ uint32_t capacity,
+ uint32_t bytesPerFrame,
+ uint32_t channelsPerFrame,
+ uint32_t framesPerBuffer)
{
assert(ra);
- if (capacity == 0 || bytesPerFrame == 0 || channelsPerFrame == 0 ||
- framesPerBuffer == 0) {
+ if (capacity == 0 || bytesPerFrame == 0 ||
+ channelsPerFrame == 0 || framesPerBuffer == 0) {
return CUBEB_ERROR_INVALID_PARAMETER;
}
ra->capacity = capacity;
@@ -66,7 +70,8 @@ ring_array_init(ring_array * ra, uint32_t capacity, uint32_t bytesPerFrame,
}
for (unsigned int i = 0; i < ra->capacity; ++i) {
- if (single_audiobuffer_init(&ra->buffer_array[i], bytesPerFrame,
+ if (single_audiobuffer_init(&ra->buffer_array[i],
+ bytesPerFrame,
channelsPerFrame,
framesPerBuffer) != CUBEB_OK) {
return CUBEB_ERROR;
@@ -82,7 +87,7 @@ void
ring_array_destroy(ring_array * ra)
{
assert(ra);
- if (ra->buffer_array == NULL) {
+ if (ra->buffer_array == NULL){
return;
}
for (unsigned int i = 0; i < ra->capacity; ++i) {
@@ -90,13 +95,12 @@ ring_array_destroy(ring_array * ra)
operator delete(ra->buffer_array[i].mData);
}
}
- delete[] ra->buffer_array;
+ delete [] ra->buffer_array;
}
/** Get the allocated buffer to be stored with fresh data.
@param ra The ring_array pointer.
- @retval Pointer of the allocated space to be stored with fresh data or NULL
- if full. */
+ @retval Pointer of the allocated space to be stored with fresh data or NULL if full. */
AudioBuffer *
ring_array_get_free_buffer(ring_array * ra)
{
@@ -152,4 +156,4 @@ ring_array_get_dummy_buffer(ring_array * ra)
return &ra->buffer_array[0];
}
-#endif // CUBEB_RING_ARRAY_H
+#endif //CUBEB_RING_ARRAY_H