From 227e470ee213b6618c080ae654cc947b4adb0add Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 11 Oct 2014 18:17:20 +0200 Subject: vf_vapoursynth: return dummy frames if frames are requested during init An attempt at fixing #1168. I see black frames flashing, so it's certainly not perfect. --- video/filter/vf_vapoursynth.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/video/filter/vf_vapoursynth.c b/video/filter/vf_vapoursynth.c index ea5b3fe1cc..8b4d52cad0 100644 --- a/video/filter/vf_vapoursynth.c +++ b/video/filter/vf_vapoursynth.c @@ -401,7 +401,18 @@ static const VSFrameRef *VS_CC infiltGetFrame(int frameno, int activationReason, break; } if (p->initializing) { - p->vsapi->setFilterError("Frame requested during init", frameCtx); + MP_WARN(vf, "Frame requested during init! This is unsupported.\n" + "Returning black dummy frame with 0 duration.\n"); + ret = alloc_vs_frame(p, &vf->fmt_in); + if (!ret) { + p->vsapi->setFilterError("Could not allocate VS frame", frameCtx); + break; + } + struct mp_image vsframe = map_vs_frame(p, ret, true); + mp_image_clear(&vsframe, 0, 0, vf->fmt_in.w, vf->fmt_in.h); + struct mp_image dummy = {0}; + mp_image_set_params(&dummy, &vf->fmt_in); + set_vs_frame_props(p, ret, &dummy, 0, 1); break; } if (frameno < p->in_frameno) { -- cgit v1.2.3