[FFmpeg-devel] [PATCH] lavfi: add init2 callback

Michael Niedermayer michaelni at gmx.at
Fri Jul 6 09:43:38 CEST 2012


On Fri, Jul 06, 2012 at 01:22:17AM +0200, Stefano Sabatini wrote:
> This will be used by filters which require an opaque field to be passed.
> Should be required only for filters which imply a programmatic use.
> ---
>  libavfilter/avfilter.c |    4 +++-
>  libavfilter/avfilter.h |    6 ++++++
>  2 files changed, 9 insertions(+), 1 deletions(-)
> 
> diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
> index 01f3442..2e9a825 100644
> --- a/libavfilter/avfilter.c
> +++ b/libavfilter/avfilter.c
> @@ -554,7 +554,9 @@ int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque
>  {
>      int ret=0;
>  
> -    if (filter->filter->init)
> +    if (filter->filter->init2)
> +        ret = filter->filter->init2(filter, args, opaque);
> +    else if (filter->filter->init)
>          ret = filter->filter->init(filter, args);
>      return ret;
>  }
> diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
> index e08a389..dd45ed7 100644
> --- a/libavfilter/avfilter.h
> +++ b/libavfilter/avfilter.h
> @@ -412,6 +412,12 @@ typedef struct AVFilter {
>      int (*init)(AVFilterContext *ctx, const char *args);
>  
>      /**
> +     * Filter initialization function. Args contains the user-supplied
> +     * parameters, opaque is used for providing binary data.
> +     */
> +    int (*init2)(AVFilterContext *ctx, const char *args, void *opaque);
> +
> +    /**
>       * Filter uninitialization function. Should deallocate any memory held
>       * by the filter, release any buffer references, etc. This does not need
>       * to deallocate the AVFilterContext->priv memory itself.

adding it in the  middle breaks ABI

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I am the wisest man alive, for I know one thing, and that is that I know
nothing. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120706/090783aa/attachment.asc>


More information about the ffmpeg-devel mailing list