diff options
author | albeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2005-11-10 09:02:56 +0000 |
---|---|---|
committer | albeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2005-11-10 09:02:56 +0000 |
commit | 1f1fc11b841cb90899c8fd5fa9a73861827ba811 (patch) | |
tree | fb429b5416d95b200317a1349ce763632cfbadec /libao2/ao_oss.c | |
parent | fb8da06ed75c53a69a3a3f276c5e9631271d0249 (diff) | |
download | mpv-1f1fc11b841cb90899c8fd5fa9a73861827ba811.tar.bz2 mpv-1f1fc11b841cb90899c8fd5fa9a73861827ba811.tar.xz |
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
Diffstat (limited to 'libao2/ao_oss.c')
-rw-r--r-- | libao2/ao_oss.c | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/libao2/ao_oss.c b/libao2/ao_oss.c index 393d8b065e..94eaf92ee0 100644 --- a/libao2/ao_oss.c +++ b/libao2/ao_oss.c @@ -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); |