summaryrefslogtreecommitdiffstats
path: root/player/command.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-06-26 21:07:00 +0200
committerwm4 <wm4@nowhere>2017-06-26 21:07:00 +0200
commit50008adf4af5360f87109d6264aa77ac82f2a80a (patch)
tree051b3b5fa57226e50dfb72cdce00f5d4ba643dbc /player/command.c
parent6f80a694d3de98ce9ddabf1c188865fc6be69710 (diff)
downloadmpv-50008adf4af5360f87109d6264aa77ac82f2a80a.tar.bz2
mpv-50008adf4af5360f87109d6264aa77ac82f2a80a.tar.xz
options: handle suffixes like -add in a more generic way
This affects options like --vf or --display-tags. These used a "*" suffix to match all options starting with a specific name, and handled the rest in the option parser. Change this to remove the "*" special case, and require every option parser to declare a list of allowed suffixes via m_option_type.actions. The new way is conceptually simpler, because we don't have to account for the "*" in a bunch of places anymore, and instead everything is centrally handled in the CLI part of the option parser, where it's actually needed. It automatically enables suffixes like -add for a bunch of other stringlist options.
Diffstat (limited to 'player/command.c')
-rw-r--r--player/command.c25
1 files changed, 0 insertions, 25 deletions
diff --git a/player/command.c b/player/command.c
index bb94fb0892..bc9ee4ab26 100644
--- a/player/command.c
+++ b/player/command.c
@@ -351,15 +351,7 @@ int mp_on_set_option(void *ctx, struct m_config_option *co, void *data, int flag
{
struct MPContext *mpctx = ctx;
struct command_ctx *cmd = mpctx->command_ctx;
-
- // Normalize "vf*" to "vf"
const char *name = co->name;
- bstr bname = bstr0(name);
- char tmp[50];
- if (bstr_eatend0(&bname, "*")) {
- snprintf(tmp, sizeof(tmp), "%.*s", BSTR_P(bname));
- name = tmp;
- }
// Skip going through mp_property_generic_option (typically), because the
// property implementation is trivial, and can break some obscure features
@@ -430,17 +422,6 @@ static int mp_property_generic_option(void *ctx, struct m_property *prop,
return M_PROPERTY_NOT_IMPLEMENTED;
}
-// Dumb special-case: the option name ends in a "*".
-static int mp_property_generic_option_star(void *ctx, struct m_property *prop,
- int action, void *arg)
-{
- struct m_property prop2 = *prop;
- char name[80];
- snprintf(name, sizeof(name), "%s*", prop->name);
- prop2.name = name;
- return mp_property_generic_option(ctx, &prop2, action, arg);
-}
-
/// Playback speed (RW)
static int mp_property_playback_speed(void *ctx, struct m_property *prop,
int action, void *arg)
@@ -5721,12 +5702,6 @@ void command_init(struct MPContext *mpctx)
.call = mp_property_generic_option,
.is_option = true,
};
-
- bstr bname = bstr0(prop.name);
- if (bstr_eatend0(&bname, "*")) {
- prop.name = bstrto0(ctx, bname);
- prop.call = mp_property_generic_option_star;
- }
}
if (prop.name) {