fftools/cmdutils.c: Add cmd line option to override detection of cpu count.

This commit is contained in:
Thilo Borgmann
2021-06-06 15:15:50 +02:00
parent 87951dcbe7
commit cf12a478b2
3 changed files with 41 additions and 0 deletions

View File

@@ -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[] = {