summaryrefslogtreecommitdiffstats
path: root/options/m_property.h
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2023-09-01 03:07:28 +0200
committerNiklas Haas <github-daiK1o@haasn.dev>2023-10-14 12:30:46 +0200
commit4bbe9618851270eaf5a169b67bff139a65ffbbe4 (patch)
treec179e85af0181133443bfb4183a23300bca7b2d4 /options/m_property.h
parent273906490d00582d26404e470731c97197c96db2 (diff)
downloadmpv-4bbe9618851270eaf5a169b67bff139a65ffbbe4.tar.bz2
mpv-4bbe9618851270eaf5a169b67bff139a65ffbbe4.tar.xz
m_property: add read_sub_validate to check if should be processed
In many cases it makes sense to early exit instead of preparing all the data only to return type or not implemented.
Diffstat (limited to 'options/m_property.h')
-rw-r--r--options/m_property.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/options/m_property.h b/options/m_property.h
index 7e84abc8d7..0dce24600c 100644
--- a/options/m_property.h
+++ b/options/m_property.h
@@ -107,6 +107,9 @@ struct m_property_action_arg {
};
enum mp_property_return {
+ // Returned from validator if action should be executed.
+ M_PROPERTY_VALID = 2,
+
// Returned on success.
M_PROPERTY_OK = 1,
@@ -212,6 +215,8 @@ struct m_sub_property {
#define SUB_PROP_PTS(f) \
.type = {.type = &m_option_type_time}, .value = {.double_ = (f)}
+int m_property_read_sub_validate(void *ctx, struct m_property *prop,
+ int action, void *arg);
int m_property_read_sub(const struct m_sub_property *props, int action, void *arg);