Browse code

vf_overlay: implement poll_frame()

Signal that it can output a frame when there are frames on the main
input and EOF on the overlay input, but a frame is buffered -- e.g.
single picture overlay.

Anton Khirnov authored on 2012/04/02 01:51:27
Showing 1 changed files
... ...
@@ -345,6 +345,18 @@ static void null_draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) {
345 345
 
346 346
 static void null_end_frame(AVFilterLink *inlink) { }
347 347
 
348
+static int poll_frame(AVFilterLink *link)
349
+{
350
+    AVFilterContext   *s = link->src;
351
+    OverlayContext *over = s->priv;
352
+    int ret = avfilter_poll_frame(s->inputs[OVERLAY]);
353
+
354
+    if (ret == AVERROR_EOF)
355
+        ret = !!over->overpicref;
356
+
357
+    return ret && avfilter_poll_frame(s->inputs[MAIN]);
358
+}
359
+
348 360
 AVFilter avfilter_vf_overlay = {
349 361
     .name      = "overlay",
350 362
     .description = NULL_IF_CONFIG_SMALL("Overlay a video source on top of the input."),
... ...
@@ -376,6 +388,7 @@ AVFilter avfilter_vf_overlay = {
376 376
                                   { .name = NULL}},
377 377
     .outputs   = (AVFilterPad[]) {{ .name            = "default",
378 378
                                     .type            = AVMEDIA_TYPE_VIDEO,
379
-                                    .config_props    = config_output, },
379
+                                    .config_props    = config_output,
380
+                                    .poll_frame      = poll_frame },
380 381
                                   { .name = NULL}},
381 382
 };