ffmpeg: parameters for filter thread counts

Enables specifying how many threads are available to each filtergraph.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
DeHackEd
2016-10-30 09:25:39 -04:00
committed by Michael Niedermayer
parent b54fd42d7d
commit 6d50dff816
4 changed files with 24 additions and 0 deletions

View File

@@ -39,6 +39,9 @@
#include "libavutil/imgutils.h"
#include "libavutil/samplefmt.h"
int filter_nbthreads = -1;
int filter_complex_nbthreads = -1;
static const enum AVPixelFormat *get_compliance_unofficial_pix_fmts(enum AVCodecID codec_id, const enum AVPixelFormat default_formats[])
{
static const enum AVPixelFormat mjpeg_formats[] =
@@ -991,6 +994,8 @@ int configure_filtergraph(FilterGraph *fg)
char args[512];
AVDictionaryEntry *e = NULL;
fg->graph->nb_threads = filter_complex_nbthreads;
args[0] = 0;
while ((e = av_dict_get(ost->sws_dict, "", e,
AV_DICT_IGNORE_SUFFIX))) {
@@ -1021,6 +1026,8 @@ int configure_filtergraph(FilterGraph *fg)
e = av_dict_get(ost->encoder_opts, "threads", NULL, 0);
if (e)
av_opt_set(fg->graph, "threads", e->value, 0);
} else {
fg->graph->nb_threads = filter_nbthreads;
}
if ((ret = avfilter_graph_parse2(fg->graph, graph_desc, &inputs, &outputs)) < 0)