You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
fftools/cmdutils.c: Add cmd line option to override detection of cpu count.
This commit is contained in:
@@ -353,6 +353,13 @@ Possible flags for this option are:
|
|||||||
@end table
|
@end table
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
|
@item -cpucount @var{count} (@emph{global})
|
||||||
|
Override detection of CPU count. This option is intended
|
||||||
|
for testing. Do not use it unless you know what you're doing.
|
||||||
|
@example
|
||||||
|
ffmpeg -cpucount 2
|
||||||
|
@end example
|
||||||
|
|
||||||
@item -max_alloc @var{bytes}
|
@item -max_alloc @var{bytes}
|
||||||
Set the maximum size limit for allocating a block on the heap by ffmpeg's
|
Set the maximum size limit for allocating a block on the heap by ffmpeg's
|
||||||
family of malloc functions. Exercise @strong{extreme caution} when using
|
family of malloc functions. Exercise @strong{extreme caution} when using
|
||||||
|
@@ -71,6 +71,7 @@ AVDictionary *format_opts, *codec_opts, *resample_opts;
|
|||||||
static FILE *report_file;
|
static FILE *report_file;
|
||||||
static int report_file_level = AV_LOG_DEBUG;
|
static int report_file_level = AV_LOG_DEBUG;
|
||||||
int hide_banner = 0;
|
int hide_banner = 0;
|
||||||
|
int cpu_count = -1;
|
||||||
|
|
||||||
enum show_muxdemuxers {
|
enum show_muxdemuxers {
|
||||||
SHOW_DEFAULT,
|
SHOW_DEFAULT,
|
||||||
@@ -853,6 +854,32 @@ int opt_cpuflags(void *optctx, const char *opt, const char *arg)
|
|||||||
return 0;
|
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)
|
int opt_loglevel(void *optctx, const char *opt, const char *arg)
|
||||||
{
|
{
|
||||||
const struct { const char *name; int level; } log_levels[] = {
|
const struct { const char *name; int level; } log_levels[] = {
|
||||||
|
@@ -50,6 +50,7 @@ extern AVDictionary *sws_dict;
|
|||||||
extern AVDictionary *swr_opts;
|
extern AVDictionary *swr_opts;
|
||||||
extern AVDictionary *format_opts, *codec_opts, *resample_opts;
|
extern AVDictionary *format_opts, *codec_opts, *resample_opts;
|
||||||
extern int hide_banner;
|
extern int hide_banner;
|
||||||
|
extern int cpu_count;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a program-specific cleanup routine.
|
* Register a program-specific cleanup routine.
|
||||||
@@ -88,6 +89,11 @@ void log_callback_help(void* ptr, int level, const char* fmt, va_list vl);
|
|||||||
*/
|
*/
|
||||||
int opt_cpuflags(void *optctx, const char *opt, const char *arg);
|
int opt_cpuflags(void *optctx, const char *opt, const char *arg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Override the cpucount.
|
||||||
|
*/
|
||||||
|
int opt_cpucount(void *optctx, const char *opt, const char *arg);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fallback for options that are not explicitly handled, these will be
|
* Fallback for options that are not explicitly handled, these will be
|
||||||
* parsed through AVOptions.
|
* parsed through AVOptions.
|
||||||
@@ -239,6 +245,7 @@ void show_help_options(const OptionDef *options, const char *msg, int req_flags,
|
|||||||
{ "report", 0, { .func_arg = opt_report }, "generate a report" }, \
|
{ "report", 0, { .func_arg = opt_report }, "generate a report" }, \
|
||||||
{ "max_alloc", HAS_ARG, { .func_arg = opt_max_alloc }, "set maximum size of a single allocated block", "bytes" }, \
|
{ "max_alloc", HAS_ARG, { .func_arg = opt_max_alloc }, "set maximum size of a single allocated block", "bytes" }, \
|
||||||
{ "cpuflags", HAS_ARG | OPT_EXPERT, { .func_arg = opt_cpuflags }, "force specific cpu flags", "flags" }, \
|
{ "cpuflags", HAS_ARG | OPT_EXPERT, { .func_arg = opt_cpuflags }, "force specific cpu flags", "flags" }, \
|
||||||
|
{ "cpucount", HAS_ARG | OPT_EXPERT, { .func_arg = opt_cpucount }, "force specific cpu count", "count" }, \
|
||||||
{ "hide_banner", OPT_BOOL | OPT_EXPERT, {&hide_banner}, "do not show program banner", "hide_banner" }, \
|
{ "hide_banner", OPT_BOOL | OPT_EXPERT, {&hide_banner}, "do not show program banner", "hide_banner" }, \
|
||||||
CMDUTILS_COMMON_OPTIONS_AVDEVICE \
|
CMDUTILS_COMMON_OPTIONS_AVDEVICE \
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user