Browse code

lavfi/vf_mergeplanes: move to "activate" design.

Nicolas George authored on 2017/07/17 23:40:28
Showing 2 changed files
... ...
@@ -228,7 +228,7 @@ OBJS-$(CONFIG_LUTYUV_FILTER)                 += vf_lut.o
228 228
 OBJS-$(CONFIG_MASKEDCLAMP_FILTER)            += vf_maskedclamp.o framesync.o
229 229
 OBJS-$(CONFIG_MASKEDMERGE_FILTER)            += vf_maskedmerge.o framesync2.o
230 230
 OBJS-$(CONFIG_MCDEINT_FILTER)                += vf_mcdeint.o
231
-OBJS-$(CONFIG_MERGEPLANES_FILTER)            += vf_mergeplanes.o framesync.o
231
+OBJS-$(CONFIG_MERGEPLANES_FILTER)            += vf_mergeplanes.o framesync2.o
232 232
 OBJS-$(CONFIG_MESTIMATE_FILTER)              += vf_mestimate.o motion_estimation.o
233 233
 OBJS-$(CONFIG_METADATA_FILTER)               += f_metadata.o
234 234
 OBJS-$(CONFIG_MIDEQUALIZER_FILTER)           += vf_midequalizer.o framesync2.o
... ...
@@ -25,7 +25,7 @@
25 25
 #include "libavutil/pixdesc.h"
26 26
 #include "avfilter.h"
27 27
 #include "internal.h"
28
-#include "framesync.h"
28
+#include "framesync2.h"
29 29
 
30 30
 typedef struct InputParam {
31 31
     int depth[4];
... ...
@@ -58,12 +58,6 @@ static const AVOption mergeplanes_options[] = {
58 58
 
59 59
 AVFILTER_DEFINE_CLASS(mergeplanes);
60 60
 
61
-static int filter_frame(AVFilterLink *inlink, AVFrame *in)
62
-{
63
-    MergePlanesContext *s = inlink->dst->priv;
64
-    return ff_framesync_filter_frame(&s->fs, inlink, in);
65
-}
66
-
67 61
 static av_cold int init(AVFilterContext *ctx)
68 62
 {
69 63
     MergePlanesContext *s = ctx->priv;
... ...
@@ -101,7 +95,6 @@ static av_cold int init(AVFilterContext *ctx)
101 101
         pad.name = av_asprintf("in%d", i);
102 102
         if (!pad.name)
103 103
             return AVERROR(ENOMEM);
104
-        pad.filter_frame = filter_frame;
105 104
 
106 105
         if ((ret = ff_insert_inpad(ctx, i, &pad)) < 0){
107 106
             av_freep(&pad.name);
... ...
@@ -150,7 +143,7 @@ static int process_frame(FFFrameSync *fs)
150 150
     int i, ret;
151 151
 
152 152
     for (i = 0; i < s->nb_inputs; i++) {
153
-        if ((ret = ff_framesync_get_frame(&s->fs, i, &in[i], 0)) < 0)
153
+        if ((ret = ff_framesync2_get_frame(&s->fs, i, &in[i], 0)) < 0)
154 154
             return ret;
155 155
     }
156 156
 
... ...
@@ -179,7 +172,7 @@ static int config_output(AVFilterLink *outlink)
179 179
     FFFrameSyncIn *in;
180 180
     int i, ret;
181 181
 
182
-    if ((ret = ff_framesync_init(&s->fs, ctx, s->nb_inputs)) < 0)
182
+    if ((ret = ff_framesync2_init(&s->fs, ctx, s->nb_inputs)) < 0)
183 183
         return ret;
184 184
 
185 185
     in = s->fs.in;
... ...
@@ -272,15 +265,15 @@ static int config_output(AVFilterLink *outlink)
272 272
         }
273 273
     }
274 274
 
275
-    return ff_framesync_configure(&s->fs);
275
+    return ff_framesync2_configure(&s->fs);
276 276
 fail:
277 277
     return AVERROR(EINVAL);
278 278
 }
279 279
 
280
-static int request_frame(AVFilterLink *outlink)
280
+static int activate(AVFilterContext *ctx)
281 281
 {
282
-    MergePlanesContext *s = outlink->src->priv;
283
-    return ff_framesync_request_frame(&s->fs, outlink);
282
+    MergePlanesContext *s = ctx->priv;
283
+    return ff_framesync2_activate(&s->fs);
284 284
 }
285 285
 
286 286
 static av_cold void uninit(AVFilterContext *ctx)
... ...
@@ -288,7 +281,7 @@ static av_cold void uninit(AVFilterContext *ctx)
288 288
     MergePlanesContext *s = ctx->priv;
289 289
     int i;
290 290
 
291
-    ff_framesync_uninit(&s->fs);
291
+    ff_framesync2_uninit(&s->fs);
292 292
 
293 293
     for (i = 0; i < ctx->nb_inputs; i++)
294 294
         av_freep(&ctx->input_pads[i].name);
... ...
@@ -299,7 +292,6 @@ static const AVFilterPad mergeplanes_outputs[] = {
299 299
         .name          = "default",
300 300
         .type          = AVMEDIA_TYPE_VIDEO,
301 301
         .config_props  = config_output,
302
-        .request_frame = request_frame,
303 302
     },
304 303
     { NULL }
305 304
 };
... ...
@@ -312,6 +304,7 @@ AVFilter ff_vf_mergeplanes = {
312 312
     .init          = init,
313 313
     .uninit        = uninit,
314 314
     .query_formats = query_formats,
315
+    .activate      = activate,
315 316
     .inputs        = NULL,
316 317
     .outputs       = mergeplanes_outputs,
317 318
     .flags         = AVFILTER_FLAG_DYNAMIC_INPUTS,