aboutsummaryrefslogtreecommitdiffstats
path: root/src/audioOutputs
diff options
context:
space:
mode:
Diffstat (limited to 'src/audioOutputs')
-rw-r--r--src/audioOutputs/audioOutput_ao.c21
-rw-r--r--src/audioOutputs/audioOutput_shout.c12
2 files changed, 9 insertions, 24 deletions
diff --git a/src/audioOutputs/audioOutput_ao.c b/src/audioOutputs/audioOutput_ao.c
index e7e201add..ed8eaa796 100644
--- a/src/audioOutputs/audioOutput_ao.c
+++ b/src/audioOutputs/audioOutput_ao.c
@@ -199,23 +199,6 @@ static int audioOutputAo_openDevice(AudioOutput * audioOutput)
return 0;
}
-/**
- * For whatever reason, libao wants a non-const pointer. Let's hope
- * it does not write to the buffer, and use the union deconst hack to
- * work around this API misdesign.
- */
-static int ao_play_deconst(ao_device *device, const void *output_samples,
- uint_32 num_bytes)
-{
- union {
- const void *in;
- void *out;
- } u;
-
- u.in = output_samples;
- return ao_play(device, u.out, num_bytes);
-}
-
static int audioOutputAo_play(AudioOutput * audioOutput,
const char *playChunk, size_t size)
{
@@ -229,7 +212,9 @@ static int audioOutputAo_play(AudioOutput * audioOutput,
chunk_size = (size_t)ad->writeSize > size
? size : (size_t)ad->writeSize;
- if (ao_play_deconst(ad->device, playChunk, chunk_size) == 0) {
+ if (!ao_play(ad->device,
+ (char *)deconst_ptr(playChunk),
+ (uint_32)chunk_size)) {
audioOutputAo_error();
ERROR("closing audio device due to write error\n");
audioOutputAo_closeDevice(audioOutput);
diff --git a/src/audioOutputs/audioOutput_shout.c b/src/audioOutputs/audioOutput_shout.c
index 49d69eebd..c1f784986 100644
--- a/src/audioOutputs/audioOutput_shout.c
+++ b/src/audioOutputs/audioOutput_shout.c
@@ -390,11 +390,10 @@ static void myShout_closeDevice(AudioOutput * audioOutput)
static void addTag(ShoutData *sd, const char *name, char *value)
{
- if (value) {
- union const_hack u;
- u.in = name;
- vorbis_comment_add_tag(&(sd->vc), u.out, value);
- }
+ if (value)
+ vorbis_comment_add_tag(&(sd->vc),
+ (char *)deconst_ptr(name),
+ value);
}
static void copyTagToVorbisComment(ShoutData * sd)
@@ -637,7 +636,8 @@ static int myShout_play(AudioOutput * audioOutput,
for (i = 0; i < samples; i++) {
for (j = 0; j < sd->audioFormat->channels; j++) {
- vorbbuf[j][i] = (*((mpd_sint16 *) playChunk)) / 32768.0;
+ vorbbuf[j][i] =
+ (*((mpd_sint16 *)deconst_ptr(playChunk))) / 32768.0;
playChunk += bytes;
}
}