From 0c0c373844d733c75ff3183a297a1a55c336f1a2 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 27 Dec 2019 17:44:33 +0100 Subject: m_option: fix runtime changing of --audio-channels This option type, used by --audio-channels, had a completely broken m_option_type.equal implementation, and thus reacted incorrectly to runtime option changes. Broken since commit b16cea750f527088be7977. --- options/m_option.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/options/m_option.c b/options/m_option.c index 46ebb4dba8..c55ca06bc8 100644 --- a/options/m_option.c +++ b/options/m_option.c @@ -2585,9 +2585,20 @@ static void copy_channels(const m_option_t *opt, void *dst, const void *src) static bool channels_equal(const m_option_t *opt, void *a, void *b) { - struct mp_chmap *ca = a; - struct mp_chmap *cb = b; - return mp_chmap_equals(ca, cb); + struct m_channels *ca = a; + struct m_channels *cb = b; + + if (ca->set != cb->set || + ca->auto_safe != cb->auto_safe || + ca->num_chmaps != cb->num_chmaps) + return false; + + for (int n = 0; n < ca->num_chmaps; n++) { + if (!mp_chmap_equals(&ca->chmaps[n], &cb->chmaps[n])) + return false; + } + + return true; } const m_option_type_t m_option_type_channels = { -- cgit v1.2.3