aboutsummaryrefslogtreecommitdiffstats
path: root/src/audioOutput_ao.c
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2004-10-28 05:14:55 +0000
committerWarren Dukes <warren.dukes@gmail.com>2004-10-28 05:14:55 +0000
commit58dbe4bb5d974c34335d6906a9ce930f07cd1db4 (patch)
tree9a6aee08b21100cb74e809f0620d81466f6067df /src/audioOutput_ao.c
parent8f40569aeeafe4a36e3d719c1df97de42606ea76 (diff)
downloadmpd-58dbe4bb5d974c34335d6906a9ce930f07cd1db4.tar.gz
mpd-58dbe4bb5d974c34335d6906a9ce930f07cd1db4.tar.xz
mpd-58dbe4bb5d974c34335d6906a9ce930f07cd1db4.zip
merge shank-rewrite-config changes
git-svn-id: https://svn.musicpd.org/mpd/trunk@2375 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r--src/audioOutput_ao.c41
1 files changed, 28 insertions, 13 deletions
diff --git a/src/audioOutput_ao.c b/src/audioOutput_ao.c
index 7c997c99e..60c4ea402 100644
--- a/src/audioOutput_ao.c
+++ b/src/audioOutput_ao.c
@@ -56,7 +56,9 @@ static void audioOutputAo_error() {
}
}
-static int audioOutputAo_initDriver(AudioOutput * audioOutput) {
+static int audioOutputAo_initDriver(AudioOutput * audioOutput,
+ ConfigParam * param)
+{
ao_info * ai;
char * dup;
char * stk1;
@@ -66,38 +68,51 @@ static int audioOutputAo_initDriver(AudioOutput * audioOutput) {
char * value;
char * test;
AoData * ad = newAoData();
+ BlockParam * blockParam;
audioOutput->data = ad;
- ad->writeSize = strtol((getConf())[CONF_AUDIO_WRITE_SIZE],&test,10);
- if (*test!='\0') {
- ERROR("\"%s\" is not a valid write size\n",
- (getConf())[CONF_AUDIO_WRITE_SIZE]);
- exit(EXIT_FAILURE);
+ if((blockParam = getBlockParam(param, "write_size"))) {
+ ad->writeSize = strtol(blockParam->value, &test, 10);
+ if (*test!='\0') {
+ ERROR("\"%s\" is not a valid write size at line %i\n",
+ blockParam->value, blockParam->line);
+ exit(EXIT_FAILURE);
+ }
}
+ else ad->writeSize = 1024;
if(driverInitCount == 0) {
ao_initialize();
}
driverInitCount++;
-
- if(strcmp(AUDIO_AO_DRIVER_DEFAULT,(getConf())[CONF_AO_DRIVER])==0) {
+
+ blockParam = getBlockParam(param, "driver");
+
+ if(!blockParam || 0 == strcmp(blockParam->value,"default")) {
ad->driverId = ao_default_driver_id();
}
else if((ad->driverId =
- ao_driver_id((getConf())[CONF_AO_DRIVER]))<0) {
- ERROR("\"%s\" is not a valid ao driver\n",
- (getConf())[CONF_AO_DRIVER]);
+ ao_driver_id(blockParam->value))<0) {
+ ERROR("\"%s\" is not a valid ao driver at line %i\n",
+ blockParam->value, blockParam->line);
exit(EXIT_FAILURE);
}
if((ai = ao_driver_info(ad->driverId))==NULL) {
- ERROR("problems getting ao_driver_info\n");
+ ERROR("problems getting driver info for device defined at "
+ "line %i\n", param->line);
ERROR("you may not have permission to the audio device\n");
exit(EXIT_FAILURE);
}
- dup = strdup((getConf())[CONF_AO_DRIVER_OPTIONS]);
+ blockParam = getBlockParam(param, "options");
+
+ if(blockParam) {
+ dup = strdup(blockParam->value);
+ }
+ else dup = strdup("");
+
if(strlen(dup)) {
stk1 = NULL;
n1 = strtok_r(dup,";",&stk1);