aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2016-08-27 22:22:58 +0200
committerPaul B Mahol <onemda@gmail.com>2016-08-29 16:27:09 +0200
commit5b1907142dca052c3254d0b4ca3e2ff7ddc7d96b (patch)
treeb228875fee9680f01b95fe85fda147e207646edb /libavfilter
parent449339084fb2fe9259d8612a9c8c2a886022d1f5 (diff)
downloadffmpeg-5b1907142dca052c3254d0b4ca3e2ff7ddc7d96b.tar.gz
avfilter: add ff_filter_get_nb_threads()
Diffstat (limited to 'libavfilter')
-rw-r--r--libavfilter/avfilter.c7
-rw-r--r--libavfilter/internal.h6
2 files changed, 13 insertions, 0 deletions
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index a8e5a5a73d..b2365354a2 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -783,6 +783,13 @@ void avfilter_free(AVFilterContext *filter)
av_free(filter);
}
+int ff_filter_get_nb_threads(AVFilterContext *ctx)
+{
+ if (ctx->nb_threads > 0)
+ return FFMIN(ctx->nb_threads, ctx->graph->nb_threads);
+ return ctx->graph->nb_threads;
+}
+
static int process_options(AVFilterContext *ctx, AVDictionary **options,
const char *args)
{
diff --git a/libavfilter/internal.h b/libavfilter/internal.h
index 769e65b2fc..3856012aa9 100644
--- a/libavfilter/internal.h
+++ b/libavfilter/internal.h
@@ -402,4 +402,10 @@ static inline int ff_norm_qscale(int qscale, int type)
return qscale;
}
+/**
+ * Get number of threads for current filter instance.
+ * This number is always same or less than graph->nb_threads.
+ */
+int ff_filter_get_nb_threads(AVFilterContext *ctx);
+
#endif /* AVFILTER_INTERNAL_H */