From b8193e40719a2a72d9b25e8ea3070c0e84beb48e Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 15 Jun 2017 15:22:06 +0200 Subject: command: add all options to property->option bridge Before this, options with co->data==NULL (i.e. no storage) were not added to the bridge (except alias options). There are a few options which might make sense to allow via the bridge ("profile" and "include"). So allow them. In command_init(), we merely remove the co->data check, the rest of the diff is due to switching the if/else branches for convenience. We also must explicitly error on M_PROPERTY_GET if co->data==NULL. All other cases check it in some way. Explicitly exclude options from the property bridge, which would be added due this, and the result would be pointless. --- options/m_option.h | 4 ++-- options/options.c | 18 +++++++++++------- 2 files changed, 13 insertions(+), 9 deletions(-) (limited to 'options') diff --git a/options/m_option.h b/options/m_option.h index 8f4e5e6a5c..78db2b5c85 100644 --- a/options/m_option.h +++ b/options/m_option.h @@ -693,7 +693,7 @@ extern const char m_option_path_separator; #define OPT_PRINT(optname, fn) \ {.name = optname, \ - .flags = M_OPT_FIXED | M_OPT_NOCFG | M_OPT_PRE_PARSE, \ + .flags = M_OPT_FIXED | M_OPT_NOCFG | M_OPT_PRE_PARSE | M_OPT_NOPROP, \ .type = &m_option_type_print_fn, \ .priv = MP_EXPECT_TYPE(m_opt_print_fn, fn), \ .offset = -1} @@ -726,6 +726,6 @@ extern const char m_option_path_separator; // "--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, \ - .deprecation_message = "", .offset = -1} + .deprecation_message = "", .flags = M_OPT_NOPROP, .offset = -1} #endif /* MPLAYER_M_OPTION_H */ diff --git a/options/options.c b/options/options.c index 1bcdc720f2..90cbe61d6f 100644 --- a/options/options.c +++ b/options/options.c @@ -254,21 +254,25 @@ const struct m_sub_options dvd_conf = { const m_option_t mp_opts[] = { // handled in command line pre-parser (parse_commandline.c) - {"v", CONF_TYPE_STORE, M_OPT_FIXED | CONF_NOCFG, .offset = -1}, + {"v", CONF_TYPE_STORE, M_OPT_FIXED | CONF_NOCFG | M_OPT_NOPROP, .offset = -1}, {"playlist", CONF_TYPE_STRING, CONF_NOCFG | M_OPT_MIN | M_OPT_FIXED | M_OPT_FILE, .min = 1, .offset = -1}, - {"{", CONF_TYPE_STORE, CONF_NOCFG | M_OPT_FIXED, .offset = -1}, - {"}", CONF_TYPE_STORE, CONF_NOCFG | M_OPT_FIXED, .offset = -1}, + {"{", CONF_TYPE_STORE, CONF_NOCFG | M_OPT_FIXED | M_OPT_NOPROP, .offset = -1}, + {"}", CONF_TYPE_STORE, CONF_NOCFG | M_OPT_FIXED | M_OPT_NOPROP, .offset = -1}, // handled in m_config.c { "include", CONF_TYPE_STRING, M_OPT_FILE, .offset = -1}, { "profile", CONF_TYPE_STRING_LIST, 0, .offset = -1}, - { "show-profile", CONF_TYPE_STRING, CONF_NOCFG | M_OPT_FIXED, .offset = -1}, - { "list-options", CONF_TYPE_STORE, CONF_NOCFG | M_OPT_FIXED, .offset = -1}, + { "show-profile", CONF_TYPE_STRING, CONF_NOCFG | M_OPT_FIXED | M_OPT_NOPROP, + .offset = -1}, + { "list-options", CONF_TYPE_STORE, CONF_NOCFG | M_OPT_FIXED | M_OPT_NOPROP, + .offset = -1}, OPT_FLAG("list-properties", property_print_help, CONF_NOCFG | M_OPT_FIXED | M_OPT_NOPROP), - { "help", CONF_TYPE_STRING, CONF_NOCFG | M_OPT_FIXED, .offset = -1}, - { "h", CONF_TYPE_STRING, CONF_NOCFG | M_OPT_FIXED, .offset = -1}, + { "help", CONF_TYPE_STRING, CONF_NOCFG | M_OPT_FIXED | M_OPT_NOPROP, + .offset = -1}, + { "h", CONF_TYPE_STRING, CONF_NOCFG | M_OPT_FIXED | M_OPT_NOPROP, + .offset = -1}, OPT_PRINT("list-protocols", stream_print_proto_list), OPT_PRINT("version", print_version), -- cgit v1.2.3