diff options
author | Eric Wong <normalperson@yhbt.net> | 2008-09-01 20:13:37 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2008-09-01 20:13:37 -0700 |
commit | dd7f8a723efa9c9edce951981aef7f3adf814134 (patch) | |
tree | 1c442a63c257f53d0e3f1ff127b98e682c35c4d5 /src/audioOutputs/audioOutput_ao.c | |
parent | cf1f842a4c8f760c4c6a41f0dadc6c173a182d4f (diff) | |
parent | 925843cfedcde221207ec1ab78f778dab22325f9 (diff) | |
download | mpd-dd7f8a723efa9c9edce951981aef7f3adf814134.tar.gz mpd-dd7f8a723efa9c9edce951981aef7f3adf814134.tar.xz mpd-dd7f8a723efa9c9edce951981aef7f3adf814134.zip |
Merge branch 'ew/deconst'
* ew/deconst:
use deconst_ptr instead of duplicating deconst logic
provide a generic deconst_ptr function
Diffstat (limited to '')
-rw-r--r-- | src/audioOutputs/audioOutput_ao.c | 21 |
1 files changed, 3 insertions, 18 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); |