@@ -856,28 +856,15 @@ int opt_cpuflags(void *optctx, const char *opt, const char *arg)
int opt_cpucount(void *optctx, const char *opt, const char *arg)
{
- int ret;
- int count;
-
- static const AVOption opts[] = {
- {"count", NULL, 0, AV_OPT_TYPE_INT, { .i64 = -1}, -1, INT_MAX, NULL},
- {NULL},
- };
- static const AVClass class = {
- .class_name = "cpucount",
- .item_name = av_default_item_name,
- .option = opts,
- .version = LIBAVUTIL_VERSION_INT,
- };
- const AVClass *pclass = &class;
-
- ret = av_opt_eval_int(&pclass, opts, arg, &count);
+ char *tail;
+ int64_t count;
- if (!ret) {
- av_force_cpu_count(count);
- }
+ count = strtol(arg, &tail, 10);
+ if (*tail || count < -1 || count > INT_MAX)
+ return AVERROR(EINVAL);
- return ret;
+ av_force_cpu_count(count);
+ return 0;
}
int opt_loglevel(void *optctx, const char *opt, const char *arg)
Signed-off-by: James Almer <jamrial@gmail.com> --- fftools/cmdutils.c | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-)