diff options
author | Johns <johns98@gmx.net> | 2012-04-22 17:17:54 +0200 |
---|---|---|
committer | Johns <johns98@gmx.net> | 2012-04-22 17:17:54 +0200 |
commit | 207871fd9b534c896f604bdd2988580c8c8f9bc9 (patch) | |
tree | 44406b9f6f623e04801334060ac26fd77914ee50 /ringbuffer.c | |
parent | ebe0beb40048c90a8128cf81678bd2c250973a1e (diff) | |
download | vdr-plugin-softhddevice-207871fd9b534c896f604bdd2988580c8c8f9bc9.tar.gz vdr-plugin-softhddevice-207871fd9b534c896f604bdd2988580c8c8f9bc9.tar.bz2 |
Make audio ring buffer size a multiple of 3,5,7,8.
Diffstat (limited to 'ringbuffer.c')
-rw-r--r-- | ringbuffer.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/ringbuffer.c b/ringbuffer.c index 81722e2..9466852 100644 --- a/ringbuffer.c +++ b/ringbuffer.c @@ -49,6 +49,18 @@ struct _ring_buffer_ }; /** +** Reset ring buffer pointers. +** +** @param rb Ring buffer to reset read/write pointers. +*/ +void RingBufferReset(RingBuffer * rb) +{ + rb->ReadPointer = rb->Buffer; + rb->WritePointer = rb->Buffer; + atomic_set(&rb->Filled, 0); +} + +/** ** Allocate a new ring buffer. ** ** @param size Size of the ring buffer. @@ -69,10 +81,8 @@ RingBuffer *RingBufferNew(size_t size) } rb->Size = size; - rb->ReadPointer = rb->Buffer; - rb->WritePointer = rb->Buffer; rb->BufferEnd = rb->Buffer + size; - atomic_set(&rb->Filled, 0); + RingBufferReset(rb); return rb; } @@ -89,7 +99,7 @@ void RingBufferDel(RingBuffer * rb) /** ** Advance write pointer in ring buffer. ** -** @param rb Ring buffer to adance write pointer. +** @param rb Ring buffer to advance write pointer. ** @param cnt Number of bytes to be adavanced. ** ** @returns Number of bytes that could be advanced in ring buffer. @@ -198,7 +208,7 @@ size_t RingBufferGetWritePointer(RingBuffer * rb, void **wp) /** ** Advance read pointer in ring buffer. ** -** @param rb Ring buffer to adance read pointer. +** @param rb Ring buffer to advance read pointer. ** @param cnt Number of bytes to be advanced. ** ** @returns Number of bytes that could be advanced in ring buffer. |