[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] added support for get_playcmd in libao
From: |
Andrei Kholodnyi |
Subject: |
[PATCH] added support for get_playcmd in libao |
Date: |
Sat, 4 Sep 2010 13:11:54 +0200 |
it returns playcmd corresponding to the active libao audio plugin
alsa, oss and pulse are supported
---
src/audio/libao.c | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/src/audio/libao.c b/src/audio/libao.c
index 0b4734c..b9cd245 100644
--- a/src/audio/libao.c
+++ b/src/audio/libao.c
@@ -77,6 +77,13 @@ static ao_sample_format current_ao_parameters;
static volatile int ao_stop_playback = 0;
static int default_driver;
+
+/* pairs of libao backend short names and corresponsing play commands */
+static char const * libao_play_cmd[] = {
+ "alsa", "aplay",
+ "oss", "play",
+ "pulse", "paplay"
+};
static int libao_log_level;
ao_device *device = NULL;
@@ -220,6 +227,18 @@ static void libao_set_loglevel (int level)
static char const *
libao_get_playcmd (void)
{
+ ao_info * info;
+ int i;
+
+ info = ao_driver_info(default_driver);
+ if (info == NULL)
+ return NULL;
+
+ for (i = 0; i < sizeof(libao_play_cmd)/sizeof(char *); i += 2) {
+ if (!strcmp(info->short_name, libao_play_cmd[i]))
+ return libao_play_cmd[i + 1];
+ }
+
return NULL;
}
--
1.6.0.4