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. --- mpvcore/m_option.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'mpvcore/m_option.c') diff --git a/mpvcore/m_option.c b/mpvcore/m_option.c index c8a656a9c8..095e86a2b5 100644 --- a/mpvcore/m_option.c +++ b/mpvcore/m_option.c @@ -2139,6 +2139,15 @@ static int parse_obj_settings(struct bstr opt, struct bstr *pstr, skip = true; } + if (_ret && desc.init_options) { + struct m_config *config = m_config_from_obj_desc(NULL, &desc); + bstr s = bstr0(desc.init_options); + m_obj_parse_sub_config(opt, str, &s, config, + M_SETOPT_CHECK_ONLY, &plist); + assert(s.len == 0); + talloc_free(config); + } + if (has_param) { if (legacy) { // Should perhaps be parsed as escape-able string. But this is a -- cgit v1.2.3