ao_alsa: if possible, reorder device maps to std layouts

Channel maps reported by the device as SND_CHMAP_TYPE_VAR can be freely
reordered. We don't use this much (out of laziness), but in this case
it's a simple way to reduce necessary reordering (which would be an
extra libavresample invocation), and to make debug output more readable.
This commit is contained in:
wm4 2015-06-12 23:15:44 +02:00
parent 5b269ce696
commit 6cc02658fa
1 changed files with 2 additions and 0 deletions

View File

@ -306,6 +306,8 @@ static bool query_chmaps(struct ao *ao, struct mp_chmap *chmap)
mp_chmap_from_alsa(&entry, &maps[i]->map); mp_chmap_from_alsa(&entry, &maps[i]->map);
if (mp_chmap_is_valid(&entry)) { if (mp_chmap_is_valid(&entry)) {
if (maps[i]->type == SND_CHMAP_TYPE_VAR)
mp_chmap_reorder_norm(&entry);
MP_VERBOSE(ao, "Got supported channel map: %s (type %s)\n", MP_VERBOSE(ao, "Got supported channel map: %s (type %s)\n",
mp_chmap_to_str(&entry), mp_chmap_to_str(&entry),
snd_pcm_chmap_type_name(maps[i]->type)); snd_pcm_chmap_type_name(maps[i]->type));