diff options
author | Takashi Iwai <tiwai@suse.de> | 2006-04-06 17:41:46 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2006-04-06 17:41:46 +0200 |
commit | 3cd8d134e5f94d08c33178a594519eadbbf7eaf8 (patch) | |
tree | 31f9201df424ade39be4a3839b122bf39787de80 /mix | |
parent | 74bdac50b257b986cea38a2c08134c430fc5654f (diff) |
Misc fixes for upmix plugin
- Add channel option to specify the output channels explicitly
- Fix 6-channel input
Diffstat (limited to 'mix')
-rw-r--r-- | mix/pcm_upmix.c | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/mix/pcm_upmix.c b/mix/pcm_upmix.c index ed8d041..9ca5bf4 100644 --- a/mix/pcm_upmix.c +++ b/mix/pcm_upmix.c @@ -290,8 +290,10 @@ static int upmix_init(snd_pcm_extplug_t *ext) stype = (ext->slave_channels == 6) ? 1 : 0; ctype = ext->channels - 1; - if (ctype < 0 || ctype >= 5) + if (ctype < 0 || ctype > 5) { + SNDERR("Invalid channel numbers for upmix: %d", ctype + 1); return -EINVAL; + } mix->upmix = do_upmix[ctype][stype]; if (mix->delay_ms) { @@ -327,6 +329,7 @@ SND_PCM_PLUGIN_DEFINE_FUNC(upmix) snd_pcm_upmix_t *mix; snd_config_t *sconf = NULL; static unsigned int chlist[2] = {4, 6}; + unsigned int channels = 0; int delay = 10; int err; @@ -350,6 +353,20 @@ SND_PCM_PLUGIN_DEFINE_FUNC(upmix) } delay = val; } + if (strcmp(id, "channels") == 0) { + long val; + err = snd_config_get_integer(n, &val); + if (err < 0) { + SNDERR("Invalid value for %s", id); + return err; + } + channels = val; + if (channels != 4 && channels != 6 && channels != 0) { + SNDERR("channels must be 4, 6 or 0"); + return -EINVAL; + } + continue; + } SNDERR("Unknown field %s", id); return -EINVAL; } @@ -382,9 +399,14 @@ SND_PCM_PLUGIN_DEFINE_FUNC(upmix) snd_pcm_extplug_set_param_minmax(&mix->ext, SND_PCM_EXTPLUG_HW_CHANNELS, 1, 6); - snd_pcm_extplug_set_slave_param_list(&mix->ext, - SND_PCM_EXTPLUG_HW_CHANNELS, - 2, chlist); + if (channels) + snd_pcm_extplug_set_slave_param_minmax(&mix->ext, + SND_PCM_EXTPLUG_HW_CHANNELS, + channels, channels); + else + snd_pcm_extplug_set_slave_param_list(&mix->ext, + SND_PCM_EXTPLUG_HW_CHANNELS, + 2, chlist); snd_pcm_extplug_set_param(&mix->ext, SND_PCM_EXTPLUG_HW_FORMAT, SND_PCM_FORMAT_S16); snd_pcm_extplug_set_slave_param(&mix->ext, SND_PCM_EXTPLUG_HW_FORMAT, |