diff options
Diffstat (limited to '')
-rw-r--r-- | src/audioOutputs/audioOutput_osx.c | 20 |
1 files changed, 19 insertions, 1 deletions
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, |