summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-07-31 20:44:56 +0200
committerwm4 <wm4@nowhere>2013-07-31 20:55:59 +0200
commitd6592dd2e209ea6b10231206e8b5d856bef8afaa (patch)
treeb6869d82777a09a487c7b29a47bde7bd9f631462
parenta8a0c5023b915897066cc72c472eb9def0b34efb (diff)
downloadmpv-d6592dd2e209ea6b10231206e8b5d856bef8afaa.tar.bz2
mpv-d6592dd2e209ea6b10231206e8b5d856bef8afaa.tar.xz
m_option: fix skipping of missing -vo/-ao entries
The -vo/-ao options support skipping of unknown entries for the sake of allowing using the same config on possibly very different systems, which have different sets of VO/AOs available. Unfortunately skipping didn't quite work, possibly a rebase error when this was originally committed. Fix it.
-rw-r--r--core/m_option.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/core/m_option.c b/core/m_option.c
index 02258416ec..339b6017f4 100644
--- a/core/m_option.c
+++ b/core/m_option.c
@@ -2040,7 +2040,7 @@ static int get_obj_params(struct bstr opt_name, struct bstr name,
num_args++;
}
- struct m_config *config = m_config_from_obj_desc(NULL, desc);
+ struct m_config *config = desc ? m_config_from_obj_desc(NULL, desc) : NULL;
while (pstr->len > 0) {
bstr fname, fval;
@@ -2121,6 +2121,7 @@ static int parse_obj_settings(struct bstr opt, struct bstr *pstr,
if (bstr_eatstart0(pstr, "=") || bstr_eatstart0(pstr, ":"))
has_param = true;
+ bool skip = false;
if (!m_obj_list_find(&desc, list, str)) {
if (!list->allow_unknown_entries) {
mp_msg(MSGT_CFGPARSER, MSGL_ERR, "Option %.*s: %.*s doesn't exist.\n",
@@ -2128,9 +2129,10 @@ static int parse_obj_settings(struct bstr opt, struct bstr *pstr,
return M_OPT_INVALID;
}
desc = (struct m_obj_desc){0};
+ skip = true;
}
- if (desc.init_options && desc.options && _ret) {
+ if (desc.init_options && _ret) {
bstr s = bstr0(desc.init_options);
r = get_obj_params(opt, str, &s, &desc, &plist);
if (r < 0 || s.len > 0) {
@@ -2140,7 +2142,11 @@ static int parse_obj_settings(struct bstr opt, struct bstr *pstr,
}
if (has_param) {
- if (!desc.options && list->legacy_hacks) {
+ if (skip) {
+ r = get_obj_params(opt, str, pstr, NULL, _ret ? &plist : NULL);
+ if (r < 0)
+ return r;
+ } else if (!desc.priv_size && list->legacy_hacks) {
// Should perhaps be parsed as escape-able string. But this is a
// compatibility path, so it's not worth the trouble.
int next = bstrcspn(*pstr, ",");