diff options
author | wm4 <wm4@nowhere> | 2016-11-22 15:52:55 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-11-22 15:55:13 +0100 |
commit | 5087816a7431caf27a5a8a9e00d0004d8322cdaa (patch) | |
tree | 39b08676edd7cea66e4df7ca5a664aec26336670 | |
parent | 7201fd7d08dd7f240e6f7c2584809bb4a723ab21 (diff) |
options: remove legacy global sub-option syntax
A bit of sanity, although a very small one.
--vo sub-options are not affected by this yet.
-rw-r--r-- | DOCS/interface-changes.rst | 2 | ||||
-rw-r--r-- | options/m_config.c | 57 | ||||
-rw-r--r-- | options/m_config.h | 6 |
3 files changed, 5 insertions, 60 deletions
diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst index e082b36a9d..6504db556a 100644 --- a/DOCS/interface-changes.rst +++ b/DOCS/interface-changes.rst @@ -30,6 +30,8 @@ Interface changes - "audio-channels" (use "audio-params/channel-count") - "audio-format" (use "audio-codec-name") (the properties equivalent to the old semantics are in parentheses) + - remove deprecated global sub-options (like -demuxer-rawaudio format=...), + use flat options (like --demuxer-rawaudio-format=...) --- mpv 0.22.0 --- - the "audio-device-list" property now sets empty device description to the device name as a fallback diff --git a/options/m_config.c b/options/m_config.c index 1c5fe01293..dea7a4dd10 100644 --- a/options/m_config.c +++ b/options/m_config.c @@ -745,9 +745,6 @@ int m_config_set_option_raw(struct m_config *config, struct m_config_option *co, } } -static int parse_subopts(struct m_config *config, char *name, char *prefix, - struct bstr param, int flags); - // Used to turn "--no-foo" into "--foo=no". static struct m_config_option *m_config_find_negation_opt(struct m_config *config, struct bstr *name) @@ -813,15 +810,9 @@ static int m_config_parse_option(struct m_config *config, struct bstr name, // Option with children are a bit different to parse if (co->opt->type->flags & M_OPT_TYPE_HAS_CHILD) { - char prefix[110]; - if (!config->subopt_deprecation_warning) { - MP_WARN(config, "Suboptions (--%.*s=...) are deprecated. Use " - "flat options instead.\n", BSTR_P(name)); - config->subopt_deprecation_warning = true; - } - assert(strlen(co->name) < 100); - sprintf(prefix, "%s-", co->name); - return parse_subopts(config, (char *)co->name, prefix, param, flags); + MP_FATAL(config, "Suboptions (--%.*s=...) have been removed. Use " + "flat options instead.\n", BSTR_P(name)); + return M_OPT_INVALID; } union m_option_value val = {0}; @@ -841,48 +832,6 @@ static int m_config_parse_option(struct m_config *config, struct bstr name, return r; } -static int parse_subopts(struct m_config *config, char *name, char *prefix, - struct bstr param, int flags) -{ - char **lst = NULL; - // Split the argument into child options - int r = m_option_type_subconfig.parse(config->log, NULL, bstr0(""), param, &lst); - if (r < 0) - return r; - // Parse the child options - for (int i = 0; lst && lst[2 * i]; i++) { - // Build the full name - char n[110]; - if (snprintf(n, 110, "%s%s", prefix, lst[2 * i]) > 100) - abort(); - r = m_config_parse_option(config,bstr0(n), bstr0(lst[2 * i + 1]), flags); - if (r < 0) { - if (r != M_OPT_EXIT) { - MP_ERR(config, "Error parsing suboption %s/%s (%s)\n", - name, lst[2 * i], m_option_strerror(r)); - r = M_OPT_INVALID; - } - break; - } - } - talloc_free(lst); - return r; -} - -int m_config_parse_suboptions(struct m_config *config, char *name, - char *subopts) -{ - if (!subopts || !*subopts) - return 0; - int r = parse_subopts(config, name, "", bstr0(subopts), 0); - if (r < 0 && r != M_OPT_EXIT) { - MP_ERR(config, "Error parsing suboption %s (%s)\n", - name, m_option_strerror(r)); - r = M_OPT_INVALID; - } - return r; -} - int m_config_set_option_ext(struct m_config *config, struct bstr name, struct bstr param, int flags) { diff --git a/options/m_config.h b/options/m_config.h index 94a6c9e6ee..16eba317f0 100644 --- a/options/m_config.h +++ b/options/m_config.h @@ -92,8 +92,6 @@ typedef struct m_config { // For the command line parser int recursion_depth; - bool subopt_deprecation_warning; - void *optstruct; // struct mpopts or other int shadow_size; @@ -197,10 +195,6 @@ struct mpv_node; int m_config_set_option_node(struct m_config *config, bstr name, struct mpv_node *data, int flags); - -int m_config_parse_suboptions(struct m_config *config, char *name, - char *subopts); - struct m_config_option *m_config_get_co_raw(const struct m_config *config, struct bstr name); struct m_config_option *m_config_get_co(const struct m_config *config, |