summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-04-12 01:01:48 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-04-12 01:31:55 +0200
commit710b0aa8012a25b646d6c0f0853fddcd79fc5e1b (patch)
tree0a87978efc6a0f60ef99d7a24a833c91a4a2c837
parenteb0f774d4bfdb1e5cb131f63580417cfb6b47514 (diff)
parent48a5adab62bd2a553f5069d41fa632a0701835e5 (diff)
Merge commit '48a5adab62bd2a553f5069d41fa632a0701835e5'
* commit '48a5adab62bd2a553f5069d41fa632a0701835e5': lavfi: add avfilter_init_str() to replace avfilter_init_filter(). avfilter_graph_create_filter() opaque is still passed to avfilter_init_filter() which continues to pass it to init_opaque as its still used in the buffer sinks the sinks should be changed and the opaque passing removed Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--doc/APIchanges1
-rw-r--r--libavfilter/avfilter.c15
-rw-r--r--libavfilter/avfilter.h16
-rw-r--r--libavfilter/avfiltergraph.c4
-rw-r--r--libavfilter/filtfmts.c2
-rw-r--r--libavfilter/graphparser.c3
-rw-r--r--libavfilter/version.h3
7 files changed, 41 insertions, 3 deletions
diff --git a/doc/APIchanges b/doc/APIchanges
index 8e6b4d1a6f..7611587de4 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -163,6 +163,7 @@ API changes, most recent first:
avfilter_graph_add_filter().
Add AVFilterContext.graph pointing to the AVFilterGraph that contains the
filter.
+ Add avfilter_init_str(), deprecate avfilter_init_filter().
2013-xx-xx - lavfi 3.7.0 - avfilter.h
Add AVFilter.priv_class for exporting filter options through the AVOptions API
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 54d90dcd02..3c19744a8b 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -701,8 +701,23 @@ static int filter_use_deprecated_init(const char *name)
return 1;
return 0;
}
+#if 0
+#if FF_API_AVFILTER_INIT_FILTER
+int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque)
+{
+ return avfilter_init_str(filter, args);
+}
+#endif
+
+int avfilter_init_str(AVFilterContext *filter, const char *args)
+#else
+int avfilter_init_str(AVFilterContext *filter, const char *args)
+{
+ return avfilter_init_filter(filter, args, NULL);
+}
int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque)
+#endif
{
AVDictionary *options = NULL;
AVDictionaryEntry *e;
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index 711cf4b551..88cd3e3979 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -860,6 +860,8 @@ attribute_deprecated
int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *inst_name);
#endif
+
+#if FF_API_AVFILTER_INIT_FILTER
/**
* Initialize a filter.
*
@@ -870,7 +872,21 @@ int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *in
* of this parameter varies by filter.
* @return zero on success
*/
+attribute_deprecated
int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque);
+#endif
+
+/**
+ * Initialize a filter with the supplied parameters.
+ *
+ * @param ctx uninitialized filter context to initialize
+ * @param args Options to initialize the filter with. This must be a
+ * ':'-separated list of options in the 'key=value' form.
+ * May be NULL if the options have been set directly using the
+ * AVOptions API or there are no options that need to be set.
+ * @return 0 on success, a negative AVERROR on failure
+ */
+int avfilter_init_str(AVFilterContext *ctx, const char *args);
/**
* Free a filter context. This will also remove the filter from its
diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
index 8e8edd5134..3e1d5ef467 100644
--- a/libavfilter/avfiltergraph.c
+++ b/libavfilter/avfiltergraph.c
@@ -118,7 +118,9 @@ int avfilter_graph_create_filter(AVFilterContext **filt_ctx, AVFilter *filt,
*filt_ctx = avfilter_graph_alloc_filter(graph_ctx, filt, name);
if (!*filt_ctx)
return AVERROR(ENOMEM);
- if ((ret = avfilter_init_filter(*filt_ctx, args, opaque)) < 0)
+
+ ret = avfilter_init_filter(*filt_ctx, args, opaque);
+ if (ret < 0)
goto fail;
return 0;
diff --git a/libavfilter/filtfmts.c b/libavfilter/filtfmts.c
index 72867292a9..61b002d119 100644
--- a/libavfilter/filtfmts.c
+++ b/libavfilter/filtfmts.c
@@ -97,7 +97,7 @@ int main(int argc, char **argv)
filter_name);
return 1;
}
- if (avfilter_init_filter(filter_ctx, filter_args, NULL) < 0) {
+ if (avfilter_init_str(filter_ctx, filter_args) < 0) {
fprintf(stderr, "Impossible to init filter '%s' with arguments '%s'\n",
filter_name, filter_args);
return 1;
diff --git a/libavfilter/graphparser.c b/libavfilter/graphparser.c
index 447b9ebc5d..bd6863e92f 100644
--- a/libavfilter/graphparser.c
+++ b/libavfilter/graphparser.c
@@ -123,7 +123,8 @@ static int create_filter(AVFilterContext **filt_ctx, AVFilterGraph *ctx, int ind
args = tmp_args;
}
- if ((ret = avfilter_init_filter(*filt_ctx, args, NULL)) < 0) {
+ ret = avfilter_init_str(*filt_ctx, args);
+ if (ret < 0) {
av_log(log_ctx, AV_LOG_ERROR,
"Error initializing filter '%s' with args '%s'\n", filt_name, args);
return ret;
diff --git a/libavfilter/version.h b/libavfilter/version.h
index f3508b7d51..ef14ae9bfc 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -72,5 +72,8 @@
#ifndef FF_API_AVFILTER_OPEN
#define FF_API_AVFILTER_OPEN (LIBAVFILTER_VERSION_MAJOR < 4)
#endif
+#ifndef FF_API_AVFILTER_INIT_FILTER
+#define FF_API_AVFILTER_INIT_FILTER (LIBAVFILTER_VERSION_MAJOR < 4)
+#endif
#endif /* AVFILTER_VERSION_H */