Browse code

lavfi/vf_remap: move to "activate" design.

Nicolas George authored on 2017/07/17 23:31:44
Showing 2 changed files
... ...
@@ -265,7 +265,7 @@ OBJS-$(CONFIG_RANDOM_FILTER)                 += vf_random.o
265 265
 OBJS-$(CONFIG_READEIA608_FILTER)             += vf_readeia608.o
266 266
 OBJS-$(CONFIG_READVITC_FILTER)               += vf_readvitc.o
267 267
 OBJS-$(CONFIG_REALTIME_FILTER)               += f_realtime.o
268
-OBJS-$(CONFIG_REMAP_FILTER)                  += vf_remap.o framesync.o
268
+OBJS-$(CONFIG_REMAP_FILTER)                  += vf_remap.o framesync2.o
269 269
 OBJS-$(CONFIG_REMOVEGRAIN_FILTER)            += vf_removegrain.o
270 270
 OBJS-$(CONFIG_REMOVELOGO_FILTER)             += bbox.o lswsutils.o lavfutils.o vf_removelogo.o
271 271
 OBJS-$(CONFIG_REPEATFIELDS_FILTER)           += vf_repeatfields.o
... ...
@@ -41,7 +41,7 @@
41 41
 #include "libavutil/opt.h"
42 42
 #include "avfilter.h"
43 43
 #include "formats.h"
44
-#include "framesync.h"
44
+#include "framesync2.h"
45 45
 #include "internal.h"
46 46
 #include "video.h"
47 47
 
... ...
@@ -283,9 +283,9 @@ static int process_frame(FFFrameSync *fs)
283 283
     AVFrame *out, *in, *xpic, *ypic;
284 284
     int ret;
285 285
 
286
-    if ((ret = ff_framesync_get_frame(&s->fs, 0, &in,   0)) < 0 ||
287
-        (ret = ff_framesync_get_frame(&s->fs, 1, &xpic, 0)) < 0 ||
288
-        (ret = ff_framesync_get_frame(&s->fs, 2, &ypic, 0)) < 0)
286
+    if ((ret = ff_framesync2_get_frame(&s->fs, 0, &in,   0)) < 0 ||
287
+        (ret = ff_framesync2_get_frame(&s->fs, 1, &xpic, 0)) < 0 ||
288
+        (ret = ff_framesync2_get_frame(&s->fs, 2, &ypic, 0)) < 0)
289 289
         return ret;
290 290
 
291 291
     if (ctx->is_disabled) {
... ...
@@ -330,7 +330,7 @@ static int config_output(AVFilterLink *outlink)
330 330
     outlink->sample_aspect_ratio = srclink->sample_aspect_ratio;
331 331
     outlink->frame_rate = srclink->frame_rate;
332 332
 
333
-    ret = ff_framesync_init(&s->fs, ctx, 3);
333
+    ret = ff_framesync2_init(&s->fs, ctx, 3);
334 334
     if (ret < 0)
335 335
         return ret;
336 336
 
... ...
@@ -350,44 +350,36 @@ static int config_output(AVFilterLink *outlink)
350 350
     s->fs.opaque   = s;
351 351
     s->fs.on_event = process_frame;
352 352
 
353
-    return ff_framesync_configure(&s->fs);
353
+    return ff_framesync2_configure(&s->fs);
354 354
 }
355 355
 
356
-static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
356
+static int activate(AVFilterContext *ctx)
357 357
 {
358
-    RemapContext *s = inlink->dst->priv;
359
-    return ff_framesync_filter_frame(&s->fs, inlink, buf);
358
+    RemapContext *s = ctx->priv;
359
+    return ff_framesync2_activate(&s->fs);
360 360
 }
361 361
 
362
-static int request_frame(AVFilterLink *outlink)
363
-{
364
-    RemapContext *s = outlink->src->priv;
365
-    return ff_framesync_request_frame(&s->fs, outlink);
366
-}
367 362
 
368 363
 static av_cold void uninit(AVFilterContext *ctx)
369 364
 {
370 365
     RemapContext *s = ctx->priv;
371 366
 
372
-    ff_framesync_uninit(&s->fs);
367
+    ff_framesync2_uninit(&s->fs);
373 368
 }
374 369
 
375 370
 static const AVFilterPad remap_inputs[] = {
376 371
     {
377 372
         .name         = "source",
378 373
         .type         = AVMEDIA_TYPE_VIDEO,
379
-        .filter_frame = filter_frame,
380 374
         .config_props = config_input,
381 375
     },
382 376
     {
383 377
         .name         = "xmap",
384 378
         .type         = AVMEDIA_TYPE_VIDEO,
385
-        .filter_frame = filter_frame,
386 379
     },
387 380
     {
388 381
         .name         = "ymap",
389 382
         .type         = AVMEDIA_TYPE_VIDEO,
390
-        .filter_frame = filter_frame,
391 383
     },
392 384
     { NULL }
393 385
 };
... ...
@@ -397,7 +389,6 @@ static const AVFilterPad remap_outputs[] = {
397 397
         .name          = "default",
398 398
         .type          = AVMEDIA_TYPE_VIDEO,
399 399
         .config_props  = config_output,
400
-        .request_frame = request_frame,
401 400
     },
402 401
     { NULL }
403 402
 };
... ...
@@ -408,6 +399,7 @@ AVFilter ff_vf_remap = {
408 408
     .priv_size     = sizeof(RemapContext),
409 409
     .uninit        = uninit,
410 410
     .query_formats = query_formats,
411
+    .activate      = activate,
411 412
     .inputs        = remap_inputs,
412 413
     .outputs       = remap_outputs,
413 414
     .priv_class    = &remap_class,