Browse Source

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 8 years ago
parent
commit
8f5a2bed5e
2 changed files with 4 additions and 5 deletions
  1. 2 5
      ffmpeg_filter.c
  2. 2 0
      ffmpeg_opt.c

+ 2 - 5
ffmpeg_filter.c

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

+ 2 - 0
ffmpeg_opt.c

@@ -119,6 +119,8 @@ int qp_hist           = 0;
 int stdin_interaction = 1;
 int stdin_interaction = 1;
 int frame_bits_per_raw_sample = 0;
 int frame_bits_per_raw_sample = 0;
 float max_error_rate  = 2.0/3;
 float max_error_rate  = 2.0/3;
+int filter_nbthreads = 0;
+int filter_complex_nbthreads = 0;
 
 
 
 
 static int intra_only         = 0;
 static int intra_only         = 0;