]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/f_drawgraph.c
libavfilter/vf_blend.c: remove duplicate code with macro-defined function
[ffmpeg] / libavfilter / f_drawgraph.c
index 8be9b9f95a555b040b2c500e8177d3c8702fe18c..955047368dd6d362c9baf21aa555488484979699 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "float.h"
 
+#include "libavutil/avstring.h"
 #include "libavutil/eval.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/opt.h"
@@ -43,7 +44,7 @@ typedef struct DrawGraphContext {
     AVFrame       *out;
     int           x;
     int           prev_y[4];
-    int           first;
+    int           first[4];
     float         *values[4];
     int           values_size[4];
     int           nb_values;
@@ -102,7 +103,7 @@ static av_cold int init(AVFilterContext *ctx)
         }
     }
 
-    s->first = 1;
+    s->first[0] = s->first[1] = s->first[2] = s->first[3] = 1;
 
     if (s->slide == 4) {
         s->values[0] = av_fast_realloc(NULL, &s->values_size[0], 2000);
@@ -215,7 +216,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
         if (!e || !e->value)
             continue;
 
-        if (sscanf(e->value, "%f", &vf) != 1)
+        if (av_sscanf(e->value, "%f", &vf) != 1)
             continue;
 
         vf = av_clipf(vf, s->min, s->max);
@@ -282,8 +283,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
             draw_dot(fg, x, y, out);
             break;
         case 2:
-            if (s->first) {
-                s->first = 0;
+            if (s->first[i]) {
+                s->first[i] = 0;
                 s->prev_y[i] = y;
             }
 
@@ -366,8 +367,8 @@ static int request_frame(AVFilterLink *outlink)
                     draw_dot(fg, x, y, out);
                     break;
                 case 2:
-                    if (s->first) {
-                        s->first = 0;
+                    if (s->first[i]) {
+                        s->first[i] = 0;
                         s->prev_y[i] = y;
                     }