Browse code

ffmpeg_filter: fix several logic failures

Move global thread variables to better place.
Use correct variable for simple and complex filtergraphs.

This makes number of threads set per filter work again.

Signed-off-by: Paul B Mahol <onemda@gmail.com>

Paul B Mahol authored on 2016/11/25 00:14:27
Showing 2 changed files
... ...
@@ -39,9 +39,6 @@
39 39
 #include "libavutil/imgutils.h"
40 40
 #include "libavutil/samplefmt.h"
41 41
 
42
-int filter_nbthreads = -1;
43
-int filter_complex_nbthreads = -1;
44
-
45 42
 static const enum AVPixelFormat *get_compliance_unofficial_pix_fmts(enum AVCodecID codec_id, const enum AVPixelFormat default_formats[])
46 43
 {
47 44
     static const enum AVPixelFormat mjpeg_formats[] =
... ...
@@ -993,7 +990,7 @@ int configure_filtergraph(FilterGraph *fg)
993 993
         char args[512];
994 994
         AVDictionaryEntry *e = NULL;
995 995
 
996
-        fg->graph->nb_threads = filter_complex_nbthreads;
996
+        fg->graph->nb_threads = filter_nbthreads;
997 997
 
998 998
         args[0] = 0;
999 999
         while ((e = av_dict_get(ost->sws_dict, "", e,
... ...
@@ -1026,7 +1023,7 @@ int configure_filtergraph(FilterGraph *fg)
1026 1026
         if (e)
1027 1027
             av_opt_set(fg->graph, "threads", e->value, 0);
1028 1028
     } else {
1029
-        fg->graph->nb_threads = filter_nbthreads;
1029
+        fg->graph->nb_threads = filter_complex_nbthreads;
1030 1030
     }
1031 1031
 
1032 1032
     if ((ret = avfilter_graph_parse2(fg->graph, graph_desc, &inputs, &outputs)) < 0)
... ...
@@ -119,6 +119,8 @@ int qp_hist           = 0;
119 119
 int stdin_interaction = 1;
120 120
 int frame_bits_per_raw_sample = 0;
121 121
 float max_error_rate  = 2.0/3;
122
+int filter_nbthreads = 0;
123
+int filter_complex_nbthreads = 0;
122 124
 
123 125
 
124 126
 static int intra_only         = 0;