summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-12-18 07:50:08 +0100
committerwm4 <wm4@nowhere>2019-12-18 07:50:48 +0100
commit6ab013cbdd9d627f7cdd5eb1eca8df0da112b929 (patch)
tree6f64f89d9159729caea27310ffce41bd20100e28
parent11d35b72a6fdd58f59ea7e593a4a5267f54b2e54 (diff)
downloadmpv-6ab013cbdd9d627f7cdd5eb1eca8df0da112b929.tar.bz2
mpv-6ab013cbdd9d627f7cdd5eb1eca8df0da112b929.tar.xz
command: make change-list work with pure properties too
Until now, it only worked on options. Useful for the next commit.
-rw-r--r--player/command.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/player/command.c b/player/command.c
index 21d62f965c..8576e36da7 100644
--- a/player/command.c
+++ b/player/command.c
@@ -4473,14 +4473,14 @@ static void cmd_change_list(void *p)
int osd_duration = mpctx->opts->osd_duration;
int osdl = cmd->msg_osd ? 1 : OSD_LEVEL_INVISIBLE;
- struct m_config_option *co = m_config_get_co(mpctx->mconfig, bstr0(name));
- if (!co) {
+ struct m_option prop = {0};
+ if (mp_property_do(name, M_PROPERTY_GET_TYPE, &prop, mpctx) <= 0) {
set_osd_msg(mpctx, osdl, osd_duration, "Unknown option: '%s'", name);
cmd->success = false;
return;
}
- const struct m_option_type *type = co->opt->type;
+ const struct m_option_type *type = prop.type;
bool found = false;
for (int i = 0; type->actions && type->actions[i].name; i++) {
const struct m_option_action *action = &type->actions[i];
@@ -4493,9 +4493,18 @@ static void cmd_change_list(void *p)
return;
}
+ union m_option_value val = {0};
+ if (mp_property_do(name, M_PROPERTY_GET, &val, mpctx) <= 0) {
+ set_osd_msg(mpctx, osdl, osd_duration, "Could not read: '%s'", name);
+ cmd->success = false;
+ return;
+ }
+
char *optname = mp_tprintf(80, "%s-%s", name, op); // the dirty truth
- int r = m_config_set_option_cli(mpctx->mconfig, bstr0(optname),
- bstr0(value), 0);
+ int r = m_option_parse(mpctx->log, &prop, bstr0(optname), bstr0(value), &val);
+ if (r >= 0 && mp_property_do(name, M_PROPERTY_SET, &val, mpctx) <= 0)
+ r = -1;
+ m_option_free(&prop, &val);
if (r < 0) {
set_osd_msg(mpctx, osdl, osd_duration,
"Failed setting option: '%s'", name);