summaryrefslogtreecommitdiffstats
path: root/m_option.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-09-18 14:00:08 +0200
committerwm4 <wm4@nowhere>2012-10-12 10:10:31 +0200
commitcac7702565b560d5a16bc82bf553d1a4c08297e1 (patch)
tree5d1246e28da246dc26fa54de267c35545ac0f09f /m_option.h
parent3d67041089c7945dcea0162c0038e495d588b379 (diff)
downloadmpv-cac7702565b560d5a16bc82bf553d1a4c08297e1.tar.bz2
mpv-cac7702565b560d5a16bc82bf553d1a4c08297e1.tar.xz
commands: handle property stepping in a generic way
Instead of forcing each property implementation implement its own logic for M_PROPERTY_STEP_UP/M_PROPERTY_STEP_DOWN, handle it in the generic property code. Rename the M_PROPERTY_STEP_UP command to M_PROPERTY_SWITCH (the other property command, M_PROPERTY_STEP_DOWN, isn't needed anymore: stepping downwards is done by passing a negative argument). Always use double as argument type; it makes the code easier, and covers all property types. Move the code which does the actual type-specific value stepping to m_option.c (the idea is that m_option handles types). Some properties still have custom handlers implemented with M_PROPERTY_SWITCH. They can't be mapped to the generic mechanism, because their value range is dynamic or entirely unknown. For some properties, the default step stride is changed to 1. This is no issue, because the default bindings in input.conf all use an explicit stride in the affected cases.
Diffstat (limited to 'm_option.h')
-rw-r--r--m_option.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/m_option.h b/m_option.h
index 73752e7a56..75f9ee5925 100644
--- a/m_option.h
+++ b/m_option.h
@@ -222,6 +222,11 @@ struct m_option_type {
* set to NULL.
*/
void (*free)(void *dst);
+
+ // Add the value add to the value in val. For types that are not numeric,
+ // add gives merely the direction. The wrap parameter determines whether
+ // the value is clipped, or wraps around to the opposite max/min.
+ void (*add)(const m_option_t *opt, void *val, double add, bool wrap);
};
// Option description