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
This commit is contained in:
Michael Sevakis 2012-03-04 14:44:43 -05:00
parent 534117d1e0
commit d18a5cad7f
13 changed files with 39 additions and 32 deletions

View file

@ -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;
}