Support other than "PCM" alsa mixer channels.

This commit is contained in:
Johns 2011-12-25 15:36:04 +01:00
parent 10ab0274ab
commit 7f0ad63209
2 changed files with 21 additions and 2 deletions

View File

@ -57,6 +57,18 @@ Install:
cd vdr-softhddevice cd vdr-softhddevice
make VDRDIR=<path-to-your-vdr-files> LIBDIR=. make VDRDIR=<path-to-your-vdr-files> 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 Setup: /etc/vdr/setup.conf
Following is supported: Following is supported:

11
audio.c
View File

@ -60,6 +60,7 @@
static const char *AudioPCMDevice; ///< alsa PCM device name static const char *AudioPCMDevice; ///< alsa PCM device name
static const char *AudioMixerDevice; ///< alsa mixer 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 volatile char AudioRunning; ///< thread running / stopped
static int AudioPaused; ///< audio paused static int AudioPaused; ///< audio paused
static unsigned AudioSampleRate; ///< audio sample rate in hz static unsigned AudioSampleRate; ///< audio sample rate in hz
@ -589,6 +590,7 @@ void AudioSetVolume(int volume)
static void AlsaInitMixer(void) static void AlsaInitMixer(void)
{ {
const char *device; const char *device;
const char *channel;
snd_mixer_t *alsa_mixer; snd_mixer_t *alsa_mixer;
snd_mixer_elem_t *alsa_mixer_elem; snd_mixer_elem_t *alsa_mixer_elem;
long alsa_mixer_elem_min; long alsa_mixer_elem_min;
@ -599,13 +601,18 @@ static void AlsaInitMixer(void)
device = "default"; 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); snd_mixer_open(&alsa_mixer, 0);
if (alsa_mixer && snd_mixer_attach(alsa_mixer, device) >= 0 if (alsa_mixer && snd_mixer_attach(alsa_mixer, device) >= 0
&& snd_mixer_selem_register(alsa_mixer, NULL, NULL) >= 0 && snd_mixer_selem_register(alsa_mixer, NULL, NULL) >= 0
&& snd_mixer_load(alsa_mixer) >= 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); alsa_mixer_elem = snd_mixer_first_elem(alsa_mixer);
while (alsa_mixer_elem) { while (alsa_mixer_elem) {