diff --git a/options/m_config.c b/options/m_config.c index cd18e57b9d..470951d233 100644 --- a/options/m_config.c +++ b/options/m_config.c @@ -362,6 +362,9 @@ static void m_config_add_option(struct m_config *config, co.name = talloc_asprintf(config, "%s-%s", parent_name, co.name); } + if (co.opt->deprecation_message) + co.is_hidden = true; + // Option with children -> add them if (arg->type->flags & M_OPT_TYPE_HAS_CHILD) { const struct m_sub_options *subopts = arg->priv; @@ -395,7 +398,6 @@ static void m_config_add_option(struct m_config *config, MP_TARRAY_APPEND(config, config->opts, config->num_opts, co); if (co.opt->type == &m_option_type_alias) { - co.is_hidden = true; const char *alias = (const char *)co.opt->priv; char no_alias[40]; snprintf(no_alias, sizeof(no_alias), "no-%s", alias); @@ -408,9 +410,6 @@ static void m_config_add_option(struct m_config *config, m_config_add_option(config, NULL, NULL, NULL, new); } } - - if (co.opt->type == &m_option_type_removed) - co.is_hidden = true; } struct m_config_option *m_config_get_co(const struct m_config *config, @@ -434,7 +433,9 @@ struct m_config_option *m_config_get_co(const struct m_config *config, const char *prefix = config->is_toplevel ? "--" : ""; if (co->opt->type == &m_option_type_alias) { const char *alias = (const char *)co->opt->priv; - if (!co->warning_was_printed) { + // deprecation_message is not used, but decides whether it's a + // proper or deprecated alias. + if (co->opt->deprecation_message && !co->warning_was_printed) { MP_WARN(config, "Warning: option %s%s was replaced with " "%s%s and might be removed in the future.\n", prefix, co->name, prefix, alias); @@ -788,9 +789,6 @@ void m_config_print_option_list(const struct m_config *config) continue; if (co->is_hidden) continue; - if (opt->type == &m_option_type_alias || - opt->type == &m_option_type_removed) - continue; MP_INFO(config, " %s%-30s", prefix, co->name); if (opt->type == &m_option_type_choice) { MP_INFO(config, " Choices:"); diff --git a/options/m_option.h b/options/m_option.h index bf7ee5939d..c5385e4241 100644 --- a/options/m_option.h +++ b/options/m_option.h @@ -691,13 +691,20 @@ extern const char m_option_path_separator; .type = &m_option_type_subconfig, \ .priv = (void*)&subconf) -// If "--name" was removed, but "--newname" has the same semantics. +// Provide a another name for the option. +#define OPT_ALIAS(optname, newname) \ + {.name = optname, .type = &m_option_type_alias, .priv = newname, \ + .offset = -1} + +// If "--optname" was removed, but "--newname" has the same semantics. // It will be redirected, and a warning will be printed on first use. #define OPT_REPLACED(optname, newname) \ - {.name = optname, .type = &m_option_type_alias, .priv = newname, .offset = -1} + {.name = optname, .type = &m_option_type_alias, .priv = newname, \ + .deprecation_message = "", .offset = -1} -// "--name" doesn't exist, but inform the user about a replacement with msg. +// "--optname" doesn't exist, but inform the user about a replacement with msg. #define OPT_REMOVED(optname, msg) \ - {.name = optname, .type = &m_option_type_removed, .priv = msg, .offset = -1} + {.name = optname, .type = &m_option_type_removed, .priv = msg, \ + .deprecation_message = "", .offset = -1} #endif /* MPLAYER_M_OPTION_H */ diff --git a/options/options.c b/options/options.c index dc880d3339..92eb0fd9c5 100644 --- a/options/options.c +++ b/options/options.c @@ -119,7 +119,7 @@ static const m_option_t mp_vo_opt_list[] = { OPT_FLOATRANGE("monitoraspect", force_monitor_aspect, 0, 0.0, 9.0), OPT_FLOATRANGE("monitorpixelaspect", monitor_pixel_aspect, 0, 0.2, 9.0), OPT_FLAG("fullscreen", fullscreen, M_OPT_FIXED), - OPT_FLAG("fs", fullscreen, M_OPT_FIXED), + OPT_ALIAS("fs", "fullscreen"), OPT_FLAG("native-keyrepeat", native_keyrepeat, M_OPT_FIXED), OPT_FLOATRANGE("panscan", panscan, 0, 0.0, 1.0), OPT_FLOATRANGE("video-zoom", zoom, 0, -20.0, 20.0), @@ -303,9 +303,9 @@ const m_option_t mp_opts[] = { OPT_TRACKCHOICE("ff-aid", stream_id_ff[STREAM_AUDIO]), OPT_TRACKCHOICE("ff-vid", stream_id_ff[STREAM_VIDEO]), OPT_TRACKCHOICE("ff-sid", stream_id_ff[STREAM_SUB]), - OPT_FLAG_STORE("no-sub", stream_id[0][STREAM_SUB], 0, -2), - OPT_FLAG_STORE("no-video", stream_id[0][STREAM_VIDEO], 0, -2), - OPT_FLAG_STORE("no-audio", stream_id[0][STREAM_AUDIO], 0, -2), + OPT_ALIAS("sub", "sid"), + OPT_ALIAS("video", "vid"), + OPT_ALIAS("audio", "aid"), OPT_STRINGLIST("alang", stream_lang[STREAM_AUDIO], 0), OPT_STRINGLIST("slang", stream_lang[STREAM_SUB], 0), @@ -689,7 +689,6 @@ const m_option_t mp_opts[] = { OPT_REPLACED("ss", "start"), OPT_REPLACED("stop-xscreensaver", "stop-screensaver"), OPT_REPLACED("sub-fuzziness", "sub-auto"), - OPT_REPLACED("sub", "sub-file"), OPT_REPLACED("subcp", "sub-codepage"), OPT_REPLACED("subdelay", "sub-delay"), OPT_REPLACED("subfile", "sub-file"),