diff --git a/options/m_config_frontend.c b/options/m_config_frontend.c index 28db357dd1..1182983d31 100644 --- a/options/m_config_frontend.c +++ b/options/m_config_frontend.c @@ -662,10 +662,13 @@ static struct m_config_option *m_config_mogrify_cli_opt(struct m_config *config, bstr no_name = *name; if (!co && bstr_eatstart0(&no_name, "no-")) { co = m_config_get_co(config, no_name); + if (!co) + return NULL; // Not all choice types have this value - if they don't, then parsing // them will simply result in an error. Good enough. - if (!co || !(co->opt->type->flags & M_OPT_TYPE_CHOICE)) + if (!(co->opt->type->flags & M_OPT_TYPE_CHOICE) && + !(co->opt->flags & M_OPT_ALLOW_NO)) return NULL; *name = no_name; diff --git a/options/m_option.h b/options/m_option.h index 7facb563e1..63a6966774 100644 --- a/options/m_option.h +++ b/options/m_option.h @@ -468,6 +468,8 @@ char *format_file_size(int64_t size); #define M_OPT_DEFAULT_NAN (1 << 26) // type time: string "no" maps to MP_NOPTS_VALUE (if unset, NOPTS is rejected) +// and +// parsing: "--no-opt" is parsed as "--opt=no" #define M_OPT_ALLOW_NO (1 << 27) // type channels: disallow "auto" (still accept ""), limit list to at most 1 item. diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c index cf65cd0ff0..d75f2d7530 100644 --- a/video/decode/vd_lavc.c +++ b/video/decode/vd_lavc.c @@ -124,7 +124,7 @@ const struct m_sub_options vd_lavc_conf = { {"vd-apply-cropping", OPT_BOOL(apply_cropping)}, {"hwdec", OPT_STRINGLIST(hwdec_api), .help = hwdec_opt_help, - .flags = M_OPT_OPTIONAL_PARAM | UPDATE_HWDEC}, + .flags = M_OPT_OPTIONAL_PARAM | M_OPT_ALLOW_NO | UPDATE_HWDEC}, {"hwdec-codecs", OPT_STRING(hwdec_codecs)}, {"hwdec-image-format", OPT_IMAGEFORMAT(hwdec_image_format)}, {"hwdec-extra-frames", OPT_INT(hwdec_extra_frames), M_RANGE(0, 256)},