options/m_property: try to get constricted type in m_property_do
When setting properties via M_PROPERTY_SET_NODE, the property value is limited by static declared range. However, some properties like volume handle dynamic M_PROPERTY_GET_CONSTRICTED_TYPE requests and return runtime determined limits. M_PROPERTY_SET_NODE in this case does not respect that limit, and allows setting to a value out of range. Fix this by always trying to use M_PROPERTY_GET_CONSTRICTED_TYPE first so that the dynamic limits will be used.
This commit is contained in:
1 parent
27ec68fbd8
commit
6320792f1b
1 file changed
+7
@@ -138,6 +138,13 @@ int m_property_do(struct mp_log *log, const struct m_property *prop_list,
|
||||
if (r <= 0)
|
||||
return r;
|
||||
mp_assert(opt.type);
|
||||
// Make sure dynamic range from properties with M_PROPERTY_GET_CONSTRICTED_TYPE is applied
|
||||
struct m_option copt = {0};
|
||||
r = do_action(prop_list, name, M_PROPERTY_GET_CONSTRICTED_TYPE, &copt, ctx);
|
||||
if (r == M_PROPERTY_OK) {
|
||||
opt.min = copt.min;
|
||||
opt.max = copt.max;
|
||||
}
|
||||
|
||||
switch (action) {
|
||||
case M_PROPERTY_FIXED_LEN_PRINT:
|
||||
|
||||
Reference in new issue
Block a user