diff mbox

[FFmpeg-devel,10/17] lavfi: add AVFilter.activate.

Message ID 20161229143403.2851-10-george@nsup.org
State Accepted
Commit 3ff01feda30a131e877c01619761c2b62e45c9e8
Headers show

Commit Message

Nicolas George Dec. 29, 2016, 2:33 p.m. UTC
Signed-off-by: Nicolas George <george@nsup.org>
---
 libavfilter/avfilter.c |  6 +++++-
 libavfilter/avfilter.h | 14 ++++++++++++++
 2 files changed, 19 insertions(+), 1 deletion(-)


Change: more documentation.

Comments

Michael Niedermayer Dec. 31, 2016, 12:27 p.m. UTC | #1
On Thu, Dec 29, 2016 at 03:33:56PM +0100, Nicolas George wrote:
> Signed-off-by: Nicolas George <george@nsup.org>
> ---
>  libavfilter/avfilter.c |  6 +++++-
>  libavfilter/avfilter.h | 14 ++++++++++++++
>  2 files changed, 19 insertions(+), 1 deletion(-)
> 
> 
> Change: more documentation.

LGTM

thx

[...]
diff mbox

Patch

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 2b2df67ae1..f3a78d4f14 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -1479,8 +1479,12 @@  int ff_filter_activate(AVFilterContext *filter)
 {
     int ret;
 
+    /* Generic timeline support is not yet implemented but should be easy */
+    av_assert1(!(filter->filter->flags & AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC &&
+                 filter->filter->activate));
     filter->ready = 0;
-    ret = ff_filter_activate_default(filter);
+    ret = filter->filter->activate ? filter->filter->activate(filter) :
+          ff_filter_activate_default(filter);
     if (ret == FFERROR_NOT_READY)
         ret = 0;
     return ret;
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index a3472547ea..8874b5efaa 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -294,6 +294,20 @@  typedef struct AVFilter {
      * used for providing binary data.
      */
     int (*init_opaque)(AVFilterContext *ctx, void *opaque);
+
+    /**
+     * Filter activation function.
+     *
+     * Called when any processing is needed from the filter, instead of any
+     * filter_frame and request_frame on pads.
+     *
+     * The function must examine inlinks and outlinks and perform a single
+     * step of processing. If there is nothing to do, the function must do
+     * nothing and not return an error. If more steps are or may be
+     * possible, it must use ff_filter_set_ready() to schedule another
+     * activation.
+     */
+    int (*activate)(AVFilterContext *ctx);
 } AVFilter;
 
 /**