summaryrefslogtreecommitdiffstats
path: root/command.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-09-26 23:56:29 +0200
committerwm4 <wm4@nowhere>2012-10-12 10:10:32 +0200
commit8fc2aef3b7f95a10de01a9f441907b9cd5d41c45 (patch)
tree99258161ba09bf910a880873702e1f88c7912650 /command.c
parent46e8d338092a2060300de9953d01778806d87d6d (diff)
downloadmpv-8fc2aef3b7f95a10de01a9f441907b9cd5d41c45.tar.bz2
mpv-8fc2aef3b7f95a10de01a9f441907b9cd5d41c45.tar.xz
commands: don't use dummy option declaration for properties
The property-to-option bridge (when properties change values normally set by the command line parser) uses M_PROPERTY_GET_TYPE to get the exact option type. In these cases, the entry in mp_properties[] is unused, except for the name field and the property callback. Instead, mp_property_generic_option() implements M_PROPERTY_GET_TYPE and returns the m_option as defined in cfg-mplayer.h. However, if a property is unavailable, mp_property_generic_option() is never actually called, and M_PROPERTY_GET_TYPE will return the dummy option entry. We could make sure that the dummy option entry equals the option entry defined in cfg-mplayer.h. But this would duplicate all information. Add a dummy option type m_option_type_dummy, which is used by entries using the property-to-option bridge. Make M_PROPERTY_GET_TYPE fail if this type is encountered. This dummy should never be used, as it isn
Diffstat (limited to 'command.c')
-rw-r--r--command.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/command.c b/command.c
index bda3e6755e..b736a56fde 100644
--- a/command.c
+++ b/command.c
@@ -1329,14 +1329,14 @@ static int mp_property_tv_color(m_option_t *prop, int action, void *arg,
// Use option-to-property-bridge. (The property and option have the same names.)
#define M_OPTION_PROPERTY(name) \
- {(name), mp_property_generic_option, &m_option_type_choice, 0, 0, 0, (name)}
+ {(name), mp_property_generic_option, &m_option_type_dummy, 0, 0, 0, (name)}
// OPTION_PROPERTY(), but with a custom property handler. The custom handler
// must let unknown operations fall back to mp_property_generic_option().
#define M_OPTION_PROPERTY_CUSTOM(name, handler) \
- {(name), (handler), &m_option_type_choice, 0, 0, 0, (name)}
+ {(name), (handler), &m_option_type_dummy, 0, 0, 0, (name)}
#define M_OPTION_PROPERTY_CUSTOM_(name, handler, ...) \
- {(name), (handler), &m_option_type_choice, 0, 0, 0, (name), __VA_ARGS__}
+ {(name), (handler), &m_option_type_dummy, 0, 0, 0, (name), __VA_ARGS__}
/// All properties available in MPlayer.
/** \ingroup Properties