diff options
Diffstat (limited to 'options')
-rw-r--r-- | options/m_config.c | 30 | ||||
-rw-r--r-- | options/options.c | 8 | ||||
-rw-r--r-- | options/options.h | 1 |
3 files changed, 28 insertions, 11 deletions
diff --git a/options/m_config.c b/options/m_config.c index 576527c0c5..1c5fe01293 100644 --- a/options/m_config.c +++ b/options/m_config.c @@ -29,7 +29,6 @@ #include <stdbool.h> #include <pthread.h> -#define HAVE_FNMATCH HAVE_POSIX #if HAVE_FNMATCH #include <fnmatch.h> #endif @@ -269,16 +268,27 @@ struct m_config *m_config_from_obj_desc_noalloc(void *talloc_ctx, return m_config_new(talloc_ctx, log, 0, desc->priv_defaults, desc->options); } +static struct m_config_option *m_config_find_negation_opt(struct m_config *config, + struct bstr *name); + static int m_config_set_obj_params(struct m_config *config, struct mp_log *log, struct mpv_global *global, struct m_obj_desc *desc, char **args) { for (int n = 0; args && args[n * 2 + 0]; n++) { - const char *opt = args[n * 2 + 0]; + bstr opt = bstr0(args[n * 2 + 0]); const char *val = args[n * 2 + 1]; - struct m_config_option *co = m_config_get_co(config, bstr0(opt)); - if (!co) - continue; + struct m_config_option *co = m_config_get_co(config, opt); + if (!co) { + co = m_config_find_negation_opt(config, &opt); + if (!co) + continue; + + if (val && val[0]) + return -1; // no parameter allowed + + val = "no"; + } struct m_config *target = config; bool is_legacy = co->opt->type == &m_option_type_subopt_legacy; bool force_legacy = !!desc->legacy_prefix; @@ -289,16 +299,18 @@ static int m_config_set_obj_params(struct m_config *config, struct mp_log *log, if (is_legacy) { newopt = co->opt->priv; } else { - snprintf(tmp, sizeof(tmp), "%s-%s", desc->legacy_prefix, opt); + snprintf(tmp, sizeof(tmp), "%s-%.*s", desc->legacy_prefix, + BSTR_P(opt)); newopt = tmp; } assert(global); target = mp_get_root_config(global); mp_warn(log, "Using suboptions is deprecated. Use the global '--%s' " - "option instead of '%s' suboption.\n", newopt, opt); - opt = newopt; + "option instead of '%.*s' suboption.\n", newopt, + BSTR_P(opt)); + opt = bstr0(newopt); } - if (m_config_set_option(target, bstr0(opt), bstr0(val)) < 0) + if (m_config_set_option(target, opt, bstr0(val)) < 0) return -1; } diff --git a/options/options.c b/options/options.c index 3b071e3b47..442c29297a 100644 --- a/options/options.c +++ b/options/options.c @@ -93,6 +93,7 @@ const struct m_opt_choice_alternatives mp_hwdec_names[] = { {"yes" , HWDEC_AUTO}, {"auto-copy", HWDEC_AUTO_COPY}, {"vdpau", HWDEC_VDPAU}, + {"vdpau-copy", HWDEC_VDPAU_COPY}, {"videotoolbox",HWDEC_VIDEOTOOLBOX}, {"videotoolbox-copy",HWDEC_VIDEOTOOLBOX_COPY}, {"vaapi", HWDEC_VAAPI}, @@ -186,6 +187,7 @@ static const m_option_t mp_vo_opt_list[] = { OPT_FLAG("fs-black-out-screens", fs_black_out_screens, 0), OPT_FLAG("keepaspect", keepaspect, UPDATE_VIDEOPOS), OPT_FLAG("keepaspect-window", keepaspect_window, 0), + OPT_FLAG("hidpi-window-scale", hidpi_window_scale, 0), #if HAVE_X11 OPT_CHOICE("x11-netwm", x11_netwm, 0, ({"auto", 0}, {"no", -1}, {"yes", 1})), @@ -215,6 +217,7 @@ const struct m_sub_options vo_sub_opts = { .panscan = 0.0f, .keepaspect = 1, .keepaspect_window = 1, + .hidpi_window_scale = 1, .taskbar_progress = 1, .border = 1, .fit_border = 1, @@ -301,7 +304,7 @@ const m_option_t mp_opts[] = { OPT_FLAG("ytdl", lua_load_ytdl, UPDATE_BUILTIN_SCRIPTS), OPT_STRING("ytdl-format", lua_ytdl_format, 0), OPT_KEYVALUELIST("ytdl-raw-options", lua_ytdl_raw_options, 0), - OPT_FLAG("load-scripts", auto_load_scripts, M_OPT_FIXED), + OPT_FLAG("load-scripts", auto_load_scripts, 0), #endif // ------------------------- stream options -------------------- @@ -522,7 +525,8 @@ const m_option_t mp_opts[] = { ({"no", SOFTVOL_NO}, {"yes", SOFTVOL_YES}, {"auto", SOFTVOL_AUTO}), - .deprecation_message = "no replacement"), + .deprecation_message = "softvol is always active, and behaves " + "as if --softvol=yes is always set"), OPT_FLOATRANGE("volume-max", softvol_max, 0, 100, 1000), // values <0 for volume and mute are legacy and ignored OPT_FLOATRANGE("volume", softvol_volume, 0, -1, 1000), diff --git a/options/options.h b/options/options.h index 160223d3e1..4ddf9d1490 100644 --- a/options/options.h +++ b/options/options.h @@ -38,6 +38,7 @@ typedef struct mp_vo_opts { int keepaspect; int keepaspect_window; + int hidpi_window_scale; int64_t WinID; |