Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Sabatini <stefano.sabatini-lala@poste.it>2010-08-11 15:44:51 +0400
committerStefano Sabatini <stefano.sabatini-lala@poste.it>2010-08-11 15:44:51 +0400
commit84c038696097e5d4951ba3ad180e1100d66c0947 (patch)
tree7fec9365ce84f2dfd64e287b38bb48eda0c41b1e /libavfilter
parentad0d70c964f852a18e9ab8124f0e7aa8876cac6e (diff)
Change avfilter_open() signature, from:
AVFilterContext *avfilter_open(AVFilter *filter, const char *inst_name); to: int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *inst_name); This way it is possible to propagate an error code telling the reason of the failure. Originally committed as revision 24765 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavfilter')
-rw-r--r--libavfilter/avfilter.c8
-rw-r--r--libavfilter/avfilter.h9
-rw-r--r--libavfilter/avfiltergraph.c3
-rw-r--r--libavfilter/graphparser.c2
4 files changed, 13 insertions, 9 deletions
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index b4e1c20023..e31aeac3d8 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -394,12 +394,13 @@ static const AVClass avfilter_class = {
LIBAVUTIL_VERSION_INT,
};
-AVFilterContext *avfilter_open(AVFilter *filter, const char *inst_name)
+int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *inst_name)
{
AVFilterContext *ret;
+ *filter_ctx = NULL;
if (!filter)
- return 0;
+ return AVERROR(EINVAL);
ret = av_mallocz(sizeof(AVFilterContext));
@@ -422,7 +423,8 @@ AVFilterContext *avfilter_open(AVFilter *filter, const char *inst_name)
ret->outputs = av_mallocz(sizeof(AVFilterLink*) * ret->output_count);
}
- return ret;
+ *filter_ctx = ret;
+ return 0;
}
void avfilter_destroy(AVFilterContext *filter)
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index da964264d0..0045215ee3 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -25,7 +25,7 @@
#include "libavutil/avutil.h"
#define LIBAVFILTER_VERSION_MAJOR 1
-#define LIBAVFILTER_VERSION_MINOR 32
+#define LIBAVFILTER_VERSION_MINOR 33
#define LIBAVFILTER_VERSION_MICRO 0
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
@@ -660,11 +660,14 @@ AVFilter **av_filter_next(AVFilter **filter);
/**
* Create a filter instance.
+ *
+ * @param filter_ctx put here a pointer to the created filter context
+ * on success, NULL on failure
* @param filter the filter to create an instance of
* @param inst_name Name to give to the new instance. Can be NULL for none.
- * @return Pointer to the new instance on success. NULL on failure.
+ * @return >= 0 in case of success, a negative error code otherwise
*/
-AVFilterContext *avfilter_open(AVFilter *filter, const char *inst_name);
+int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *inst_name);
/**
* Initialize a filter.
diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
index 6f219a62b5..2123c2806c 100644
--- a/libavfilter/avfiltergraph.c
+++ b/libavfilter/avfiltergraph.c
@@ -133,8 +133,7 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx)
/* couldn't merge format lists. auto-insert scale filter */
snprintf(inst_name, sizeof(inst_name), "auto-inserted scaler %d",
scaler_count++);
- scale =
- avfilter_open(avfilter_get_by_name("scale"),inst_name);
+ avfilter_open(&scale, avfilter_get_by_name("scale"), inst_name);
snprintf(scale_args, sizeof(scale_args), "0:0:%s", graph->scale_sws_opts);
if(!scale || scale->filter->init(scale, scale_args, NULL) ||
diff --git a/libavfilter/graphparser.c b/libavfilter/graphparser.c
index 5b3f89ef53..c4f621b87e 100644
--- a/libavfilter/graphparser.c
+++ b/libavfilter/graphparser.c
@@ -111,7 +111,7 @@ static AVFilterContext *create_filter(AVFilterGraph *ctx, int index,
return NULL;
}
- filt_ctx = avfilter_open(filt, inst_name);
+ avfilter_open(&filt_ctx, filt, inst_name);
if (!filt_ctx) {
av_log(log_ctx, AV_LOG_ERROR,
"Error creating filter '%s'\n", filt_name);