summaryrefslogtreecommitdiffstats
path: root/player/command.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-07-02 16:26:41 +0200
committerwm4 <wm4@nowhere>2017-07-02 16:29:45 +0200
commite4bc563fd2dcff1059624efb7b948b2886a382ab (patch)
tree272d96d980aca685e92083f3097c7eed418e4860 /player/command.c
parentd24f4587a7cb85e559b06d7a191bb28bbdbf52ad (diff)
downloadmpv-e4bc563fd2dcff1059624efb7b948b2886a382ab.tar.bz2
mpv-e4bc563fd2dcff1059624efb7b948b2886a382ab.tar.xz
options: change everything again
Fucking bullshit.
Diffstat (limited to 'player/command.c')
-rw-r--r--player/command.c49
1 files changed, 48 insertions, 1 deletions
diff --git a/player/command.c b/player/command.c
index c7ea6d91f2..bd870e69fd 100644
--- a/player/command.c
+++ b/player/command.c
@@ -3717,6 +3717,37 @@ done:
return mp_property_do(real_property, action, arg, ctx);
}
+static int mp_property_shitfuck(void *ctx, struct m_property *prop,
+ int action, void *arg)
+{
+ MPContext *mpctx = ctx;
+ int flags = M_SETOPT_RUNTIME;
+ const char *rname = prop->priv;
+
+ MP_WARN(mpctx, "Do not use %s, use %s, bug reports will be ignored.\n",
+ prop->name, rname);
+
+ struct m_config_option *co = m_config_get_co_raw(mpctx->mconfig, bstr0(rname));
+ if (!co)
+ return M_PROPERTY_UNKNOWN;
+
+ switch (action) {
+ case M_PROPERTY_GET_TYPE:
+ *(struct m_option *)arg = *(co->opt);
+ return M_PROPERTY_OK;
+ case M_PROPERTY_GET:
+ if (!co->data)
+ return M_PROPERTY_NOT_IMPLEMENTED;
+ m_option_copy(co->opt, arg, co->data);
+ return M_PROPERTY_OK;
+ case M_PROPERTY_SET:
+ if (m_config_set_option_raw_direct(mpctx->mconfig, co, arg, flags) < 0)
+ return M_PROPERTY_ERROR;
+ return M_PROPERTY_OK;
+ }
+ return M_PROPERTY_NOT_IMPLEMENTED;
+}
+
static int access_options(struct m_property_action_arg *ka, bool local,
MPContext *mpctx)
{
@@ -5726,7 +5757,8 @@ void command_init(struct MPContext *mpctx)
for (int n = 0; n < num_opts; n++) {
struct m_config_option *co = m_config_get_co_index(mpctx->mconfig, n);
assert(co->name[0]);
- if (co->opt->flags & M_OPT_NOPROP)
+ if ((co->opt->flags & M_OPT_NOPROP) &&
+ co->opt->type != &m_option_type_cli_alias)
continue;
struct m_property prop = {0};
@@ -5741,6 +5773,21 @@ void command_init(struct MPContext *mpctx)
.priv = (void *)alias,
.is_option = true,
};
+ } else if (co->opt->type == &m_option_type_cli_alias) {
+ bstr rname = bstr0(co->opt->priv);
+ for (int i = rname.len - 1; i >= 0; i--) {
+ if (rname.start[i] == '-') {
+ rname.len = i;
+ break;
+ }
+ }
+
+ prop = (struct m_property){
+ .name = co->name,
+ .call = mp_property_shitfuck,
+ .priv = bstrto0(ctx, rname),
+ .is_option = true,
+ };
} else {
prop = (struct m_property){
.name = co->name,