mirror of
https://github.com/mpv-player/mpv
synced 2025-02-17 21:27:08 +00:00
Allow setting the mixer per instance so one can fallback between
several oos device and still have correct mixer settings all the time. The sytax is now: oss[:dsp_device[:mixer_device[:mixer_channel]]] git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@16960 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
fb8da06ed7
commit
1f1fc11b84
@ -215,17 +215,32 @@ static int control(int cmd,void *arg){
|
||||
static int init(int rate,int channels,int format,int flags){
|
||||
char *mixer_channels [SOUND_MIXER_NRDEVICES] = SOUND_DEVICE_NAMES;
|
||||
int oss_format;
|
||||
char *mdev = mixer_device, *mchan = mixer_channel;
|
||||
|
||||
mp_msg(MSGT_AO,MSGL_V,"ao2: %d Hz %d chans %s\n",rate,channels,
|
||||
af_fmt2str_short(format));
|
||||
|
||||
if (ao_subdevice)
|
||||
if (ao_subdevice) {
|
||||
char *m,*c;
|
||||
m = strchr(ao_subdevice,':');
|
||||
if(m) {
|
||||
c = strchr(m+1,':');
|
||||
if(c) {
|
||||
mchan = c+1;
|
||||
c[0] = '\0';
|
||||
}
|
||||
mdev = m+1;
|
||||
m[0] = '\0';
|
||||
}
|
||||
dsp = ao_subdevice;
|
||||
}
|
||||
|
||||
if(mixer_device)
|
||||
oss_mixer_device=mixer_device;
|
||||
|
||||
if(mixer_channel){
|
||||
if(mdev)
|
||||
oss_mixer_device=mdev;
|
||||
else
|
||||
oss_mixer_device=PATH_DEV_MIXER;
|
||||
|
||||
if(mchan){
|
||||
int fd, devs, i;
|
||||
|
||||
if ((fd = open(oss_mixer_device, O_RDONLY)) == -1){
|
||||
@ -236,10 +251,9 @@ static int init(int rate,int channels,int format,int flags){
|
||||
close(fd);
|
||||
|
||||
for (i=0; i<SOUND_MIXER_NRDEVICES; i++){
|
||||
if(!strcasecmp(mixer_channels[i], mixer_channel)){
|
||||
if(!strcasecmp(mixer_channels[i], mchan)){
|
||||
if(!(devs & (1 << i))){
|
||||
mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_OSS_ChanNotFound,
|
||||
mixer_channel);
|
||||
mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_OSS_ChanNotFound,mchan);
|
||||
i = SOUND_MIXER_NRDEVICES+1;
|
||||
break;
|
||||
}
|
||||
@ -248,11 +262,11 @@ static int init(int rate,int channels,int format,int flags){
|
||||
}
|
||||
}
|
||||
if(i==SOUND_MIXER_NRDEVICES){
|
||||
mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_OSS_ChanNotFound,
|
||||
mixer_channel);
|
||||
mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_OSS_ChanNotFound,mchan);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else
|
||||
oss_mixer_channel = SOUND_MIXER_PCM;
|
||||
|
||||
mp_msg(MSGT_AO,MSGL_V,"audio_setup: using '%s' dsp device\n", dsp);
|
||||
mp_msg(MSGT_AO,MSGL_V,"audio_setup: using '%s' mixer device\n", oss_mixer_device);
|
||||
|
Loading…
Reference in New Issue
Block a user