summaryrefslogtreecommitdiffstats
path: root/apps/voice_thread.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2012-03-04 14:44:43 -0500
committerMichael Sevakis <jethead71@rockbox.org>2012-03-04 14:50:47 -0500
commitd18a5cad7f002b2f67385e57118048ea3db185a6 (patch)
tree61b8eafcf9d0197a8bc1f6c795c775f9170a4f64 /apps/voice_thread.c
parent534117d1e0d01b78d0ab9040e64fbd88213cd805 (diff)
downloadrockbox-d18a5cad7f002b2f67385e57118048ea3db185a6.tar.gz
rockbox-d18a5cad7f002b2f67385e57118048ea3db185a6.zip
Tweak paramters of mp3_play_data and callback.
Use generic void * and size_t and make mp3_play_data and its callback agree on types. Use mp3_play_callback_t instead of prototyping right in the function call (so it's not so messy to look at). Change doesn't appear to require plugin API version increment. Change-Id: Idcab2740ee316a2beb6e0a87b8f4934d9d6b3dd8
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
struct voice_info
{
/* Callback to get more clips */
- void (*get_more)(unsigned char** start, size_t* size);
+ mp3_play_callback_t get_more;
/* Start of clip */
- unsigned char *start;
+ const void *start;
/* Size of clip */
size_t size;
};
@@ -200,15 +200,15 @@ static void voice_buf_commit(size_t size)
}
/* Stop any current clip and start playing a new one */
-void mp3_play_data(const unsigned char* start, int size,
- void (*get_more)(unsigned char** start, size_t* size))
+void mp3_play_data(const void *start, size_t size,
+ mp3_play_callback_t get_more)
{
- if (get_more != NULL && start != NULL && (ssize_t)size > 0)
+ if (get_more != NULL && start != NULL && size > 0)
{
struct voice_info voice_clip =
{
.get_more = get_more,
- .start = (unsigned char *)start,
+ .start = start,
.size = size,
};
@@ -312,7 +312,8 @@ static enum voice_state voice_message(struct voice_thread_data *td)
td->st = speex_decoder_init(&speex_wb_mode);
/* Make bit buffer use our own buffer */
- speex_bits_set_bit_buffer(&td->bits, td->vi.start, td->vi.size);
+ speex_bits_set_bit_buffer(&td->bits, (void *)td->vi.start,
+ td->vi.size);
speex_decoder_ctl(td->st, SPEEX_GET_LOOKAHEAD, &td->lookahead);
return VOICE_STATE_DECODE;
@@ -361,10 +362,11 @@ static enum voice_state voice_decode(struct voice_thread_data *td)
if (td->vi.get_more != NULL)
td->vi.get_more(&td->vi.start, &td->vi.size);
- if (td->vi.start != NULL && (ssize_t)td->vi.size > 0)
+ if (td->vi.start != NULL && td->vi.size > 0)
{
/* Make bit buffer use our own buffer */
- speex_bits_set_bit_buffer(&td->bits, td->vi.start, td->vi.size);
+ speex_bits_set_bit_buffer(&td->bits, (void *)td->vi.start,
+ td->vi.size);
/* Don't skip any samples when we're stringing clips together */
td->lookahead = 0;
}