[FFmpeg-cvslog] avfilter: add ff_filter_get_nb_threads()

Paul B Mahol git at videolan.org
Mon Aug 29 17:33:03 EEST 2016


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sat Aug 27 22:22:58 2016 +0200| [5b1907142dca052c3254d0b4ca3e2ff7ddc7d96b] | committer: Paul B Mahol

avfilter: add ff_filter_get_nb_threads()

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5b1907142dca052c3254d0b4ca3e2ff7ddc7d96b
---

 libavfilter/avfilter.c | 7 +++++++
 libavfilter/internal.h | 6 ++++++
 2 files changed, 13 insertions(+)

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index a8e5a5a..b236535 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 769e65b..3856012 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 */



More information about the ffmpeg-cvslog mailing list