From d32bee5f019f2c51839df16b7c7955dc33651cbe Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 1 Sep 2016 20:00:43 +0200 Subject: command: add options to property list Now options are accessible through the property list as well, which unifies them to a degree. Not all options support runtime changes (meaning affected components need to be restarted for the options to take effects). Remove from the manpage those properties which are cleanly mapped to options anyway. From the user-perspective they're just options available through the property interface. --- player/command.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'player/command.h') diff --git a/player/command.h b/player/command.h index 9ffa5c1340..c082d8d0d7 100644 --- a/player/command.h +++ b/player/command.h @@ -31,7 +31,7 @@ void command_uninit(struct MPContext *mpctx); int run_command(struct MPContext *mpctx, struct mp_cmd *cmd, struct mpv_node *res); char *mp_property_expand_string(struct MPContext *mpctx, const char *str); char *mp_property_expand_escaped_string(struct MPContext *mpctx, const char *str); -void property_print_help(struct mp_log *log); +void property_print_help(struct MPContext *mpctx); int mp_property_do(const char* name, int action, void* val, struct MPContext *mpctx); @@ -40,7 +40,7 @@ void mp_notify_property(struct MPContext *mpctx, const char *property); void handle_command_updates(struct MPContext *mpctx); -int mp_get_property_id(const char *name); +int mp_get_property_id(struct MPContext *mpctx, const char *name); uint64_t mp_get_property_event_mask(const char *name); enum { -- cgit v1.2.3 From a3e8ff624c8adf3b18dddea0fdede7b7fa8c4eb1 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 17 Sep 2016 20:48:22 +0200 Subject: options: take care of propertly updating options on runtime changes All option write accesses are now put through the property interface, which means runtime option value verification and runtime updates are applied. This is done even for command line arguments and config files. This has many subtle and not-so-subtle consequences. The potential for unintended and intended subtle or not-subtle behavior changes is very large. Architecturally, this is us literally jumping through hoops. It really should work the other way around, with options being able to have callbacks for value verification and applying runtime updates. But this would require rewriting the entirety of command.c. This change is more practical, and if anything will at least allow incremental changes. Some options are too incompatible for this to work - these are excluded with an explicit blacklist. This change fixes many issues caused by the mismatch between properties and options. For example, this fixes #3281. --- player/command.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'player/command.h') diff --git a/player/command.h b/player/command.h index c082d8d0d7..33e5b74927 100644 --- a/player/command.h +++ b/player/command.h @@ -24,6 +24,7 @@ struct MPContext; struct mp_cmd; struct mp_log; struct mpv_node; +struct m_config_option; void command_init(struct MPContext *mpctx); void command_uninit(struct MPContext *mpctx); @@ -35,6 +36,8 @@ void property_print_help(struct MPContext *mpctx); int mp_property_do(const char* name, int action, void* val, struct MPContext *mpctx); +int mp_on_set_option(void *ctx, struct m_config_option *co, void *data, int flags); + void mp_notify(struct MPContext *mpctx, int event, void *arg); void mp_notify_property(struct MPContext *mpctx, const char *property); -- cgit v1.2.3 From fe7db610355b623305d08135869b3f4ff4487b6d Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 19 Sep 2016 19:51:26 +0200 Subject: options: slightly better option update mechanism Extend the flag-based notification mechanism that was used via M_OPT_TERM. Make the vo_opengl update mechanism use this (which, btw., also fixes compilation with OpenGL renderers forcibly disabled). While this adds a 3rd mechanism and just seems to further the chaos, I'd rather have a very simple mechanism now, than actually furthering the mess by mixing old and new update mechanisms. In particular, we'll be able to remove quite some property implementations, and replace them with much simpler update handling. The new update mechanism can also more easily refactored once we have a final mechanism that handles everything in an uniform way. --- player/command.h | 1 + 1 file changed, 1 insertion(+) (limited to 'player/command.h') diff --git a/player/command.h b/player/command.h index 33e5b74927..27a4d39913 100644 --- a/player/command.h +++ b/player/command.h @@ -37,6 +37,7 @@ int mp_property_do(const char* name, int action, void* val, struct MPContext *mpctx); int mp_on_set_option(void *ctx, struct m_config_option *co, void *data, int flags); +void mp_option_change_callback(void *ctx, struct m_config_option *co, int flags); void mp_notify(struct MPContext *mpctx, int event, void *arg); void mp_notify_property(struct MPContext *mpctx, const char *property); -- cgit v1.2.3