[FFmpeg-devel] [PATCH 3/4] lavfi/timeline: add passthrough callback.

Clément Bœsch ubitux at gmail.com
Mon Apr 15 18:56:37 CEST 2013


---
 libavfilter/avfilter.c |  3 ++-
 libavfilter/avfilter.h | 13 +++++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 8a5292d..65e04e7 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -959,7 +959,8 @@ static int ff_filter_frame_framed(AVFilterLink *link, AVFrame *frame)
         dstctx->var_values[VAR_N] = link->frame_count;
         dstctx->var_values[VAR_T] = pts == AV_NOPTS_VALUE ? NAN : pts * av_q2d(link->time_base);
         if (!((int)av_expr_eval(dstctx->enable, dstctx->var_values, NULL)))
-            filter_frame = default_filter_frame;
+            filter_frame = dst->passthrough_filter_frame ? dst->passthrough_filter_frame
+                                                         : default_filter_name;
     }
     ret = filter_frame(link, out);
     link->frame_count++;
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index a5518f7..a092ad2 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -336,6 +336,19 @@ struct AVFilterPad {
     int (*filter_frame)(AVFilterLink *link, AVFrame *frame);
 
     /**
+     * Passthrough filtering callback.
+     *
+     * If a filter support timeline editing (AVFILTER_FLAG_SUPPORT_TIMELINE)
+     * then it can implement a custom passthrough callback to update its local
+     * context (for example to keep a frame reference, or simply send the
+     * filter to a custom outlink). The filter is obviously not supposed to do
+     * any change to the frame in this callback.
+     *
+     * Input pads only.
+     */
+    int (*passthrough_filter_frame)(AVFilterLink *link, AVFrame *frame);
+
+    /**
      * Frame poll callback. This returns the number of immediately available
      * samples. It should return a positive value if the next request_frame()
      * is guaranteed to return one frame (with no delay).
-- 
1.8.2.1



More information about the ffmpeg-devel mailing list