aboutsummaryrefslogtreecommitdiffstats
path: root/src/output/osx_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/osx_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/osx_plugin.c')
-rw-r--r--src/output/osx_plugin.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/output/osx_plugin.c b/src/output/osx_plugin.c
index a3f67fa68..a31a6e736 100644
--- a/src/output/osx_plugin.c
+++ b/src/output/osx_plugin.c
@@ -49,7 +49,7 @@ static OsxData *newOsxData()
return ret;
}
-static int osx_testDefault()
+static bool osx_testDefault()
{
/*AudioUnit au;
ComponentDescription desc;
@@ -74,7 +74,7 @@ static int osx_testDefault()
CloseComponent(au); */
- return 0;
+ return true;
}
static int osx_initDriver(struct audio_output *audioOutput,
@@ -212,8 +212,9 @@ static OSStatus osx_render(void *vdata,
return 0;
}
-static int osx_openDevice(struct audio_output *audioOutput,
- struct audio_format *audioFormat)
+static bool
+osx_openDevice(struct audio_output *audioOutput,
+ struct audio_format *audioFormat)
{
OsxData *od = (OsxData *) audioOutput->data;
ComponentDescription desc;
@@ -230,18 +231,18 @@ static int osx_openDevice(struct audio_output *audioOutput,
comp = FindNextComponent(NULL, &desc);
if (comp == 0) {
ERROR("Error finding OS X component\n");
- return -1;
+ return false;
}
if (OpenAComponent(comp, &od->au) != noErr) {
ERROR("Unable to open OS X component\n");
- return -1;
+ return false;
}
if (AudioUnitInitialize(od->au) != 0) {
CloseComponent(od->au);
ERROR("Unable to initialize OS X audio unit\n");
- return -1;
+ return false;
}
callback.inputProc = osx_render;
@@ -253,7 +254,7 @@ static int osx_openDevice(struct audio_output *audioOutput,
AudioUnitUninitialize(od->au);
CloseComponent(od->au);
ERROR("unable to set callback for OS X audio unit\n");
- return -1;
+ return false;
}
streamDesc.mSampleRate = audioFormat->sample_rate;
@@ -275,7 +276,7 @@ static int osx_openDevice(struct audio_output *audioOutput,
AudioUnitUninitialize(od->au);
CloseComponent(od->au);
ERROR("Unable to set format on OS X device\n");
- return -1;
+ return false;
}
/* create a buffer of 1s */
@@ -286,11 +287,11 @@ static int osx_openDevice(struct audio_output *audioOutput,
od->pos = 0;
od->len = 0;
- return 0;
+ return true;
}
-static int osx_play(struct audio_output *audioOutput,
- const char *playChunk, size_t size)
+static bool
+osx_play(struct audio_output *audioOutput, const char *playChunk, size_t size)
{
OsxData *od = (OsxData *) audioOutput->data;
size_t bytesToCopy;
@@ -304,7 +305,7 @@ static int osx_play(struct audio_output *audioOutput,
err = AudioOutputUnitStart(od->au);
if (err) {
ERROR("unable to start audio output: %i\n", err);
- return -1;
+ return false;
}
}
@@ -345,7 +346,7 @@ static int osx_play(struct audio_output *audioOutput,
pthread_mutex_unlock(&od->mutex);
/* DEBUG("osx_play: leave\n"); */
- return 0;
+ return true;
}
const struct audio_output_plugin osxPlugin = {