summaryrefslogtreecommitdiffstats
path: root/player/command.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-05-18 18:57:02 +0200
committerwm4 <wm4@nowhere>2014-05-18 19:21:39 +0200
commitcaa939aa91157937759a8be54f9c794d05fd0120 (patch)
treec607c46bd72131a28ddb808f03ebd56412b566a5 /player/command.c
parentf47a4fc3d900e14653bc059717e2805ad4964a67 (diff)
downloadmpv-caa939aa91157937759a8be54f9c794d05fd0120.tar.bz2
mpv-caa939aa91157937759a8be54f9c794d05fd0120.tar.xz
options: unify code for setting string and "raw" options
The code paths for setting options by string and by direct "raw" value were too different, which resulted in some weird code. Make the code paths closer to each other. Also, use this to remove the weirdness in the mpv_set_option() implementation.
Diffstat (limited to 'player/command.c')
-rw-r--r--player/command.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/player/command.c b/player/command.c
index fd0f589053..5e09079866 100644
--- a/player/command.c
+++ b/player/command.c
@@ -2273,12 +2273,11 @@ static int access_options(struct m_property_action_arg *ka, MPContext *mpctx)
case M_PROPERTY_GET:
m_option_copy(opt->opt, ka->arg, opt->data);
return M_PROPERTY_OK;
- case M_PROPERTY_SET:
- if (!(opt->opt->flags & (M_OPT_PRE_PARSE | M_OPT_FIXED))) {
- m_option_copy(opt->opt, opt->data, ka->arg);
- return M_PROPERTY_OK;
- }
- return M_PROPERTY_ERROR;
+ case M_PROPERTY_SET: {
+ int r = m_config_set_option_raw(mpctx->mconfig, opt, ka->arg,
+ M_SETOPT_RUNTIME);
+ return r < 0 ? M_PROPERTY_ERROR : M_PROPERTY_OK;
+ }
case M_PROPERTY_GET_TYPE:
*(struct m_option *)ka->arg = *opt->opt;
return M_PROPERTY_OK;