From 40122e3e9fd5568fcba583b6230d006965f23fed Mon Sep 17 00:00:00 2001
From: Paul B Mahol <onemda@gmail.com>
Date: Sat, 27 Aug 2016 22:22:58 +0200
Subject: [PATCH 2/3] avfilter: add ff_filter_get_nb_threads()

---
 libavfilter/avfilter.c | 7 +++++++
 libavfilter/internal.h | 5 +++++
 2 files changed, 12 insertions(+)

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index a8e5a5a..8949c39 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 ctx->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 769e65b..32d37e7 100644
--- a/libavfilter/internal.h
+++ b/libavfilter/internal.h
@@ -402,4 +402,9 @@ static inline int ff_norm_qscale(int qscale, int type)
     return qscale;
 }
 
+/**
+ * Get number of threads for current filter instance.
+ */
+int ff_filter_get_nb_threads(AVFilterContext *ctx);
+
 #endif /* AVFILTER_INTERNAL_H */
-- 
2.9.1

