aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter/avfilter.c
diff options
context:
space:
mode:
authorNicolas George <george@nsup.org>2017-07-31 00:29:01 +0200
committerNicolas George <george@nsup.org>2017-08-29 10:19:04 +0200
commitf8d7b5febba075035a94de5d7d1dc9083ad2f3ed (patch)
tree146cee9da69a3c8dfb9e6261a69109bbf53e0b54 /libavfilter/avfilter.c
parent19804024d5b26e9568ce2f21f15c6664717006cd (diff)
downloadffmpeg-f8d7b5febba075035a94de5d7d1dc9083ad2f3ed.tar.gz
lavfi: add a preinit callback to filters.
It is necessary for filters with child objects, to set the class and default options values.
Diffstat (limited to 'libavfilter/avfilter.c')
-rw-r--r--libavfilter/avfilter.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 185ba8df00..dcd975e104 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -692,6 +692,7 @@ static int default_execute(AVFilterContext *ctx, avfilter_action_func *func, voi
AVFilterContext *ff_filter_alloc(const AVFilter *filter, const char *inst_name)
{
AVFilterContext *ret;
+ int preinited = 0;
if (!filter)
return NULL;
@@ -708,6 +709,11 @@ AVFilterContext *ff_filter_alloc(const AVFilter *filter, const char *inst_name)
if (!ret->priv)
goto err;
}
+ if (filter->preinit) {
+ if (filter->preinit(ret) < 0)
+ goto err;
+ preinited = 1;
+ }
av_opt_set_defaults(ret);
if (filter->priv_class) {
@@ -745,6 +751,8 @@ AVFilterContext *ff_filter_alloc(const AVFilter *filter, const char *inst_name)
return ret;
err:
+ if (preinited)
+ filter->uninit(ret);
av_freep(&ret->inputs);
av_freep(&ret->input_pads);
ret->nb_inputs = 0;