Browse code

lavfi/vf_maskedclamp: move to "activate" design.

Nicolas George authored on 2017/07/17 23:42:14
Showing 2 changed files
... ...
@@ -225,7 +225,7 @@ OBJS-$(CONFIG_LUT2_FILTER)                   += vf_lut2.o framesync.o
225 225
 OBJS-$(CONFIG_LUT3D_FILTER)                  += vf_lut3d.o
226 226
 OBJS-$(CONFIG_LUTRGB_FILTER)                 += vf_lut.o
227 227
 OBJS-$(CONFIG_LUTYUV_FILTER)                 += vf_lut.o
228
-OBJS-$(CONFIG_MASKEDCLAMP_FILTER)            += vf_maskedclamp.o framesync.o
228
+OBJS-$(CONFIG_MASKEDCLAMP_FILTER)            += vf_maskedclamp.o framesync2.o
229 229
 OBJS-$(CONFIG_MASKEDMERGE_FILTER)            += vf_maskedmerge.o framesync2.o
230 230
 OBJS-$(CONFIG_MCDEINT_FILTER)                += vf_mcdeint.o
231 231
 OBJS-$(CONFIG_MERGEPLANES_FILTER)            += vf_mergeplanes.o framesync2.o
... ...
@@ -25,7 +25,7 @@
25 25
 #include "formats.h"
26 26
 #include "internal.h"
27 27
 #include "video.h"
28
-#include "framesync.h"
28
+#include "framesync2.h"
29 29
 
30 30
 #define OFFSET(x) offsetof(MaskedClampContext, x)
31 31
 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
... ...
@@ -93,9 +93,9 @@ static int process_frame(FFFrameSync *fs)
93 93
     AVFrame *out, *base, *dark, *bright;
94 94
     int ret;
95 95
 
96
-    if ((ret = ff_framesync_get_frame(&s->fs, 0, &base,   0)) < 0 ||
97
-        (ret = ff_framesync_get_frame(&s->fs, 1, &dark,   0)) < 0 ||
98
-        (ret = ff_framesync_get_frame(&s->fs, 2, &bright, 0)) < 0)
96
+    if ((ret = ff_framesync2_get_frame(&s->fs, 0, &base,   0)) < 0 ||
97
+        (ret = ff_framesync2_get_frame(&s->fs, 1, &dark,   0)) < 0 ||
98
+        (ret = ff_framesync2_get_frame(&s->fs, 2, &bright, 0)) < 0)
99 99
         return ret;
100 100
 
101 101
     if (ctx->is_disabled) {
... ...
@@ -265,7 +265,7 @@ static int config_output(AVFilterLink *outlink)
265 265
     outlink->sample_aspect_ratio = base->sample_aspect_ratio;
266 266
     outlink->frame_rate = base->frame_rate;
267 267
 
268
-    if ((ret = ff_framesync_init(&s->fs, ctx, 3)) < 0)
268
+    if ((ret = ff_framesync2_init(&s->fs, ctx, 3)) < 0)
269 269
         return ret;
270 270
 
271 271
     in = s->fs.in;
... ...
@@ -284,44 +284,35 @@ static int config_output(AVFilterLink *outlink)
284 284
     s->fs.opaque   = s;
285 285
     s->fs.on_event = process_frame;
286 286
 
287
-    return ff_framesync_configure(&s->fs);
287
+    return ff_framesync2_configure(&s->fs);
288 288
 }
289 289
 
290
-static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
290
+static int activate(AVFilterContext *ctx)
291 291
 {
292
-    MaskedClampContext *s = inlink->dst->priv;
293
-    return ff_framesync_filter_frame(&s->fs, inlink, buf);
294
-}
295
-
296
-static int request_frame(AVFilterLink *outlink)
297
-{
298
-    MaskedClampContext *s = outlink->src->priv;
299
-    return ff_framesync_request_frame(&s->fs, outlink);
292
+    MaskedClampContext *s = ctx->priv;
293
+    return ff_framesync2_activate(&s->fs);
300 294
 }
301 295
 
302 296
 static av_cold void uninit(AVFilterContext *ctx)
303 297
 {
304 298
     MaskedClampContext *s = ctx->priv;
305 299
 
306
-    ff_framesync_uninit(&s->fs);
300
+    ff_framesync2_uninit(&s->fs);
307 301
 }
308 302
 
309 303
 static const AVFilterPad maskedclamp_inputs[] = {
310 304
     {
311 305
         .name         = "base",
312 306
         .type         = AVMEDIA_TYPE_VIDEO,
313
-        .filter_frame = filter_frame,
314 307
         .config_props = config_input,
315 308
     },
316 309
     {
317 310
         .name         = "dark",
318 311
         .type         = AVMEDIA_TYPE_VIDEO,
319
-        .filter_frame = filter_frame,
320 312
     },
321 313
     {
322 314
         .name         = "bright",
323 315
         .type         = AVMEDIA_TYPE_VIDEO,
324
-        .filter_frame = filter_frame,
325 316
     },
326 317
     { NULL }
327 318
 };
... ...
@@ -331,7 +322,6 @@ static const AVFilterPad maskedclamp_outputs[] = {
331 331
         .name          = "default",
332 332
         .type          = AVMEDIA_TYPE_VIDEO,
333 333
         .config_props  = config_output,
334
-        .request_frame = request_frame,
335 334
     },
336 335
     { NULL }
337 336
 };
... ...
@@ -341,6 +331,7 @@ AVFilter ff_vf_maskedclamp = {
341 341
     .description   = NULL_IF_CONFIG_SMALL("Clamp first stream with second stream and third stream."),
342 342
     .priv_size     = sizeof(MaskedClampContext),
343 343
     .uninit        = uninit,
344
+    .activate      = activate,
344 345
     .query_formats = query_formats,
345 346
     .inputs        = maskedclamp_inputs,
346 347
     .outputs       = maskedclamp_outputs,