Browse code

avfilter: add ff_filter_get_nb_threads()

Paul B Mahol authored on 2016/08/28 05:22:58
Showing 2 changed files
... ...
@@ -783,6 +783,13 @@ void avfilter_free(AVFilterContext *filter)
783 783
     av_free(filter);
784 784
 }
785 785
 
786
+int ff_filter_get_nb_threads(AVFilterContext *ctx)
787
+{
788
+     if (ctx->nb_threads > 0)
789
+         return FFMIN(ctx->nb_threads, ctx->graph->nb_threads);
790
+     return ctx->graph->nb_threads;
791
+}
792
+
786 793
 static int process_options(AVFilterContext *ctx, AVDictionary **options,
787 794
                            const char *args)
788 795
 {
... ...
@@ -402,4 +402,10 @@ static inline int ff_norm_qscale(int qscale, int type)
402 402
     return qscale;
403 403
 }
404 404
 
405
+/**
406
+ * Get number of threads for current filter instance.
407
+ * This number is always same or less than graph->nb_threads.
408
+ */
409
+int ff_filter_get_nb_threads(AVFilterContext *ctx);
410
+
405 411
 #endif /* AVFILTER_INTERNAL_H */