Lines Matching refs:st
53 SpeexBuffer *st = speex_alloc(sizeof(SpeexBuffer)); in speex_buffer_init() local
54 st->data = speex_alloc(size); in speex_buffer_init()
55 st->size = size; in speex_buffer_init()
56 st->read_ptr = 0; in speex_buffer_init()
57 st->write_ptr = 0; in speex_buffer_init()
58 st->available = 0; in speex_buffer_init()
59 return st; in speex_buffer_init()
62 EXPORT void speex_buffer_destroy(SpeexBuffer *st) in speex_buffer_destroy() argument
64 speex_free(st->data); in speex_buffer_destroy()
65 speex_free(st); in speex_buffer_destroy()
68 EXPORT int speex_buffer_write(SpeexBuffer *st, void *_data, int len) in speex_buffer_write() argument
73 if (len > st->size) in speex_buffer_write()
75 data += len-st->size; in speex_buffer_write()
76 len = st->size; in speex_buffer_write()
78 end = st->write_ptr + len; in speex_buffer_write()
80 if (end1 > st->size) in speex_buffer_write()
81 end1 = st->size; in speex_buffer_write()
82 SPEEX_COPY(st->data + st->write_ptr, data, end1 - st->write_ptr); in speex_buffer_write()
83 if (end > st->size) in speex_buffer_write()
85 end -= st->size; in speex_buffer_write()
86 SPEEX_COPY(st->data, data+end1 - st->write_ptr, end); in speex_buffer_write()
88 st->available += len; in speex_buffer_write()
89 if (st->available > st->size) in speex_buffer_write()
91 st->available = st->size; in speex_buffer_write()
92 st->read_ptr = st->write_ptr; in speex_buffer_write()
94 st->write_ptr += len; in speex_buffer_write()
95 if (st->write_ptr > st->size) in speex_buffer_write()
96 st->write_ptr -= st->size; in speex_buffer_write()
100 EXPORT int speex_buffer_writezeros(SpeexBuffer *st, int len) in speex_buffer_writezeros() argument
106 if (len > st->size) in speex_buffer_writezeros()
108 len = st->size; in speex_buffer_writezeros()
110 end = st->write_ptr + len; in speex_buffer_writezeros()
112 if (end1 > st->size) in speex_buffer_writezeros()
113 end1 = st->size; in speex_buffer_writezeros()
114 SPEEX_MEMSET(st->data + st->write_ptr, 0, end1 - st->write_ptr); in speex_buffer_writezeros()
115 if (end > st->size) in speex_buffer_writezeros()
117 end -= st->size; in speex_buffer_writezeros()
118 SPEEX_MEMSET(st->data, 0, end); in speex_buffer_writezeros()
120 st->available += len; in speex_buffer_writezeros()
121 if (st->available > st->size) in speex_buffer_writezeros()
123 st->available = st->size; in speex_buffer_writezeros()
124 st->read_ptr = st->write_ptr; in speex_buffer_writezeros()
126 st->write_ptr += len; in speex_buffer_writezeros()
127 if (st->write_ptr > st->size) in speex_buffer_writezeros()
128 st->write_ptr -= st->size; in speex_buffer_writezeros()
132 EXPORT int speex_buffer_read(SpeexBuffer *st, void *_data, int len) in speex_buffer_read() argument
136 if (len > st->available) in speex_buffer_read()
138 SPEEX_MEMSET(data+st->available, 0, st->size-st->available); in speex_buffer_read()
139 len = st->available; in speex_buffer_read()
141 end = st->read_ptr + len; in speex_buffer_read()
143 if (end1 > st->size) in speex_buffer_read()
144 end1 = st->size; in speex_buffer_read()
145 SPEEX_COPY(data, st->data + st->read_ptr, end1 - st->read_ptr); in speex_buffer_read()
147 if (end > st->size) in speex_buffer_read()
149 end -= st->size; in speex_buffer_read()
150 SPEEX_COPY(data+end1 - st->read_ptr, st->data, end); in speex_buffer_read()
152 st->available -= len; in speex_buffer_read()
153 st->read_ptr += len; in speex_buffer_read()
154 if (st->read_ptr > st->size) in speex_buffer_read()
155 st->read_ptr -= st->size; in speex_buffer_read()
159 EXPORT int speex_buffer_get_available(SpeexBuffer *st) in speex_buffer_get_available() argument
161 return st->available; in speex_buffer_get_available()
164 EXPORT int speex_buffer_resize(SpeexBuffer *st, int len) in speex_buffer_resize() argument
166 int old_len = st->size; in speex_buffer_resize()
169 st->data = speex_realloc(st->data, len); in speex_buffer_resize()
173 st->data = speex_realloc(st->data, len); in speex_buffer_resize()