mirror of
https://github.com/mpv-player/mpv
synced 2025-01-20 14:20:55 +00:00
allow to select an alsa mixer channel index.
Patch by Eric Yagerlener [eyager (at) chartermi (dot) net]. Applied with slight modifications, see also bugzilla bug #69. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@13435 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
4ba1803132
commit
d6100972a5
@ -1669,7 +1669,7 @@ Use a mixer device different from the default /dev/\:mixer.
|
||||
For ALSA this is the mixer name.
|
||||
.
|
||||
.TP
|
||||
.B \-mixer-channel <mixer line> (\-ao oss and \-ao alsa only)
|
||||
.B \-mixer-channel <mixer line>[,mixer index] (\-ao oss and \-ao alsa only)
|
||||
This option will tell MPlayer to use a different channel for controlling
|
||||
volume than the default PCM.
|
||||
Options for OSS include
|
||||
@ -1678,6 +1678,12 @@ For a complete list of options look for SOUND_DEVICE_NAMES in
|
||||
/usr/\:include/\:linux/\:soundcard.h.
|
||||
For ALSA you can use the names e.g.\& alsamixer displays, like
|
||||
.B Master, Line, PCM.
|
||||
.br
|
||||
.I NOTE:
|
||||
ALSA mixer channel names followed by a number must be specified in the
|
||||
<name,number> format, i.e. a channel labeled 'PCM 1' in alsamixer must
|
||||
be converted to
|
||||
.B PCM,1.
|
||||
.
|
||||
.TP
|
||||
.B \-nowaveheader (\-ao pcm only)
|
||||
|
@ -101,12 +101,28 @@ static int control(int cmd, void *arg)
|
||||
|
||||
static char *mix_name = "PCM";
|
||||
static char *card = "default";
|
||||
static int mix_index = 0;
|
||||
|
||||
long pmin, pmax;
|
||||
long get_vol, set_vol;
|
||||
float f_multi;
|
||||
|
||||
if(mixer_channel) mix_name = mixer_channel;
|
||||
if(mixer_channel) {
|
||||
char *test_mix_index;
|
||||
|
||||
mix_name = strdup(mixer_channel);
|
||||
if (test_mix_index = strchr(mix_name, ',')){
|
||||
*test_mix_index = 0;
|
||||
test_mix_index++;
|
||||
mix_index = strtol(test_mix_index, &test_mix_index, 0);
|
||||
|
||||
if (*test_mix_index){
|
||||
mp_msg(MSGT_AO,MSGL_ERR,
|
||||
"alsa-control: invalid mixer index. Defaulting to 0\n");
|
||||
mix_index = 0 ;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(mixer_device) card = mixer_device;
|
||||
|
||||
if(ao_data.format == AFMT_AC3)
|
||||
@ -116,9 +132,14 @@ static int control(int cmd, void *arg)
|
||||
snd_mixer_selem_id_alloca(&sid);
|
||||
|
||||
//sets simple-mixer index and name
|
||||
snd_mixer_selem_id_set_index(sid, 0);
|
||||
snd_mixer_selem_id_set_index(sid, mix_index);
|
||||
snd_mixer_selem_id_set_name(sid, mix_name);
|
||||
|
||||
if (mixer_channel) {
|
||||
free(mix_name);
|
||||
mix_name = NULL;
|
||||
}
|
||||
|
||||
if ((err = snd_mixer_open(&handle, 0)) < 0) {
|
||||
mp_msg(MSGT_AO,MSGL_ERR,"alsa-control: mixer open error: %s\n", snd_strerror(err));
|
||||
return CONTROL_ERROR;
|
||||
|
Loading…
Reference in New Issue
Block a user