00001 /* Copyright (C) 2007 Jean-Marc Valin 00002 00003 File: speex_buffer.h 00004 This is a very simple ring buffer implementation. It is not thread-safe 00005 so you need to do your own locking. 00006 00007 Redistribution and use in source and binary forms, with or without 00008 modification, are permitted provided that the following conditions are 00009 met: 00010 00011 1. Redistributions of source code must retain the above copyright notice, 00012 this list of conditions and the following disclaimer. 00013 00014 2. Redistributions in binary form must reproduce the above copyright 00015 notice, this list of conditions and the following disclaimer in the 00016 documentation and/or other materials provided with the distribution. 00017 00018 3. The name of the author may not be used to endorse or promote products 00019 derived from this software without specific prior written permission. 00020 00021 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 00022 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00023 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00024 DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 00025 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00026 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00027 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00028 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 00029 STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00030 ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00031 POSSIBILITY OF SUCH DAMAGE. 00032 */ 00033 00034 #ifndef SPEEX_BUFFER_H 00035 #define SPEEX_BUFFER_H 00036 00037 #include "speex/speex_types.h" 00038 00039 #ifdef __cplusplus 00040 extern "C" { 00041 #endif 00042 00043 struct SpeexBuffer_; 00044 typedef struct SpeexBuffer_ SpeexBuffer; 00045 00046 SpeexBuffer *speex_buffer_init(int size); 00047 00048 void speex_buffer_destroy(SpeexBuffer *st); 00049 00050 int speex_buffer_write(SpeexBuffer *st, void *data, int len); 00051 00052 int speex_buffer_writezeros(SpeexBuffer *st, int len); 00053 00054 int speex_buffer_read(SpeexBuffer *st, void *data, int len); 00055 00056 int speex_buffer_get_available(SpeexBuffer *st); 00057 00058 int speex_buffer_resize(SpeexBuffer *st, int len); 00059 00060 #ifdef __cplusplus 00061 } 00062 #endif 00063 00064 #endif 00065 00066 00067 00068