aboutsummaryrefslogtreecommitdiffstats
path: root/src/output/ao_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-29 20:40:27 +0100
committerMax Kellermann <max@duempel.org>2008-10-29 20:40:27 +0100
commit58c5bee9f0bcb46da7d113b66a4e1e2d7add9837 (patch)
tree4517d2156aa3643247e7f2fc886af86d3dfd8791 /src/output/ao_plugin.c
parent03390d8be1cb8983778faf6eedb9bcfd26a6dbce (diff)
downloadmpd-58c5bee9f0bcb46da7d113b66a4e1e2d7add9837.tar.gz
mpd-58c5bee9f0bcb46da7d113b66a4e1e2d7add9837.tar.xz
mpd-58c5bee9f0bcb46da7d113b66a4e1e2d7add9837.zip
output: use bool for return values and flags
Don't return 0/-1 on success/error, but true/false. Instead of int, use bool for storing flags.
Diffstat (limited to 'src/output/ao_plugin.c')
-rw-r--r--src/output/ao_plugin.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/output/ao_plugin.c b/src/output/ao_plugin.c
index b5cebc93b..d2c7dab6e 100644
--- a/src/output/ao_plugin.c
+++ b/src/output/ao_plugin.c
@@ -168,8 +168,8 @@ static void audioOutputAo_closeDevice(void *data)
}
}
-static int audioOutputAo_openDevice(void *data,
- struct audio_format *audio_format)
+static bool
+audioOutputAo_openDevice(void *data, struct audio_format *audio_format)
{
ao_sample_format format;
AoData *ad = (AoData *)data;
@@ -186,9 +186,9 @@ static int audioOutputAo_openDevice(void *data,
ad->device = ao_open_live(ad->driverId, &format, ad->options);
if (ad->device == NULL)
- return -1;
+ return false;
- return 0;
+ return true;
}
/**
@@ -208,13 +208,14 @@ static int ao_play_deconst(ao_device *device, const void *output_samples,
return ao_play(device, u.out, num_bytes);
}
-static int audioOutputAo_play(void *data, const char *playChunk, size_t size)
+static bool
+audioOutputAo_play(void *data, const char *playChunk, size_t size)
{
AoData *ad = (AoData *)data;
size_t chunk_size;
if (ad->device == NULL)
- return -1;
+ return false;
while (size > 0) {
chunk_size = (size_t)ad->writeSize > size
@@ -224,14 +225,14 @@ static int audioOutputAo_play(void *data, const char *playChunk, size_t size)
audioOutputAo_error();
ERROR("closing audio device due to write error\n");
audioOutputAo_closeDevice(ad);
- return -1;
+ return false;
}
playChunk += chunk_size;
size -= chunk_size;
}
- return 0;
+ return true;
}
const struct audio_output_plugin aoPlugin = {