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:
parent
8936789631
commit
92f1bb82f7
@ -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
|
||||
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user