output: pass the music chunk pointer as void*, not char*
The meaning of the chunk depends on the audio format; don't suggest a specific format by declaring the pointer as "char*", pass "void*" instead.
This commit is contained in:
parent
5a898c15e7
commit
a4dfab2aee
|
@ -442,7 +442,7 @@ alsa_close(void *data)
|
|||
}
|
||||
|
||||
static size_t
|
||||
alsa_play(void *data, const char *chunk, size_t size)
|
||||
alsa_play(void *data, const void *chunk, size_t size)
|
||||
{
|
||||
struct alsa_data *ad = data;
|
||||
int ret;
|
||||
|
|
|
@ -209,7 +209,7 @@ static int ao_play_deconst(ao_device *device, const void *output_samples,
|
|||
}
|
||||
|
||||
static size_t
|
||||
audioOutputAo_play(void *data, const char *playChunk, size_t size)
|
||||
audioOutputAo_play(void *data, const void *chunk, size_t size)
|
||||
{
|
||||
AoData *ad = (AoData *)data;
|
||||
|
||||
|
@ -219,7 +219,7 @@ audioOutputAo_play(void *data, const char *playChunk, size_t size)
|
|||
if (size > ad->writeSize)
|
||||
size = ad->writeSize;
|
||||
|
||||
if (ao_play_deconst(ad->device, playChunk, size) == 0) {
|
||||
if (ao_play_deconst(ad->device, chunk, size) == 0) {
|
||||
audioOutputAo_error("Closing libao device due to play error");
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -238,7 +238,7 @@ static void fifo_dropBufferedAudio(void *data)
|
|||
}
|
||||
|
||||
static size_t
|
||||
fifo_playAudio(void *data, const char *playChunk, size_t size)
|
||||
fifo_playAudio(void *data, const void *chunk, size_t size)
|
||||
{
|
||||
FifoData *fd = (FifoData *)data;
|
||||
ssize_t bytes;
|
||||
|
@ -251,7 +251,7 @@ fifo_playAudio(void *data, const char *playChunk, size_t size)
|
|||
timer_add(fd->timer, size);
|
||||
|
||||
while (true) {
|
||||
bytes = write(fd->output, playChunk, size);
|
||||
bytes = write(fd->output, chunk, size);
|
||||
if (bytes > 0)
|
||||
return (size_t)bytes;
|
||||
|
||||
|
|
|
@ -388,7 +388,7 @@ mpd_jack_write_samples(struct jack_data *jd, const void *src,
|
|||
}
|
||||
|
||||
static size_t
|
||||
mpd_jack_play(void *data, const char *buff, size_t size)
|
||||
mpd_jack_play(void *data, const void *chunk, size_t size)
|
||||
{
|
||||
struct jack_data *jd = data;
|
||||
const size_t frame_size = audio_format_frame_size(&jd->audio_format);
|
||||
|
@ -421,7 +421,7 @@ mpd_jack_play(void *data, const char *buff, size_t size)
|
|||
if (space < size)
|
||||
size = space;
|
||||
|
||||
mpd_jack_write_samples(jd, buff, size);
|
||||
mpd_jack_write_samples(jd, chunk, size);
|
||||
return size * frame_size;
|
||||
}
|
||||
|
||||
|
|
|
@ -249,7 +249,7 @@ static void mvp_dropBufferedAudio(void *data)
|
|||
}
|
||||
|
||||
static size_t
|
||||
mvp_playAudio(void *data, const char *playChunk, size_t size)
|
||||
mvp_playAudio(void *data, const void *chunk, size_t size)
|
||||
{
|
||||
MvpData *md = data;
|
||||
ssize_t ret;
|
||||
|
@ -259,7 +259,7 @@ mvp_playAudio(void *data, const char *playChunk, size_t size)
|
|||
mvp_openDevice(md, &md->audio_format);
|
||||
|
||||
while (true) {
|
||||
ret = write(md->fd, playChunk, size);
|
||||
ret = write(md->fd, chunk, size);
|
||||
if (ret > 0)
|
||||
return (size_t)ret;
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ null_close(void *data)
|
|||
}
|
||||
|
||||
static size_t
|
||||
null_play(void *data, G_GNUC_UNUSED const char *chunk, size_t size)
|
||||
null_play(void *data, G_GNUC_UNUSED const void *chunk, size_t size)
|
||||
{
|
||||
struct null_data *nd = data;
|
||||
Timer *timer = nd->timer;
|
||||
|
|
|
@ -554,7 +554,7 @@ static void oss_dropBufferedAudio(void *data)
|
|||
}
|
||||
|
||||
static size_t
|
||||
oss_playAudio(void *data, const char *playChunk, size_t size)
|
||||
oss_playAudio(void *data, const void *chunk, size_t size)
|
||||
{
|
||||
OssData *od = data;
|
||||
ssize_t ret;
|
||||
|
@ -564,7 +564,7 @@ oss_playAudio(void *data, const char *playChunk, size_t size)
|
|||
return false;
|
||||
|
||||
while (true) {
|
||||
ret = write(od->fd, playChunk, size);
|
||||
ret = write(od->fd, chunk, size);
|
||||
if (ret > 0)
|
||||
return (size_t)ret;
|
||||
|
||||
|
|
|
@ -257,7 +257,7 @@ osx_openDevice(void *data, struct audio_format *audioFormat)
|
|||
}
|
||||
|
||||
static size_t
|
||||
osx_play(void *data, const char *playChunk, size_t size)
|
||||
osx_play(void *data, const void *chunk, size_t size)
|
||||
{
|
||||
OsxData *od = data;
|
||||
size_t start, nbytes;
|
||||
|
@ -291,7 +291,7 @@ osx_play(void *data, const char *playChunk, size_t size)
|
|||
if (nbytes > size)
|
||||
nbytes = size;
|
||||
|
||||
memcpy(od->buffer + start, playChunk, nbytes);
|
||||
memcpy(od->buffer + start, chunk, nbytes);
|
||||
od->len += nbytes;
|
||||
|
||||
g_mutex_unlock(od->mutex);
|
||||
|
|
|
@ -161,12 +161,12 @@ static void pulse_close(void *data)
|
|||
}
|
||||
|
||||
static size_t
|
||||
pulse_play(void *data, const char *playChunk, size_t size)
|
||||
pulse_play(void *data, const void *chunk, size_t size)
|
||||
{
|
||||
struct pulse_data *pd = data;
|
||||
int error;
|
||||
|
||||
if (pa_simple_write(pd->s, playChunk, size, &error) < 0) {
|
||||
if (pa_simple_write(pd->s, chunk, size, &error) < 0) {
|
||||
g_warning("PulseAudio output \"%s\" disconnecting due to "
|
||||
"write error: %s\n",
|
||||
audio_output_get_name(pd->ao),
|
||||
|
|
|
@ -414,7 +414,7 @@ my_shout_open_device(void *data, struct audio_format *audio_format)
|
|||
}
|
||||
|
||||
static size_t
|
||||
my_shout_play(void *data, const char *chunk, size_t size)
|
||||
my_shout_play(void *data, const void *chunk, size_t size)
|
||||
{
|
||||
struct shout_data *sd = (struct shout_data *)data;
|
||||
bool ret;
|
||||
|
|
|
@ -103,7 +103,7 @@ audio_output_signal(struct audio_output *ao)
|
|||
}
|
||||
|
||||
void
|
||||
audio_output_play(struct audio_output *ao, const char *chunk, size_t size)
|
||||
audio_output_play(struct audio_output *ao, const void *chunk, size_t size)
|
||||
{
|
||||
assert(size > 0);
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ void
|
|||
audio_output_signal(struct audio_output *ao);
|
||||
|
||||
void
|
||||
audio_output_play(struct audio_output *ao, const char *chunk, size_t size);
|
||||
audio_output_play(struct audio_output *ao, const void *chunk, size_t size);
|
||||
|
||||
void audio_output_pause(struct audio_output *ao);
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ struct audio_output {
|
|||
*/
|
||||
union {
|
||||
struct {
|
||||
const char *data;
|
||||
const void *data;
|
||||
size_t size;
|
||||
} play;
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ struct audio_output_plugin {
|
|||
*
|
||||
* @return the number of bytes played, or 0 on error
|
||||
*/
|
||||
size_t (*play)(void *data, const char *chunk, size_t size);
|
||||
size_t (*play)(void *data, const void *chunk, size_t size);
|
||||
|
||||
/**
|
||||
* Try to cancel data which may still be in the device's
|
||||
|
|
Loading…
Reference in New Issue