From f95cdb2e97b0707a4a79d6278183f78096310788 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 28 Nov 2019 18:05:33 +0100 Subject: f_output_chain: use m_option_equal() This is used to detect whether any filters were changed. This code was essentially ported to m_option.c. One possible difference is how the old code did name comparison. It did not actually compare the name (!?!?), so this might change behavior, hopefully to the better. --- filters/f_output_chain.c | 33 +++------------------------------ 1 file changed, 3 insertions(+), 30 deletions(-) diff --git a/filters/f_output_chain.c b/filters/f_output_chain.c index d353428abc..7686e4e642 100644 --- a/filters/f_output_chain.c +++ b/filters/f_output_chain.c @@ -504,35 +504,6 @@ double mp_output_get_measured_total_delay(struct mp_output_chain *c) return delay; } -static bool compare_filter(struct m_obj_settings *a, struct m_obj_settings *b) -{ - if (a == b || !a || !b) - return a == b; - - if (!a->name || !b->name) - return a->name == b->name; - - if (!!a->label != !!b->label || (a->label && strcmp(a->label, b->label) != 0)) - return false; - - if (a->enabled != b->enabled) - return false; - - bool a_empty = !a->attribs || !a->attribs[0]; - bool b_empty = !b->attribs || !b->attribs[0]; - if (a_empty || b_empty) - return a_empty == b_empty; - - for (int n = 0; a->attribs[n] || b->attribs[n]; n++) { - if (!a->attribs[n] || !b->attribs[n]) - return false; - if (strcmp(a->attribs[n], b->attribs[n]) != 0) - return false; - } - - return true; -} - bool mp_output_chain_update_filters(struct mp_output_chain *c, struct m_obj_settings *list) { @@ -553,7 +524,9 @@ bool mp_output_chain_update_filters(struct mp_output_chain *c, struct mp_user_filter *u = NULL; for (int i = 0; i < p->num_user_filters; i++) { - if (!used[i] && compare_filter(entry, p->user_filters[i]->args)) { + struct m_option t = {.type = &m_option_type_obj_settings_list}; + if (!used[i] && m_option_equal(&t, &entry, &p->user_filters[i]->args)) + { u = p->user_filters[i]; used[i] = true; break; -- cgit v1.2.3