summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-04-26 16:52:54 +0200
committerwm4 <wm4@nowhere>2013-04-26 20:44:18 +0200
commit28a971e26f7318d2081dff8c95a3844823ed7c9d (patch)
tree24828ac3c63097671da34dec8ec5118dc9c3939a /core
parentca08ce77a95c91868a872671c4eca1438f905bb1 (diff)
downloadmpv-28a971e26f7318d2081dff8c95a3844823ed7c9d.tar.bz2
mpv-28a971e26f7318d2081dff8c95a3844823ed7c9d.tar.xz
options: allow using [ ] for quoting in sub-options
This is an attempt to make quoting of sub-option values less awkward, even if it works only with some shells. This is needed mainly for vf_lavfi. Also update the vf_lavfi manpage section.
Diffstat (limited to 'core')
-rw-r--r--core/m_option.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/core/m_option.c b/core/m_option.c
index a0b4808e2e..a667471407 100644
--- a/core/m_option.c
+++ b/core/m_option.c
@@ -1167,6 +1167,13 @@ static int read_subparam(bstr optname, bstr *str, bstr *out_subparam)
return M_OPT_INVALID;
}
p = bstr_cut(p, 1);
+ } else if (bstr_eatstart0(&p, "[")) {
+ if (!bstr_split_tok(p, "]", &subparam, &p)) {
+ mp_msg(MSGT_CFGPARSER, MSGL_ERR,
+ "Terminating ']' missing for '%.*s'\n",
+ BSTR_P(optname));
+ return M_OPT_INVALID;
+ }
} else if (bstr_eatstart0(&p, "%")) {
int optlen = bstrtoll(p, &p, 0);
if (!bstr_startswith0(p, "%") || (optlen > p.len - 1)) {
@@ -1180,7 +1187,7 @@ static int read_subparam(bstr optname, bstr *str, bstr *out_subparam)
} else {
// Skip until the next character that could possibly be a meta
// character in option parsing.
- int optlen = bstrcspn(p, ":=,\\%\"'");
+ int optlen = bstrcspn(p, ":=,\\%\"'[]");
subparam = bstr_splice(p, 0, optlen);
p = bstr_cut(p, optlen);
}