summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Kocialkowski <contact@paulk.fr>2012-10-12 22:00:23 +0200
committerPaul Kocialkowski <contact@paulk.fr>2012-10-12 22:00:23 +0200
commit7656237bb6e6fe676a318e491c60a2337446c722 (patch)
treebb9b232dde5d47d84c15404b3afddf53cec8f094
parent4d6c6cc6e65fdfb2f6ed4a66c062bbf7b1706f0b (diff)
downloadhardware_tinyalsa-audio-7656237bb6e6fe676a318e491c60a2337446c722.zip
hardware_tinyalsa-audio-7656237bb6e6fe676a318e491c60a2337446c722.tar.gz
hardware_tinyalsa-audio-7656237bb6e6fe676a318e491c60a2337446c722.tar.bz2
Mixer: Provide supported devices
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
-rw-r--r--audio_hw.c31
-rw-r--r--mixer.c34
-rw-r--r--mixer.h1
3 files changed, 46 insertions, 20 deletions
diff --git a/audio_hw.c b/audio_hw.c
index 685bc4a..403f6cd 100644
--- a/audio_hw.c
+++ b/audio_hw.c
@@ -36,28 +36,19 @@
static uint32_t audio_hw_get_supported_devices(const struct audio_hw_device *dev)
{
+ struct tinyalsa_audio_device *tinyalsa_audio_device;
+
LOGD("%s(%p)", __func__, dev);
- int supported_output_devices = AUDIO_DEVICE_OUT_EARPIECE |
- AUDIO_DEVICE_OUT_SPEAKER |
- AUDIO_DEVICE_OUT_WIRED_HEADSET |
- AUDIO_DEVICE_OUT_WIRED_HEADPHONE |
- AUDIO_DEVICE_OUT_AUX_DIGITAL |
- AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET |
- AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET |
- AUDIO_DEVICE_OUT_ALL_SCO |
- AUDIO_DEVICE_OUT_DEFAULT;
-
- int supported_input_devices = AUDIO_DEVICE_IN_COMMUNICATION |
- AUDIO_DEVICE_IN_AMBIENT |
- AUDIO_DEVICE_IN_BUILTIN_MIC |
- AUDIO_DEVICE_IN_WIRED_HEADSET |
- AUDIO_DEVICE_IN_AUX_DIGITAL |
- AUDIO_DEVICE_IN_BACK_MIC |
- AUDIO_DEVICE_IN_ALL_SCO |
- AUDIO_DEVICE_IN_DEFAULT;
-
- return supported_output_devices | supported_input_devices;
+ if(dev == NULL)
+ return -1;
+
+ tinyalsa_audio_device = (struct tinyalsa_audio_device *) dev;
+
+ if(tinyalsa_audio_device->mixer == NULL)
+ return -1;
+
+ return (uint32_t) tinyalsa_mixer_get_supported_devices(tinyalsa_audio_device->mixer);
}
static int audio_hw_init_check(const struct audio_hw_device *dev)
diff --git a/mixer.c b/mixer.c
index 065b939..508fea8 100644
--- a/mixer.c
+++ b/mixer.c
@@ -777,6 +777,40 @@ int tinyalsa_mixer_set_voice_volume(struct tinyalsa_mixer *mixer, audio_devices_
&mixer->input, "voice-volume");
}
+audio_devices_t tinyalsa_mixer_get_supported_devices(struct tinyalsa_mixer *mixer)
+{
+ struct tinyalsa_mixer_device *mixer_device;
+ audio_devices_t devices = 0x00;
+ struct list_head *list;
+
+ LOGD("%s(%p)", __func__, mixer);
+
+ if(mixer == NULL)
+ return -1;
+
+ list = mixer->output.devices;
+ while(list != NULL) {
+ if(list->data != NULL) {
+ mixer_device = (struct tinyalsa_mixer_device *) list->data;
+ devices |= mixer_device->props.type;
+ }
+
+ list = list->next;
+ }
+
+ list = mixer->input.devices;
+ while(list != NULL) {
+ if(list->data != NULL) {
+ mixer_device = (struct tinyalsa_mixer_device *) list->data;
+ devices |= mixer_device->props.type;
+ }
+
+ list = list->next;
+ }
+
+ return devices;
+}
+
struct tinyalsa_mixer_io_props *tinyalsa_mixer_get_output_props(struct tinyalsa_mixer *mixer)
{
LOGD("%s(%p)", __func__, mixer);
diff --git a/mixer.h b/mixer.h
index 5812b76..fd1d67d 100644
--- a/mixer.h
+++ b/mixer.h
@@ -96,6 +96,7 @@ void tinyalsa_mixer_close(struct tinyalsa_mixer *mixer);
struct tinyalsa_mixer_io_props *tinyalsa_mixer_get_input_props(struct tinyalsa_mixer *mixer);
struct tinyalsa_mixer_io_props *tinyalsa_mixer_get_output_props(struct tinyalsa_mixer *mixer);
+audio_devices_t tinyalsa_mixer_get_supported_devices(struct tinyalsa_mixer *mixer);
int tinyalsa_mixer_set_voice_volume(struct tinyalsa_mixer *mixer, audio_devices_t device);
int tinyalsa_mixer_set_input_gain(struct tinyalsa_mixer *mixer, audio_devices_t device);