From ec27d573f492f30c1111678273d56f922330fdcd Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 26 Oct 2015 15:52:08 +0100 Subject: 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. --- audio/chmap_sel.c | 22 ++++++++++++++++++++++ audio/chmap_sel.h | 3 +++ audio/out/ao.c | 15 ++++----------- audio/out/ao_alsa.c | 6 +++--- audio/out/ao_wasapi_utils.c | 4 +--- 5 files changed, 33 insertions(+), 17 deletions(-) (limited to 'audio') diff --git a/audio/chmap_sel.c b/audio/chmap_sel.c index 292aa8e20b..51a3eecf8b 100644 --- a/audio/chmap_sel.c +++ b/audio/chmap_sel.c @@ -20,6 +20,7 @@ #include #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"); +} diff --git a/audio/chmap_sel.h b/audio/chmap_sel.h index ae80fa5bc3..786f06f239 100644 --- a/audio/chmap_sel.h +++ b/audio/chmap_sel.h @@ -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 diff --git a/audio/out/ao.c b/audio/out/ao.c index 6330ec9d48..02dff063ff 100644 --- a/audio/out/ao.c +++ b/audio/out/ao.c @@ -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; } diff --git a/audio/out/ao_alsa.c b/audio/out/ao_alsa.c index d1afab2389..2b3e8e0658 100644 --- a/audio/out/ao_alsa.c +++ b/audio/out/ao_alsa.c @@ -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]; diff --git a/audio/out/ao_wasapi_utils.c b/audio/out/ao_wasapi_utils.c index fd65cc82eb..1f885004a9 100755 --- a/audio/out/ao_wasapi_utils.c +++ b/audio/out/ao_wasapi_utils.c @@ -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)); - } } } -- cgit v1.2.3