Browse Source

avfilter: add ff_filter_get_nb_threads()

tags/n3.2
Paul B Mahol 9 years ago
parent
commit
5b1907142d
2 changed files with 13 additions and 0 deletions
  1. +7
    -0
      libavfilter/avfilter.c
  2. +6
    -0
      libavfilter/internal.h

+ 7
- 0
libavfilter/avfilter.c View File

@@ -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)
{


+ 6
- 0
libavfilter/internal.h View File

@@ -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 */

Loading…
Cancel
Save