]> git.sesse.net Git - ffmpeg/commitdiff
avfilter/phase: add timeline support.
authorClément Bœsch <u@pkh.me>
Sat, 3 May 2014 20:43:20 +0000 (22:43 +0200)
committerClément Bœsch <u@pkh.me>
Thu, 8 May 2014 21:34:51 +0000 (23:34 +0200)
libavfilter/vf_phase.c

index dd3ecedd10d60d1539a86ddfe104778719986cf4..297ef70ec5df7e7fdbc3d1b08aa7043c143765e5 100644 (file)
@@ -243,6 +243,15 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
     int plane, top, y;
     AVFrame *out;
 
+    if (ctx->is_disabled) {
+        av_frame_free(&s->frame);
+        /* we keep a reference to the previous frame so the filter can start
+         * being useful as soon as it's not disabled, avoiding the 1-frame
+         * delay. */
+        s->frame = av_frame_clone(in);
+        return ff_filter_frame(outlink, in);
+    }
+
     out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
     if (!out) {
         av_frame_free(&in);
@@ -311,4 +320,5 @@ AVFilter ff_vf_phase = {
     .query_formats = query_formats,
     .inputs        = phase_inputs,
     .outputs       = phase_outputs,
+    .flags         = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL,
 };