speex_buffer.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* Copyright (C) 2007 Jean-Marc Valin
  2. File: speex_buffer.h
  3. This is a very simple ring buffer implementation. It is not thread-safe
  4. so you need to do your own locking.
  5. Redistribution and use in source and binary forms, with or without
  6. modification, are permitted provided that the following conditions are
  7. met:
  8. 1. Redistributions of source code must retain the above copyright notice,
  9. this list of conditions and the following disclaimer.
  10. 2. Redistributions in binary form must reproduce the above copyright
  11. notice, this list of conditions and the following disclaimer in the
  12. documentation and/or other materials provided with the distribution.
  13. 3. The name of the author may not be used to endorse or promote products
  14. derived from this software without specific prior written permission.
  15. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  16. IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  17. OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  18. DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
  19. INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  20. (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  21. SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  22. HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  23. STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  24. ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  25. POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. #ifndef SPEEX_BUFFER_H
  28. #define SPEEX_BUFFER_H
  29. #include "speex/speex_types.h"
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33. struct SpeexBuffer_;
  34. typedef struct SpeexBuffer_ SpeexBuffer;
  35. SpeexBuffer *speex_buffer_init(int size);
  36. void speex_buffer_destroy(SpeexBuffer *st);
  37. int speex_buffer_write(SpeexBuffer *st, void *data, int len);
  38. int speex_buffer_writezeros(SpeexBuffer *st, int len);
  39. int speex_buffer_read(SpeexBuffer *st, void *data, int len);
  40. int speex_buffer_get_available(SpeexBuffer *st);
  41. int speex_buffer_resize(SpeexBuffer *st, int len);
  42. #ifdef __cplusplus
  43. }
  44. #endif
  45. #endif