[FFmpeg-cvslog] lavfi: add init_opaque callback

Stefano Sabatini git at videolan.org
Tue Jul 10 01:31:27 CEST 2012


ffmpeg | branch: master | Stefano Sabatini <stefasab at gmail.com> | Fri Jul  6 00:41:27 2012 +0200| [21d56098265656b9b7e97a3ae385ca08bb93f729] | committer: Stefano Sabatini

lavfi: add init_opaque callback

This will be used by filters which require an opaque field to be passed
in input. Should be required only for filters which imply a programmatic
use.

This is possibly a temporary solution, to be removed when we'll have a
clearer and better agreememnt of how/if to pass binary data for
initializing a filter.

See thread:
Subject: [FFmpeg-devel][PATCH] lavfi: add init2 callback
Date: Fri,  6 Jul 2012 01:22:17 +0200

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=21d56098265656b9b7e97a3ae385ca08bb93f729
---

 doc/APIchanges         |    3 +++
 libavfilter/avfilter.c |    4 +++-
 libavfilter/avfilter.h |    7 +++++++
 libavfilter/version.h  |    2 +-
 4 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 6d8ad74..e17aae7 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,9 @@ libavutil:     2011-04-18
 
 API changes, most recent first:
 
+2012-07-10 - xxxxxxx - lavfi 3.2.0 - avfilter.h
+  Add init_opaque() callback to AVFilter struct.
+
 2012-06-26 - xxxxxxx - lavu 51.63.100 - imgutils.h
   Add functions to libavutil/imgutils.h:
   av_image_get_buffer_size()
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 01f3442..5094105 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->init_opaque)
+        ret = filter->filter->init_opaque(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 52de740..f039c1e 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -447,6 +447,13 @@ typedef struct AVFilter {
      *          AVERROR(ENOSYS) on unsupported commands
      */
     int (*process_command)(AVFilterContext *, const char *cmd, const char *arg, char *res, int res_len, int flags);
+
+    /**
+     * Filter initialization function, alternative to the init()
+     * callback. Args contains the user-supplied parameters, opaque is
+     * used for providing binary data.
+     */
+    int (*init_opaque)(AVFilterContext *ctx, const char *args, void *opaque);
 } AVFilter;
 
 /** An instance of a filter */
diff --git a/libavfilter/version.h b/libavfilter/version.h
index 8116465..ea95cf3 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -29,7 +29,7 @@
 #include "libavutil/avutil.h"
 
 #define LIBAVFILTER_VERSION_MAJOR  3
-#define LIBAVFILTER_VERSION_MINOR  1
+#define LIBAVFILTER_VERSION_MINOR  2
 #define LIBAVFILTER_VERSION_MICRO 100
 
 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \



More information about the ffmpeg-cvslog mailing list