diff mbox

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

Message ID 20161224174149.8995-11-george@nsup.org
State Superseded
Headers show

Commit Message

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

Comments

Michael Niedermayer Dec. 25, 2016, 12:59 a.m. UTC | #1
On Sat, Dec 24, 2016 at 06:41:42PM +0100, Nicolas George wrote:
> Signed-off-by: Nicolas George <george@nsup.org>
> ---
>  libavfilter/avfilter.c | 6 +++++-
>  libavfilter/avfilter.h | 5 +++++
>  2 files changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
> index 1df1157f02..4638ff71ee 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 6109e5865c..d957a14482 100644
> --- a/libavfilter/avfilter.h
> +++ b/libavfilter/avfilter.h

> @@ -294,6 +294,11 @@ typedef struct AVFilter {
>       * used for providing binary data.
>       */
>      int (*init_opaque)(AVFilterContext *ctx, void *opaque);
> +
> +    /**
> +     * Filter activation function.

This is too terse as the documentation of the main function for
filters


> +     */
> +    int (*activate)(AVFilterContext *ctx);
>  } AVFilter;

[...]
diff mbox

Patch

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 1df1157f02..4638ff71ee 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 6109e5865c..d957a14482 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -294,6 +294,11 @@  typedef struct AVFilter {
      * used for providing binary data.
      */
     int (*init_opaque)(AVFilterContext *ctx, void *opaque);
+
+    /**
+     * Filter activation function.
+     */
+    int (*activate)(AVFilterContext *ctx);
 } AVFilter;
 
 /**