diff options
author | wm4 <wm4@nowhere> | 2019-11-28 18:05:33 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2019-11-29 12:14:43 +0100 |
commit | f95cdb2e97b0707a4a79d6278183f78096310788 (patch) | |
tree | 4a72db982db5a430ddb2d05f43c304a0741267b7 /filters/f_output_chain.c | |
parent | 6d82c04dca8cc9c780725490607582684ba7a6e9 (diff) | |
download | mpv-f95cdb2e97b0707a4a79d6278183f78096310788.tar.bz2 mpv-f95cdb2e97b0707a4a79d6278183f78096310788.tar.xz |
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.
Diffstat (limited to 'filters/f_output_chain.c')
-rw-r--r-- | filters/f_output_chain.c | 33 |
1 files 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; |