diff options
author | wm4 <wm4@nowhere> | 2014-12-01 15:29:02 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-12-01 15:29:02 +0100 |
commit | 8c2b78ea5ad8db5c721ffb732e9b54239dc8541d (patch) | |
tree | e77297084497f570307aba324413d6d3896c6a68 /options | |
parent | b0ed93d87ddf351a6983d3cb87063c75efa04281 (diff) | |
download | mpv-8c2b78ea5ad8db5c721ffb732e9b54239dc8541d.tar.bz2 mpv-8c2b78ea5ad8db5c721ffb732e9b54239dc8541d.tar.xz |
options: simplify channel map validation
The min=-1 case was never used, and the channel map must always be valid
(or in some cases, invalid but empty).
Diffstat (limited to 'options')
-rw-r--r-- | options/m_option.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/options/m_option.c b/options/m_option.c index ce86db0696..cb398f6bb9 100644 --- a/options/m_option.c +++ b/options/m_option.c @@ -2114,8 +2114,9 @@ const m_option_type_t m_option_type_afmt = { static int parse_chmap(struct mp_log *log, const m_option_t *opt, struct bstr name, struct bstr param, void *dst) { - // min>0: at least min channels, min=0: empty ok, min=-1: invalid ok + // min>0: at least min channels, min=0: empty ok int min_ch = (opt->flags & M_OPT_MIN) ? opt->min : 1; + assert(min_ch >= 0); if (bstr_equals0(param, "help")) { mp_chmap_print_help(log); @@ -2131,9 +2132,7 @@ static int parse_chmap(struct mp_log *log, const m_option_t *opt, return M_OPT_INVALID; } - if ((min_ch >= 0 && !mp_chmap_is_valid(&res)) && - !(min_ch == 0 && mp_chmap_is_empty(&res))) - { + if (!mp_chmap_is_valid(&res) && !(min_ch == 0 && mp_chmap_is_empty(&res))) { mp_err(log, "Invalid channel layout: %.*s\n", BSTR_P(param)); return M_OPT_INVALID; } |