diff options
author | wm4 <wm4@nowhere> | 2016-06-05 16:56:34 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-06-05 16:56:34 +0200 |
commit | c1cb04b6a3f4fef43bf69b43b5cf7a1e770f3839 (patch) | |
tree | cdbbab6c828cf0657f088814a3136646f545b9b0 /video/out/vo_opengl.c | |
parent | ee337b47becac7316eb890355cf73a6818cbd2b9 (diff) | |
download | mpv-c1cb04b6a3f4fef43bf69b43b5cf7a1e770f3839.tar.bz2 mpv-c1cb04b6a3f4fef43bf69b43b5cf7a1e770f3839.tar.xz |
vo_opengl: apply vo-cmdline command incrementally
Instead of implicitly resetting the options to defaults and then
applying the options, they're always applied on top of the current
options (in the same way adding new options to the CLI command line
will).
This does not apply to vo_opengl_cb, because that has an even worse mess
which I refuse to deal with.
Diffstat (limited to 'video/out/vo_opengl.c')
-rw-r--r-- | video/out/vo_opengl.c | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/video/out/vo_opengl.c b/video/out/vo_opengl.c index ce5c2a5857..4a84e8b3ba 100644 --- a/video/out/vo_opengl.c +++ b/video/out/vo_opengl.c @@ -60,6 +60,8 @@ struct gl_priv { int events; + void *original_opts; + // Options struct gl_video_opts *renderer_opts; int use_glFinish; @@ -245,37 +247,31 @@ static void get_and_update_ambient_lighting(struct gl_priv *p) } } -static bool reparse_cmdline(struct gl_priv *p, char *args) +static const struct m_option options[]; + +static const struct m_sub_options opengl_conf = { + .opts = options, + .size = sizeof(struct gl_priv), +}; + +static bool reparse_cmdline(struct vo *vo, char *args) { - struct m_config *cfg = NULL; - struct gl_priv *opts = NULL; + struct gl_priv *p = vo->priv; int r = 0; - // list of options which can be changed at runtime -#define OPT_BASE_STRUCT struct gl_priv - static const struct m_option change_otps[] = { - OPT_SUBSTRUCT("", renderer_opts, gl_video_conf, 0), - {0} - }; -#undef OPT_BASE_STRUCT + struct gl_priv *opts = p; if (strcmp(args, "-") == 0) { - opts = p; + opts = p->original_opts; } else { - const struct gl_priv *vodef = p->vo->driver->priv_defaults; - cfg = m_config_new(NULL, p->vo->log, sizeof(*opts), vodef, change_otps); - opts = cfg->optstruct; - r = m_config_parse_suboptions(cfg, "opengl", args); + r = m_config_parse_suboptions(vo->config, "opengl", args); } - if (r >= 0) { - gl_video_set_options(p->renderer, opts->renderer_opts); - get_and_update_icc_profile(p); - gl_video_configure_queue(p->renderer, p->vo); - p->vo->want_redraw = true; - } + gl_video_set_options(p->renderer, opts->renderer_opts); + get_and_update_icc_profile(p); + gl_video_configure_queue(p->renderer, p->vo); + p->vo->want_redraw = true; - talloc_free(cfg); return r >= 0; } @@ -322,7 +318,7 @@ static int control(struct vo *vo, uint32_t request, void *data) return true; case VOCTRL_SET_COMMAND_LINE: { char *arg = data; - return reparse_cmdline(p, arg); + return reparse_cmdline(vo, arg); } case VOCTRL_RESET: gl_video_reset(p->renderer); @@ -426,6 +422,8 @@ static int preinit(struct vo *vo) gl_video_set_hwdec(p->renderer, p->hwdec); } + p->original_opts = m_sub_options_copy(p, &opengl_conf, p); + return 0; err_out: |