summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-06-15 15:22:06 +0200
committerwm4 <wm4@nowhere>2017-06-15 15:29:54 +0200
commitb8193e40719a2a72d9b25e8ea3070c0e84beb48e (patch)
tree489acbb02a0d443856853881096e650ce78fd69a /player
parentfd7de84833a7f492678e0caa18125ff9f9aa38a5 (diff)
downloadmpv-b8193e40719a2a72d9b25e8ea3070c0e84beb48e.tar.bz2
mpv-b8193e40719a2a72d9b25e8ea3070c0e84beb48e.tar.xz
command: add all options to property->option bridge
Before this, options with co->data==NULL (i.e. no storage) were not added to the bridge (except alias options). There are a few options which might make sense to allow via the bridge ("profile" and "include"). So allow them. In command_init(), we merely remove the co->data check, the rest of the diff is due to switching the if/else branches for convenience. We also must explicitly error on M_PROPERTY_GET if co->data==NULL. All other cases check it in some way. Explicitly exclude options from the property bridge, which would be added due this, and the result would be pointless.
Diffstat (limited to 'player')
-rw-r--r--player/command.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/player/command.c b/player/command.c
index af7d4006d7..cdef20d7a3 100644
--- a/player/command.c
+++ b/player/command.c
@@ -402,14 +402,14 @@ static int mp_property_generic_option(void *ctx, struct m_property *prop,
if (!opt)
return M_PROPERTY_UNKNOWN;
- void *valptr = opt->data;
-
switch (action) {
case M_PROPERTY_GET_TYPE:
*(struct m_option *)arg = *(opt->opt);
return M_PROPERTY_OK;
case M_PROPERTY_GET:
- m_option_copy(opt->opt, arg, valptr);
+ if (!opt->data)
+ return M_PROPERTY_NOT_IMPLEMENTED;
+ 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, flags) < 0)
@@ -5672,7 +5672,16 @@ void command_init(struct MPContext *mpctx)
struct m_property prop = {0};
- if (co->data) {
+ if (co->opt->type == &m_option_type_alias) {
+ const char *alias = (const char *)co->opt->priv;
+
+ prop = (struct m_property){
+ .name = co->name,
+ .call = co->opt->deprecation_message ?
+ mp_property_deprecated_alias : mp_property_alias,
+ .priv = (void *)alias,
+ };
+ } else {
prop = (struct m_property){
.name = co->name,
.call = mp_property_generic_option,
@@ -5683,15 +5692,6 @@ void command_init(struct MPContext *mpctx)
prop.name = bstrto0(ctx, bname);
prop.call = mp_property_generic_option_star;
}
- } else if (co->opt->type == &m_option_type_alias) {
- const char *alias = (const char *)co->opt->priv;
-
- prop = (struct m_property){
- .name = co->name,
- .call = co->opt->deprecation_message ?
- mp_property_deprecated_alias : mp_property_alias,
- .priv = (void *)alias,
- };
}
if (prop.name) {