dmix - Enable auto format detection as default

The direct plugins have the automatic format-detection feature but it
wasn't enabled properly in the interface.  Now you can pass the format
"unchanged" to make the plugin detect a proper format.

This will change the default format of some drivers, such as, HD-audio.
This commit is contained in:
Takashi Iwai 2008-01-18 13:42:51 +01:00
parent 91fc64cefb
commit 35d4f9b8d7
3 changed files with 11 additions and 5 deletions

View file

@ -1267,7 +1267,7 @@ int _snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name,
params.periods = 3;
err = snd_pcm_slave_conf(root, dopen.slave, &sconf, 8,
SND_PCM_HW_PARAM_FORMAT, 0, &params.format,
SND_PCM_HW_PARAM_FORMAT, SCONF_UNCHANGED, &params.format,
SND_PCM_HW_PARAM_RATE, 0, &params.rate,
SND_PCM_HW_PARAM_CHANNELS, 0, &params.channels,
SND_PCM_HW_PARAM_PERIOD_TIME, 0, &params.period_time,
@ -1282,8 +1282,10 @@ int _snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name,
if (psize == -1 && params.period_time == -1)
params.period_time = 125000; /* 0.125 seconds */
/* sorry, limited features */
if (! (dmix_supported_format & (1ULL << params.format))) {
if (params.format == -2)
params.format = SND_PCM_FORMAT_UNKNOWN;
else if (!(dmix_supported_format & (1ULL << params.format))) {
/* sorry, limited features */
SNDERR("Unsupported format");
snd_config_delete(sconf);
return -EINVAL;