[FFmpeg-devel] [PATCH] ffmpeg: allow to pass "auto" to filter_threads
James Almer
jamrial at gmail.com
Fri Sep 3 15:52:22 EEST 2021
This way it accepts the same values as the libavcodec specific option "threads"
Fixes FATE with THREADS=auto which was broken in bdc1bdf3f5
Signed-off-by: James Almer <jamrial at gmail.com>
---
fftools/ffmpeg_opt.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 428934a3d8..2a0b3fbd4f 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -264,6 +264,24 @@ static AVDictionary *strip_specifiers(AVDictionary *dict)
return ret;
}
+static int opt_filter_threads(void *optctx, const char *opt, const char *arg)
+{
+ static const AVOption opts[] = {
+ { "filter_threads", NULL, 0, AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, .unit = "filter_threads"},
+ { "auto", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 0 }, .unit = "filter_threads"},
+ { NULL },
+ };
+ static const AVClass class = {
+ .class_name = "",
+ .item_name = av_default_item_name,
+ .option = opts,
+ .version = LIBAVUTIL_VERSION_INT,
+ };
+ const AVClass *pclass = &class;
+
+ return av_opt_eval_int(&pclass, &opts[0], arg, &filter_nbthreads);
+}
+
static int opt_abort_on(void *optctx, const char *opt, const char *arg)
{
static const AVOption opts[] = {
@@ -3620,7 +3638,7 @@ const OptionDef options[] = {
"set profile", "profile" },
{ "filter", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(filters) },
"set stream filtergraph", "filter_graph" },
- { "filter_threads", HAS_ARG | OPT_INT, { &filter_nbthreads },
+ { "filter_threads", HAS_ARG, { .func_arg = opt_filter_threads },
"number of non-complex filter threads" },
{ "filter_script", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(filter_scripts) },
"read stream filtergraph description from a file", "filename" },
--
2.33.0
More information about the ffmpeg-devel
mailing list