summaryrefslogtreecommitdiff
path: root/apps/voice_thread.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/voice_thread.c')
-rw-r--r--apps/voice_thread.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/apps/voice_thread.c b/apps/voice_thread.c
index 5d23a74cbc..56d67a2284 100644
--- a/apps/voice_thread.c
+++ b/apps/voice_thread.c
@@ -117,9 +117,9 @@ enum voice_thread_messages
117struct voice_info 117struct voice_info
118{ 118{
119 /* Callback to get more clips */ 119 /* Callback to get more clips */
120 void (*get_more)(unsigned char** start, size_t* size); 120 mp3_play_callback_t get_more;
121 /* Start of clip */ 121 /* Start of clip */
122 unsigned char *start; 122 const void *start;
123 /* Size of clip */ 123 /* Size of clip */
124 size_t size; 124 size_t size;
125}; 125};
@@ -200,15 +200,15 @@ static void voice_buf_commit(size_t size)
200} 200}
201 201
202/* Stop any current clip and start playing a new one */ 202/* Stop any current clip and start playing a new one */
203void mp3_play_data(const unsigned char* start, int size, 203void mp3_play_data(const void *start, size_t size,
204 void (*get_more)(unsigned char** start, size_t* size)) 204 mp3_play_callback_t get_more)
205{ 205{
206 if (get_more != NULL && start != NULL && (ssize_t)size > 0) 206 if (get_more != NULL && start != NULL && size > 0)
207 { 207 {
208 struct voice_info voice_clip = 208 struct voice_info voice_clip =
209 { 209 {
210 .get_more = get_more, 210 .get_more = get_more,
211 .start = (unsigned char *)start, 211 .start = start,
212 .size = size, 212 .size = size,
213 }; 213 };
214 214
@@ -312,7 +312,8 @@ static enum voice_state voice_message(struct voice_thread_data *td)
312 td->st = speex_decoder_init(&speex_wb_mode); 312 td->st = speex_decoder_init(&speex_wb_mode);
313 313
314 /* Make bit buffer use our own buffer */ 314 /* Make bit buffer use our own buffer */
315 speex_bits_set_bit_buffer(&td->bits, td->vi.start, td->vi.size); 315 speex_bits_set_bit_buffer(&td->bits, (void *)td->vi.start,
316 td->vi.size);
316 speex_decoder_ctl(td->st, SPEEX_GET_LOOKAHEAD, &td->lookahead); 317 speex_decoder_ctl(td->st, SPEEX_GET_LOOKAHEAD, &td->lookahead);
317 318
318 return VOICE_STATE_DECODE; 319 return VOICE_STATE_DECODE;
@@ -361,10 +362,11 @@ static enum voice_state voice_decode(struct voice_thread_data *td)
361 if (td->vi.get_more != NULL) 362 if (td->vi.get_more != NULL)
362 td->vi.get_more(&td->vi.start, &td->vi.size); 363 td->vi.get_more(&td->vi.start, &td->vi.size);
363 364
364 if (td->vi.start != NULL && (ssize_t)td->vi.size > 0) 365 if (td->vi.start != NULL && td->vi.size > 0)
365 { 366 {
366 /* Make bit buffer use our own buffer */ 367 /* Make bit buffer use our own buffer */
367 speex_bits_set_bit_buffer(&td->bits, td->vi.start, td->vi.size); 368 speex_bits_set_bit_buffer(&td->bits, (void *)td->vi.start,
369 td->vi.size);
368 /* Don't skip any samples when we're stringing clips together */ 370 /* Don't skip any samples when we're stringing clips together */
369 td->lookahead = 0; 371 td->lookahead = 0;
370 } 372 }