some broken OS X stuff

git-svn-id: https://svn.musicpd.org/mpd/trunk@3075 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
Warren Dukes 2005-03-13 21:33:55 +00:00
parent 8936789631
commit 92f1bb82f7
2 changed files with 20 additions and 1 deletions

View File

@ -106,6 +106,7 @@ enable_osx=no
case $host in case $host in
*-darwin*) *-darwin*)
AC_DEFINE(HAVE_OSX, 1, [Define for compiling OS X support]) AC_DEFINE(HAVE_OSX, 1, [Define for compiling OS X support])
MPD_LIBS="$MPD_LIBS -framework CoreAudio"
enable_osx=yes ;; enable_osx=yes ;;
esac esac

View File

@ -23,9 +23,11 @@
#include "../conf.h" #include "../conf.h"
#include "../log.h" #include "../log.h"
#include <CoreAudio/AudioHardware.h>
#include <stdlib.h> #include <stdlib.h>
typedef struct _OsxData { typedef struct _OsxData {
AudioDeviceID deviceID;
} OsxData; } OsxData;
static OsxData * newOsxData() { static OsxData * newOsxData() {
@ -34,6 +36,22 @@ static OsxData * newOsxData() {
return ret; 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) { static int osx_initDriver(AudioOutput * audioOutput, ConfigParam * param) {
OsxData * od = newOsxData(); OsxData * od = newOsxData();
@ -79,7 +97,7 @@ static int osx_play(AudioOutput * audioOutput, char * playChunk, int size) {
AudioOutputPlugin osxPlugin = AudioOutputPlugin osxPlugin =
{ {
"osx", "osx",
NULL, osx_testDefault,
osx_initDriver, osx_initDriver,
osx_finishDriver, osx_finishDriver,
osx_openDevice, osx_openDevice,