diff options
author | Anton Khirnov <anton@khirnov.net> | 2013-03-31 08:28:11 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2013-04-11 20:34:14 +0200 |
commit | bc1a985ba030e9861d24965d42792850b43a43ea (patch) | |
tree | 5bfe8c12dcb58b6560a0028a03da63bfc36cde80 /libavfilter/avfilter.c | |
parent | 38f0c0781a6e099f11c0acec07f9b8be742190c4 (diff) | |
download | ffmpeg-bc1a985ba030e9861d24965d42792850b43a43ea.tar.gz |
lavfi: replace avfilter_open() with avfilter_graph_alloc_filter().
Since we do not support "standalone" filters not attached to an
AVFilterGraph, we should not have a public function to create such
filters. In addition that function is horribly named, the action it does
cannot be possibly described as "opening" a filter.
Diffstat (limited to 'libavfilter/avfilter.c')
-rw-r--r-- | libavfilter/avfilter.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 7c5a971fe2..7032f2df28 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -352,17 +352,16 @@ static const AVClass avfilter_class = { .child_class_next = filter_child_class_next, }; -int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *inst_name) +AVFilterContext *ff_filter_alloc(const AVFilter *filter, const char *inst_name) { AVFilterContext *ret; - *filter_ctx = NULL; if (!filter) - return AVERROR(EINVAL); + return NULL; ret = av_mallocz(sizeof(AVFilterContext)); if (!ret) - return AVERROR(ENOMEM); + return NULL; ret->av_class = &avfilter_class; ret->filter = filter; @@ -404,8 +403,7 @@ int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *in ret->input_count = ret->nb_inputs; #endif - *filter_ctx = ret; - return 0; + return ret; err: av_freep(&ret->inputs); @@ -416,9 +414,17 @@ err: ret->nb_outputs = 0; av_freep(&ret->priv); av_free(ret); - return AVERROR(ENOMEM); + return NULL; } +#if FF_API_AVFILTER_OPEN +int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *inst_name) +{ + *filter_ctx = ff_filter_alloc(filter, inst_name); + return *filter_ctx ? 0 : AVERROR(ENOMEM); +} +#endif + void avfilter_free(AVFilterContext *filter) { int i; |