From c27b831927bfccb6086e107f6ad7329208ac3dbd Mon Sep 17 00:00:00 2001 From: attila Date: Sat, 10 Jan 2004 09:10:52 +0000 Subject: use -mixer with alsa9 patch by Roland Kuhn git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@11765 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libao2/ao_alsa1x.c | 20 ++++++++++++++++++-- libao2/ao_alsa9.c | 20 ++++++++++++++++++-- 2 files changed, 36 insertions(+), 4 deletions(-) (limited to 'libao2') diff --git a/libao2/ao_alsa1x.c b/libao2/ao_alsa1x.c index ce43b7e843..4648ef956a 100644 --- a/libao2/ao_alsa1x.c +++ b/libao2/ao_alsa1x.c @@ -18,6 +18,7 @@ #include #include "../config.h" +#include "../mixer.h" #if HAVE_SYS_ASOUNDLIB_H #include @@ -96,13 +97,28 @@ static int control(int cmd, void *arg) snd_mixer_elem_t *elem; snd_mixer_selem_id_t *sid; - const char *mix_name = "PCM"; - char *card = "default"; + static const char *mix_name = NULL; + static char *card = NULL; long pmin, pmax; long get_vol, set_vol; float calc_vol, diff, f_multi; + if(mix_name == NULL){ + if(mixer_device) { + card = strdup(mixer_device); + mix_name = strchr(card, '/'); + if(mix_name) { + *mix_name++ = 0; + } else { + mix_name = "PCM"; + } + } else { + mix_name = "PCM"; + card = "default"; + } + } + if(ao_data.format == AFMT_AC3) return CONTROL_TRUE; diff --git a/libao2/ao_alsa9.c b/libao2/ao_alsa9.c index ce43b7e843..4648ef956a 100644 --- a/libao2/ao_alsa9.c +++ b/libao2/ao_alsa9.c @@ -18,6 +18,7 @@ #include #include "../config.h" +#include "../mixer.h" #if HAVE_SYS_ASOUNDLIB_H #include @@ -96,13 +97,28 @@ static int control(int cmd, void *arg) snd_mixer_elem_t *elem; snd_mixer_selem_id_t *sid; - const char *mix_name = "PCM"; - char *card = "default"; + static const char *mix_name = NULL; + static char *card = NULL; long pmin, pmax; long get_vol, set_vol; float calc_vol, diff, f_multi; + if(mix_name == NULL){ + if(mixer_device) { + card = strdup(mixer_device); + mix_name = strchr(card, '/'); + if(mix_name) { + *mix_name++ = 0; + } else { + mix_name = "PCM"; + } + } else { + mix_name = "PCM"; + card = "default"; + } + } + if(ao_data.format == AFMT_AC3) return CONTROL_TRUE; -- cgit v1.2.3