summaryrefslogtreecommitdiffstats
path: root/player/command.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-11-25 20:25:20 +0100
committerwm4 <wm4@nowhere>2019-11-25 20:29:43 +0100
commit7c6570402bb203a1f1deb5b76807a9c021f47e82 (patch)
tree3e1e8411dba9fe8469ca9c9aedddb6721b59cb33 /player/command.c
parent78bb1586d34bcd0cf89267d9447a9cef6ef29761 (diff)
downloadmpv-7c6570402bb203a1f1deb5b76807a9c021f47e82.tar.bz2
mpv-7c6570402bb203a1f1deb5b76807a9c021f47e82.tar.xz
options: remove options-to-property bridge
The previous bunch of commits made this unnecessary, so this should be a purely internal change with no user impact. This may or may not open the way to future improvements. Even if not, at least the property/option interaction should now be much less buggy.
Diffstat (limited to 'player/command.c')
-rw-r--r--player/command.c51
1 files changed, 2 insertions, 49 deletions
diff --git a/player/command.c b/player/command.c
index 744f87abd9..cd8a7959c8 100644
--- a/player/command.c
+++ b/player/command.c
@@ -374,53 +374,6 @@ static char *format_delay(double time)
return talloc_asprintf(NULL, "%d ms", (int)lrint(time * 1000));
}
-// Option-property bridge. This is used so that setting options via various
-// mechanisms (including command line parsing, config files, per-file options)
-// updates state associated with them. For that, they have to go through the
-// property layer. (Ideally, this would be the other way around, and there
-// would be per-option change handlers instead.)
-// Note that the property-option bridge sidesteps this, as we'd get infinite
-// recursion.
-int mp_on_set_option(void *ctx, struct m_config_option *co, void *data, int flags)
-{
- struct MPContext *mpctx = ctx;
- struct command_ctx *cmd = mpctx->command_ctx;
- const char *name = co->name;
-
- // Skip going through mp_property_generic_option (typically), because the
- // property implementation is trivial, and can break some obscure features
- // like --profile and --include if non-trivial flags are involved (which
- // the bridge would drop).
- struct m_property *prop = m_property_list_find(cmd->properties, name);
- if (prop && prop->is_option)
- goto direct_option;
-
- struct m_option type = {0};
-
- int r = mp_property_do_silent(name, M_PROPERTY_GET_TYPE, &type, mpctx);
- if (r == M_PROPERTY_UNKNOWN)
- goto direct_option; // not mapped as property
- if (r != M_PROPERTY_OK)
- return M_OPT_INVALID; // shouldn't happen
-
- assert(type.type == co->opt->type);
- assert(type.max == co->opt->max);
- assert(type.min == co->opt->min);
-
- r = mp_property_do_silent(name, M_PROPERTY_SET, data, mpctx);
- if (r != M_PROPERTY_OK)
- return M_OPT_INVALID;
-
- // The flags can't be passed through the property layer correctly.
- m_config_mark_co_flags(co, flags);
-
- return 0;
-
-direct_option:
- mp_notify_property(mpctx, name);
- return m_config_set_option_raw_direct(mpctx->mconfig, co, data, flags);
-}
-
// Property-option bridge. (Maps the property to the option with the same name.)
static int mp_property_generic_option(void *ctx, struct m_property *prop,
int action, void *arg)
@@ -448,7 +401,7 @@ static int mp_property_generic_option(void *ctx, struct m_property *prop,
m_option_copy(opt->opt, arg, opt->data);
return M_PROPERTY_OK;
case M_PROPERTY_SET:
- if (m_config_set_option_raw_direct(mpctx->mconfig, opt, arg, 0) < 0)
+ if (m_config_set_option_raw(mpctx->mconfig, opt, arg, 0) < 0)
return M_PROPERTY_ERROR;
return M_PROPERTY_OK;
}
@@ -2643,7 +2596,7 @@ skip_warn: ;
return M_PROPERTY_OK;
}
case M_PROPERTY_SET:
- if (m_config_set_option_raw_direct(mpctx->mconfig, opt, arg, 0) < 0)
+ if (m_config_set_option_raw(mpctx->mconfig, opt, arg, 0) < 0)
return M_PROPERTY_ERROR;
return M_PROPERTY_OK;
}