diff options
Diffstat (limited to 'options/m_property.c')
-rw-r--r-- | options/m_property.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/options/m_property.c b/options/m_property.c index d0579768c6..9dad34fd1b 100644 --- a/options/m_property.c +++ b/options/m_property.c @@ -36,8 +36,8 @@ #include "common/msg.h" #include "common/common.h" -static struct m_property *m_property_list_find(const struct m_property *list, - const char *name) +struct m_property *m_property_list_find(const struct m_property *list, + const char *name) { for (int n = 0; list && list[n].name; n++) { if (strcmp(list[n].name, name) == 0) @@ -115,6 +115,11 @@ int m_property_do(struct mp_log *log, const struct m_property *prop_list, M_PROPERTY_NOT_IMPLEMENTED) return r; // Fallback to m_option + r = m_property_do(log, prop_list, name, M_PROPERTY_GET_CONSTRICTED_TYPE, + &opt, ctx); + if (r <= 0) + return r; + assert(opt.type); if (!opt.type->add) return M_PROPERTY_NOT_IMPLEMENTED; if ((r = do_action(prop_list, name, M_PROPERTY_GET, &val, ctx)) <= 0) @@ -124,16 +129,14 @@ int m_property_do(struct mp_log *log, const struct m_property *prop_list, m_option_free(&opt, &val); return r; } + case M_PROPERTY_GET_CONSTRICTED_TYPE: { + if ((r = do_action(prop_list, name, action, arg, ctx)) >= 0) + return r; + if ((r = do_action(prop_list, name, M_PROPERTY_GET_TYPE, arg, ctx)) >= 0) + return r; + return M_PROPERTY_NOT_IMPLEMENTED; + } case M_PROPERTY_SET: { - if (!log) - return M_PROPERTY_ERROR; - m_option_copy(&opt, &val, arg); - r = opt.type->clamp ? opt.type->clamp(&opt, arg) : 0; - m_option_free(&opt, &val); - if (r != 0) { - mp_err(log, "Property '%s': invalid value.\n", name); - return M_PROPERTY_ERROR; - } return do_action(prop_list, name, M_PROPERTY_SET, arg, ctx); } case M_PROPERTY_GET_NODE: { |