From 60aea74f4483661e34b12571add07f8e5e136660 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 24 Oct 2013 22:20:16 +0200 Subject: m_config: refactor option defaults handling Keep track of the default values directly, instead of creating a new instance of the option struct just to get the defaults. Also get rid of the special handling of m_obj_desc.init_options. Instead, handle it purely by the option parser. Originally, I wanted to handle --vo=opengl-hq and --vo=direct3d_shaders with this (by making them aliases to the real VOs with a different preset), but since --vo =opengl-hq=help prints the wrong values (as consequence of the simplification), I'm not doing that, and instead use something different. --- video/out/vo_opengl.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'video/out/vo_opengl.c') diff --git a/video/out/vo_opengl.c b/video/out/vo_opengl.c index e1c07d8621..cf1b3b3400 100644 --- a/video/out/vo_opengl.c +++ b/video/out/vo_opengl.c @@ -200,9 +200,10 @@ static bool reparse_cmdline(struct gl_priv *p, char *args) if (strcmp(args, "-") == 0) { opts = p->renderer_opts; } else { - cfg = m_config_new(NULL, sizeof(*opts), gl_video_conf.defaults, - gl_video_conf.opts, - p->vo->driver->init_option_string); + const struct gl_priv *vodef = p->vo->driver->priv_defaults; + const struct gl_video_opts *def = + vodef ? vodef->renderer_opts : gl_video_conf.defaults; + cfg = m_config_new(NULL, sizeof(*opts), def, gl_video_conf.opts); opts = cfg->optstruct; r = m_config_parse_suboptions(cfg, "opengl", args); } @@ -376,6 +377,8 @@ const struct vo_driver video_out_opengl_hq = { .flip_page = flip_page, .uninit = uninit, .priv_size = sizeof(struct gl_priv), + .priv_defaults = &(const struct gl_priv){ + .renderer_opts = (struct gl_video_opts *)&gl_video_opts_hq_def, + }, .options = options, - .init_option_string = "lscale=lanczos2:dither-depth=auto:fbo-format=rgb16", }; -- cgit v1.2.3