From 92f1bb82f7d9b7df73f4f3e09abc97d5fe8e229c Mon Sep 17 00:00:00 2001 From: Warren Dukes Date: Sun, 13 Mar 2005 21:33:55 +0000 Subject: some broken OS X stuff git-svn-id: https://svn.musicpd.org/mpd/trunk@3075 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- configure.ac | 1 + src/audioOutputs/audioOutput_osx.c | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) 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 #include 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, -- cgit v1.2.3