audio: always log channel maps before determining final map

Until now, this was done only in debug verbosity, while some AOs logged
equivalent information in verbose mode. Clean this up.
This commit is contained in:
wm4 2015-10-26 15:52:08 +01:00
parent 72d3c5ef00
commit ec27d573f4
5 changed files with 33 additions and 17 deletions

View File

@ -20,6 +20,7 @@
#include <limits.h>
#include "common/common.h"
#include "common/msg.h"
#include "chmap_sel.h"
static const struct mp_chmap speaker_replacements[][2] = {
@ -357,3 +358,24 @@ bool mp_chmap_sel_get_def(const struct mp_chmap_sel *s, struct mp_chmap *map,
}
return map->num > 0;
}
// Print the set of allowed channel layouts.
void mp_chmal_sel_log(const struct mp_chmap_sel *s, struct mp_log *log, int lev)
{
if (!mp_msg_test(log, lev))
return;
for (int i = 0; i < s->num_chmaps; i++)
mp_msg(log, lev, " - %s\n", mp_chmap_to_str(&s->chmaps[i]));
for (int i = 0; i < MP_SPEAKER_ID_COUNT; i++) {
if (!s->speakers[i])
continue;
struct mp_chmap l = {.num = 1, .speaker = { i }};
mp_msg(log, lev, " - #%s\n",
i == MP_SPEAKER_ID_FC ? "fc" : mp_chmap_to_str_hr(&l));
}
if (s->allow_waveext)
mp_msg(log, lev, " - waveext\n");
if (s->allow_any)
mp_msg(log, lev, " - anything\n");
}

View File

@ -45,4 +45,7 @@ bool mp_chmap_sel_fallback(const struct mp_chmap_sel *s, struct mp_chmap *map);
bool mp_chmap_sel_get_def(const struct mp_chmap_sel *s, struct mp_chmap *map,
int num);
struct mp_log;
void mp_chmal_sel_log(const struct mp_chmap_sel *s, struct mp_log *log, int lev);
#endif

View File

@ -421,18 +421,11 @@ void ao_hotplug_event(struct ao *ao)
bool ao_chmap_sel_adjust(struct ao *ao, const struct mp_chmap_sel *s,
struct mp_chmap *map)
{
if (mp_msg_test(ao->log, MSGL_DEBUG)) {
for (int i = 0; i < s->num_chmaps; i++) {
struct mp_chmap c = s->chmaps[i];
MP_DBG(ao, "chmap_sel #%d: %s (%s)\n", i, mp_chmap_to_str(&c),
mp_chmap_to_str_hr(&c));
}
}
MP_VERBOSE(ao, "Channel layouts:\n");
mp_chmal_sel_log(s, ao->log, MSGL_V);
bool r = mp_chmap_sel_adjust(s, map);
if (r) {
MP_DBG(ao, "result: %s (%s)\n", mp_chmap_to_str(map),
mp_chmap_to_str_hr(map));
}
if (r)
MP_VERBOSE(ao, "result: %s\n", mp_chmap_to_str(map));
return r;
}

View File

@ -328,9 +328,9 @@ static bool query_chmaps(struct ao *ao, struct mp_chmap *chmap)
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_chmap_to_str(&entry),
snd_pcm_chmap_type_name(maps[i]->type));
MP_DBG(ao, "Got supported channel map: %s (type %s)\n",
mp_chmap_to_str(&entry),
snd_pcm_chmap_type_name(maps[i]->type));
mp_chmap_sel_add_map(&chmap_sel, &entry);
} else {
char tmp[128];

View File

@ -486,10 +486,8 @@ static bool search_channels(struct ao *ao, WAVEFORMATEXTENSIBLE *wformat)
}
} else {
change_waveformat_channels(wformat, &entry);
if (try_format_exclusive(ao, wformat)) {
if (try_format_exclusive(ao, wformat))
mp_chmap_sel_add_map(&chmap_sel, &entry);
MP_VERBOSE(ao, "%s is supported\n", mp_chmap_to_str(&entry));
}
}
}