audio: output selection functionality

This commit is contained in:
James Laird
2013-04-01 21:43:24 +11:00
parent 86e94064c0
commit 9b33878c59
8 changed files with 84 additions and 20 deletions
+40
View File
@@ -0,0 +1,40 @@
#include <stdio.h>
#include <string.h>
#include "audio.h"
#include "config.h"
#ifdef CONFIG_AO
extern audio_output audio_ao;
#endif
extern audio_output audio_dummy;
static audio_output *outputs[] = {
#ifdef CONFIG_AO
&audio_ao,
#endif
&audio_dummy,
NULL
};
audio_output *audio_get_output(char *name) {
audio_output **out;
// default to the first
if (!name)
return outputs[0];
for (out=outputs; *out; out++)
if (!strcasecmp(name, (*out)->name))
return *out;
return NULL;
}
void audio_ls_outputs(void) {
audio_output **out;
printf("Available audio outputs:\n");
for (out=outputs; *out; out++)
printf(" %s%s\n", (*out)->name, out==outputs ? " (default)" : "");
}