Mercurial > mplayer.hg
changeset 16959:832a93fc5deb
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]]]
author | albeu |
---|---|
date | Thu, 10 Nov 2005 09:02:56 +0000 |
parents | 3ff863e54b93 |
children | 917be9f5e46d |
files | libao2/ao_oss.c |
diffstat | 1 files changed, 25 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/libao2/ao_oss.c Thu Nov 10 02:39:31 2005 +0000 +++ b/libao2/ao_oss.c Thu Nov 10 09:02:56 2005 +0000 @@ -215,17 +215,32 @@ 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 @@ 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 @@ } } 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);