mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2026-02-04 14:30:55 +08:00
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.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user