fftools/cmdutils: rename HAS_ARG to OPT_FUNC_ARG

For consistent namespacing with other option flags. Also, document and
enforce that it can only be set for func-type options.
This commit is contained in:
Anton Khirnov
2023-12-17 10:45:45 +01:00
parent d2e479a429
commit 5b1b132072
6 changed files with 80 additions and 70 deletions

View File

@@ -228,7 +228,7 @@ static int opt_has_arg(const OptionDef *o)
if (o->type == OPT_TYPE_BOOL)
return 0;
if (o->type == OPT_TYPE_FUNC)
return !!(o->flags & HAS_ARG);
return !!(o->flags & OPT_FUNC_ARG);
return 1;
}
@@ -323,7 +323,7 @@ int parse_option(void *optctx, const char *opt, const char *arg,
static const OptionDef opt_avoptions = {
.name = "AVOption passthrough",
.type = OPT_TYPE_FUNC,
.flags = HAS_ARG,
.flags = OPT_FUNC_ARG,
.u.func_arg = opt_default,
};
@@ -481,6 +481,10 @@ static void check_options(const OptionDef *po)
while (po->name) {
if (po->flags & OPT_PERFILE)
av_assert0(po->flags & (OPT_INPUT | OPT_OUTPUT));
// OPT_FUNC_ARG can only be ser for OPT_TYPE_FUNC
av_assert0((po->type == OPT_TYPE_FUNC) || !(po->flags & OPT_FUNC_ARG));
po++;
}
}