diff options
author | wm4 <wm4@nowhere> | 2016-09-19 19:51:26 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-09-19 19:51:26 +0200 |
commit | fe7db610355b623305d08135869b3f4ff4487b6d (patch) | |
tree | 563523768617c50b6f41639b0fdc8550871da5c0 /player/command.c | |
parent | 32f235bcef49b268126262f45637b6818767f065 (diff) | |
download | mpv-fe7db610355b623305d08135869b3f4ff4487b6d.tar.bz2 mpv-fe7db610355b623305d08135869b3f4ff4487b6d.tar.xz |
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.
Diffstat (limited to 'player/command.c')
-rw-r--r-- | player/command.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/player/command.c b/player/command.c index 1807f269b9..a4a4263dde 100644 --- a/player/command.c +++ b/player/command.c @@ -5626,17 +5626,20 @@ void mp_notify(struct MPContext *mpctx, int event, void *arg) mp_client_broadcast_event(mpctx, event, arg); } -extern const struct m_sub_options gl_video_conf; +void mp_option_change_callback(void *ctx, struct m_config_option *co, int flags) +{ + struct MPContext *mpctx = ctx; + + if (flags & UPDATE_TERM) + mp_msg_update_msglevels(mpctx->global); + + if (flags & UPDATE_RENDERER) { + if (mpctx->video_out) + vo_control(mpctx->video_out, VOCTRL_UPDATE_RENDER_OPTS, NULL); + } +} void mp_notify_property(struct MPContext *mpctx, const char *property) { - struct m_config_option *co = - m_config_get_co_raw(mpctx->mconfig, bstr0(property)); - if (co) { - if (m_config_is_in_group(mpctx->mconfig, &gl_video_conf, co)) { - if (mpctx->video_out) - vo_control(mpctx->video_out, VOCTRL_UPDATE_RENDER_OPTS, NULL); - } - } mp_client_property_change(mpctx, property); } |