From a4dfab2aee0650970af4244c8f4b6c4d738d6c0c Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 23 Feb 2009 09:34:26 +0100 Subject: [PATCH] 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. --- src/output/alsa_plugin.c | 2 +- src/output/ao_plugin.c | 4 ++-- src/output/fifo_plugin.c | 4 ++-- src/output/jack_plugin.c | 4 ++-- src/output/mvp_plugin.c | 4 ++-- src/output/null_plugin.c | 2 +- src/output/oss_plugin.c | 4 ++-- src/output/osx_plugin.c | 4 ++-- src/output/pulse_plugin.c | 4 ++-- src/output/shout_plugin.c | 2 +- src/output_control.c | 2 +- src/output_control.h | 2 +- src/output_internal.h | 2 +- src/output_plugin.h | 2 +- 14 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/output/alsa_plugin.c b/src/output/alsa_plugin.c index 05e097513..42d1c6abb 100644 --- a/src/output/alsa_plugin.c +++ b/src/output/alsa_plugin.c @@ -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; diff --git a/src/output/ao_plugin.c b/src/output/ao_plugin.c index c9d10174e..ca790e879 100644 --- a/src/output/ao_plugin.c +++ b/src/output/ao_plugin.c @@ -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; } diff --git a/src/output/fifo_plugin.c b/src/output/fifo_plugin.c index 1be0f2a7d..891412882 100644 --- a/src/output/fifo_plugin.c +++ b/src/output/fifo_plugin.c @@ -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; diff --git a/src/output/jack_plugin.c b/src/output/jack_plugin.c index 22841f8ef..883695f5f 100644 --- a/src/output/jack_plugin.c +++ b/src/output/jack_plugin.c @@ -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; } diff --git a/src/output/mvp_plugin.c b/src/output/mvp_plugin.c index 840661ea7..5bc329785 100644 --- a/src/output/mvp_plugin.c +++ b/src/output/mvp_plugin.c @@ -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; diff --git a/src/output/null_plugin.c b/src/output/null_plugin.c index 2506feb74..a60d2b51a 100644 --- a/src/output/null_plugin.c +++ b/src/output/null_plugin.c @@ -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; diff --git a/src/output/oss_plugin.c b/src/output/oss_plugin.c index eca6f9101..6c3928629 100644 --- a/src/output/oss_plugin.c +++ b/src/output/oss_plugin.c @@ -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; diff --git a/src/output/osx_plugin.c b/src/output/osx_plugin.c index ffeb8cd5e..b9fb8c15b 100644 --- a/src/output/osx_plugin.c +++ b/src/output/osx_plugin.c @@ -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); diff --git a/src/output/pulse_plugin.c b/src/output/pulse_plugin.c index 0203310e7..b969f3500 100644 --- a/src/output/pulse_plugin.c +++ b/src/output/pulse_plugin.c @@ -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), diff --git a/src/output/shout_plugin.c b/src/output/shout_plugin.c index 2563e8092..425c693f7 100644 --- a/src/output/shout_plugin.c +++ b/src/output/shout_plugin.c @@ -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; diff --git a/src/output_control.c b/src/output_control.c index 16908f1b4..5516af607 100644 --- a/src/output_control.c +++ b/src/output_control.c @@ -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); diff --git a/src/output_control.h b/src/output_control.h index 559a9ff15..c187a8c91 100644 --- a/src/output_control.h +++ b/src/output_control.h @@ -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); diff --git a/src/output_internal.h b/src/output_internal.h index 7d02ea679..c5ed7652a 100644 --- a/src/output_internal.h +++ b/src/output_internal.h @@ -113,7 +113,7 @@ struct audio_output { */ union { struct { - const char *data; + const void *data; size_t size; } play; diff --git a/src/output_plugin.h b/src/output_plugin.h index 8a2bcadac..08d04d87f 100644 --- a/src/output_plugin.h +++ b/src/output_plugin.h @@ -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