mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-31 22:25:35 -04:00
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:
parent
91fc64cefb
commit
35d4f9b8d7
3 changed files with 11 additions and 5 deletions
|
|
@ -68,7 +68,7 @@ defaults.pcm.ipc_gid audio
|
|||
defaults.pcm.ipc_perm 0660
|
||||
defaults.pcm.dmix.max_periods 0
|
||||
defaults.pcm.dmix.rate 48000
|
||||
defaults.pcm.dmix.format S16_LE
|
||||
defaults.pcm.dmix.format "unchanged"
|
||||
defaults.pcm.dmix.card defaults.pcm.card
|
||||
defaults.pcm.dmix.device defaults.pcm.device
|
||||
defaults.pcm.dsnoop.card defaults.pcm.card
|
||||
|
|
|
|||
|
|
@ -874,7 +874,11 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
|
|||
return ret;
|
||||
}
|
||||
}
|
||||
ret = snd_pcm_hw_params_set_format(spcm, hw_params, params->format);
|
||||
if (params->format == SND_PCM_FORMAT_UNKNOWN)
|
||||
ret = -EINVAL;
|
||||
else
|
||||
ret = snd_pcm_hw_params_set_format(spcm, hw_params,
|
||||
params->format);
|
||||
if (ret < 0) {
|
||||
static const snd_pcm_format_t dmix_formats[] = {
|
||||
SND_PCM_FORMAT_S32,
|
||||
|
|
|
|||
|
|
@ -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, ¶ms.format,
|
||||
SND_PCM_HW_PARAM_FORMAT, SCONF_UNCHANGED, ¶ms.format,
|
||||
SND_PCM_HW_PARAM_RATE, 0, ¶ms.rate,
|
||||
SND_PCM_HW_PARAM_CHANNELS, 0, ¶ms.channels,
|
||||
SND_PCM_HW_PARAM_PERIOD_TIME, 0, ¶ms.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 */
|
||||
|
||||
if (params.format == -2)
|
||||
params.format = SND_PCM_FORMAT_UNKNOWN;
|
||||
else if (!(dmix_supported_format & (1ULL << params.format))) {
|
||||
/* sorry, limited features */
|
||||
if (! (dmix_supported_format & (1ULL << params.format))) {
|
||||
SNDERR("Unsupported format");
|
||||
snd_config_delete(sconf);
|
||||
return -EINVAL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue