From c070fa865fcf75cace05bf492a68f6a2c6137fb3 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 27 Jul 2013 21:26:00 +0200 Subject: m_config: refactor some things Change how m_config is initialized. Make it more uniform; now all m_config structs are intialized in exactly the same way. Make sure there's only a single m_option[] array defining the options, and keep around the pointer to the optstruct default value, and the optstruct size as well. This will allow reconstructing the option default values in the following commit. In particular, stop pretending that the handling of some special options (like --profile, --v, and some others) is in any way elegant, and make them explicit hacks. This is really more readable and easier to understand than what was before, and simplifies the code. --- video/out/vo_opengl.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'video') diff --git a/video/out/vo_opengl.c b/video/out/vo_opengl.c index f460ea95f0..2a2dbf9e21 100644 --- a/video/out/vo_opengl.c +++ b/video/out/vo_opengl.c @@ -192,15 +192,15 @@ static int reconfig(struct vo *vo, struct mp_image_params *params, int flags) static bool reparse_cmdline(struct gl_priv *p, char *args) { struct m_config *cfg = NULL; - struct gl_video_opts opts; + struct gl_video_opts *opts = NULL; int r = 0; if (strcmp(args, "-") == 0) { - opts = *p->renderer_opts; + opts = p->renderer_opts; } else { - memcpy(&opts, gl_video_conf.defaults, sizeof(opts)); - cfg = m_config_simple(&opts); - m_config_register_options(cfg, gl_video_conf.opts); + cfg = m_config_new(NULL, sizeof(*opts), gl_video_conf.defaults, + gl_video_conf.opts); + opts = cfg->optstruct; const char *init = p->vo->driver->init_option_string; if (init) m_config_parse_suboptions(cfg, "opengl", (char *)init); @@ -209,7 +209,7 @@ static bool reparse_cmdline(struct gl_priv *p, char *args) if (r >= 0) { mpgl_lock(p->glctx); - gl_video_set_options(p->renderer, &opts); + gl_video_set_options(p->renderer, opts); resize(p); mpgl_unlock(p->glctx); } -- cgit v1.2.3