summaryrefslogtreecommitdiffstats
path: root/options/m_option.h
diff options
context:
space:
mode:
Diffstat (limited to 'options/m_option.h')
-rw-r--r--options/m_option.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/options/m_option.h b/options/m_option.h
index e7446ce663..322f120a06 100644
--- a/options/m_option.h
+++ b/options/m_option.h
@@ -195,6 +195,9 @@ typedef int (*m_opt_generic_validate_fn)(struct mp_log *log, const m_option_t *o
typedef int (*m_opt_string_validate_fn)(struct mp_log *log, const m_option_t *opt,
struct bstr name, const char **value);
+typedef int (*m_opt_int_validate_fn)(struct mp_log *log, const m_option_t *opt,
+ struct bstr name, const int *value);
+
// m_option.priv points to this if OPT_SUBSTRUCT is used
struct m_sub_options {
@@ -674,6 +677,11 @@ extern const char m_option_path_separator;
#define OPT_CHANNELS(field) \
OPT_TYPED_FIELD(m_option_type_channels, struct m_channels, field)
+#define OPT_INT_VALIDATE(field, validate_fn) \
+ OPT_TYPED_FIELD(m_option_type_int, int, field), \
+ .validate = (m_opt_generic_validate_fn) \
+ MP_EXPECT_TYPE(m_opt_int_validate_fn, validate_fn)
+
#define OPT_STRING_VALIDATE(field, validate_fn) \
OPT_TYPED_FIELD(m_option_type_string, char*, field), \
.validate = (m_opt_generic_validate_fn) \