diff options
Diffstat (limited to 'fftools/cmdutils.c')
-rw-r--r-- | fftools/cmdutils.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index 4148285971..6e875104fd 100644 --- a/fftools/cmdutils.c +++ b/fftools/cmdutils.c @@ -71,6 +71,7 @@ AVDictionary *format_opts, *codec_opts, *resample_opts; static FILE *report_file; static int report_file_level = AV_LOG_DEBUG; int hide_banner = 0; +int cpu_count = -1; enum show_muxdemuxers { SHOW_DEFAULT, @@ -853,6 +854,32 @@ int opt_cpuflags(void *optctx, const char *opt, const char *arg) return 0; } +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); + + if (!ret) { + av_force_cpu_count(count); + } + + return ret; +} + int opt_loglevel(void *optctx, const char *opt, const char *arg) { const struct { const char *name; int level; } log_levels[] = { |