summaryrefslogtreecommitdiffstats
path: root/m_option.h
diff options
context:
space:
mode:
authorUoti Urpala <uau@mplayer2.org>2011-09-04 14:34:45 +0300
committerUoti Urpala <uau@mplayer2.org>2011-09-04 14:36:09 +0300
commit89b37a32dabc456f35a8e3d828a22861bd292ca8 (patch)
tree607fbba9d6fd42d6700a5bab5282d2ea1fdef17a /m_option.h
parent79469244f72d4350b630b21eac034a81b7b24cba (diff)
downloadmpv-89b37a32dabc456f35a8e3d828a22861bd292ca8.tar.bz2
mpv-89b37a32dabc456f35a8e3d828a22861bd292ca8.tar.xz
options: add "disabled option" functionality
Add functionality to mark options that depend on features disabled at compile time as disabled rather than not compiling the option definitions at all. This allows printing a warning about the option not being available because of a disabled feature, instead of just "unknown option". Because the option definitions are still compiled fully, this only works for definitions that do not reference symbols which are not available if the feature is disabled. Use the new functionality for options depending on libass.
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 78ed856f6d..5b7e051290 100644
--- a/m_option.h
+++ b/m_option.h
@@ -486,6 +486,11 @@ static inline void m_option_free(const m_option_t *opt, void *dst)
#define OPTION_PATH_SEPARATOR ':'
#endif
+// The code will interpret arguments different from 1 as disabled, thus
+// CONFIG_FOO etc mean disabled if no such macro is defined.
+#define OPT_START_CONDITIONAL(enable, featurename) OPT_START_CONDITIONAL_AFTERMACROEVAL(enable, featurename)
+#define OPT_START_CONDITIONAL_AFTERMACROEVAL(enable, featurename) {"conditional functionality: " #enable, .p = featurename}
+
#define OPT_FLAG_ON(optname, varname, flags) {optname, NULL, &m_option_type_flag, flags, 0, 1, NULL, 1, offsetof(struct MPOpts, varname)}
#define OPT_FLAG_OFF(optname, varname, flags) {optname, NULL, &m_option_type_flag, flags, 1, 0, NULL, 1, offsetof(struct MPOpts, varname)}
#define OPT_MAKE_FLAGS(optname, varname, flags) OPT_FLAG_ON(optname, varname, flags), OPT_FLAG_OFF("no" optname, varname, flags)