From 7f0ad63209b8bce413e76144a0ff09d992bf0231 Mon Sep 17 00:00:00 2001 From: Johns Date: Sun, 25 Dec 2011 15:36:04 +0100 Subject: [PATCH] Support other than "PCM" alsa mixer channels. --- README.txt | 12 ++++++++++++ audio.c | 11 +++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/README.txt b/README.txt index f4279f7..3a9b3b7 100644 --- a/README.txt +++ b/README.txt @@ -57,6 +57,18 @@ Install: cd vdr-softhddevice make VDRDIR= LIBDIR=. +Setup: environment + Following is supported: + + DISPLAY=:0.0 + x11 display name + ALSA_DEVICE=default + alsa PCM device name + ALSA_MIXER=default + alsa control device name + ALSA_MIXER_CHANNEL=PCM + alsa control channel name + Setup: /etc/vdr/setup.conf Following is supported: diff --git a/audio.c b/audio.c index c78a213..472499a 100644 --- a/audio.c +++ b/audio.c @@ -60,6 +60,7 @@ static const char *AudioPCMDevice; ///< alsa PCM device name static const char *AudioMixerDevice; ///< alsa mixer device name +static const char *AudioMixerChannel; ///< alsa mixer channel name static volatile char AudioRunning; ///< thread running / stopped static int AudioPaused; ///< audio paused static unsigned AudioSampleRate; ///< audio sample rate in hz @@ -589,6 +590,7 @@ void AudioSetVolume(int volume) static void AlsaInitMixer(void) { const char *device; + const char *channel; snd_mixer_t *alsa_mixer; snd_mixer_elem_t *alsa_mixer_elem; long alsa_mixer_elem_min; @@ -599,13 +601,18 @@ static void AlsaInitMixer(void) device = "default"; } } - Debug(3, "audio/alsa: mixer open\n"); + if (!(channel = AudioMixerChannel)) { + if (!(channel = getenv("ALSA_MIXER_CHANNEL"))) { + channel = "PCM"; + } + } + Debug(3, "audio/alsa: mixer %s - %s open\n", device, channel); snd_mixer_open(&alsa_mixer, 0); if (alsa_mixer && snd_mixer_attach(alsa_mixer, device) >= 0 && snd_mixer_selem_register(alsa_mixer, NULL, NULL) >= 0 && snd_mixer_load(alsa_mixer) >= 0) { - const char *const alsa_mixer_elem_name = "PCM"; + const char *const alsa_mixer_elem_name = channel; alsa_mixer_elem = snd_mixer_first_elem(alsa_mixer); while (alsa_mixer_elem) {