aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--configure.ac1
-rw-r--r--src/audioOutputs/audioOutput_osx.c20
2 files changed, 20 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index a21304503..c405448a1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -106,6 +106,7 @@ enable_osx=no
case $host in
*-darwin*)
AC_DEFINE(HAVE_OSX, 1, [Define for compiling OS X support])
+ MPD_LIBS="$MPD_LIBS -framework CoreAudio"
enable_osx=yes ;;
esac
diff --git a/src/audioOutputs/audioOutput_osx.c b/src/audioOutputs/audioOutput_osx.c
index d4b3401a1..fc5ae13b9 100644
--- a/src/audioOutputs/audioOutput_osx.c
+++ b/src/audioOutputs/audioOutput_osx.c
@@ -23,9 +23,11 @@
#include "../conf.h"
#include "../log.h"
+#include <CoreAudio/AudioHardware.h>
#include <stdlib.h>
typedef struct _OsxData {
+ AudioDeviceID deviceID;
} OsxData;
static OsxData * newOsxData() {
@@ -34,6 +36,22 @@ static OsxData * newOsxData() {
return ret;
}
+static int osx_testDefault() {
+ int err;
+ AudioDeviceID deviceID;
+ UInt32 propertySize = sizeof(deviceID);
+
+ err = AudioHardwareGetProperty(
+ kAudioHardwarePropertyDefaultOutputDevice,
+ &propertySize, &deviceID);
+ if(err || deviceID == kAudioDeviceUnknown) {
+ WARNING("Not able to get the default OS X device\n");
+ return -1;
+ }
+
+ return 0;
+}
+
static int osx_initDriver(AudioOutput * audioOutput, ConfigParam * param) {
OsxData * od = newOsxData();
@@ -79,7 +97,7 @@ static int osx_play(AudioOutput * audioOutput, char * playChunk, int size) {
AudioOutputPlugin osxPlugin =
{
"osx",
- NULL,
+ osx_testDefault,
osx_initDriver,
osx_finishDriver,
osx_openDevice,