diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-05-18 13:10:57 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-05-18 13:10:57 +0200 |
commit | fb8dde37e4b0d7966194bc614a1040eee902c4e1 (patch) | |
tree | d0934d26819c7ee16521f5b63d103701316bace1 /libavfilter/avfilter.c | |
parent | dd2eaf57b76033bf5e8d49457088dec60ad3e9a4 (diff) | |
parent | d79bd6040599ef017dc45d5997fcc959ab1f71f6 (diff) | |
download | ffmpeg-fb8dde37e4b0d7966194bc614a1040eee902c4e1.tar.gz |
Merge commit 'd79bd6040599ef017dc45d5997fcc959ab1f71f6'
* commit 'd79bd6040599ef017dc45d5997fcc959ab1f71f6':
lavfi: factorize freeing a link
Conflicts:
libavfilter/avfilter.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavfilter/avfilter.c')
-rw-r--r-- | libavfilter/avfilter.c | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 5aa6f5532b..5d5243d33d 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -622,10 +622,28 @@ int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *in } #endif +static void free_link(AVFilterLink *link) +{ + if (!link) + return; + + if (link->src) + link->src->outputs[link->srcpad - link->src->output_pads] = NULL; + if (link->dst) + link->dst->inputs[link->dstpad - link->dst->input_pads] = NULL; + + ff_formats_unref(&link->in_formats); + ff_formats_unref(&link->out_formats); + ff_formats_unref(&link->in_samplerates); + ff_formats_unref(&link->out_samplerates); + ff_channel_layouts_unref(&link->in_channel_layouts); + ff_channel_layouts_unref(&link->out_channel_layouts); + avfilter_link_free(&link); +} + void avfilter_free(AVFilterContext *filter) { int i; - AVFilterLink *link; if (!filter) return; @@ -637,30 +655,10 @@ void avfilter_free(AVFilterContext *filter) filter->filter->uninit(filter); for (i = 0; i < filter->nb_inputs; i++) { - if ((link = filter->inputs[i])) { - if (link->src) - link->src->outputs[link->srcpad - link->src->output_pads] = NULL; - ff_formats_unref(&link->in_formats); - ff_formats_unref(&link->out_formats); - ff_formats_unref(&link->in_samplerates); - ff_formats_unref(&link->out_samplerates); - ff_channel_layouts_unref(&link->in_channel_layouts); - ff_channel_layouts_unref(&link->out_channel_layouts); - } - avfilter_link_free(&link); + free_link(filter->inputs[i]); } for (i = 0; i < filter->nb_outputs; i++) { - if ((link = filter->outputs[i])) { - if (link->dst) - link->dst->inputs[link->dstpad - link->dst->input_pads] = NULL; - ff_formats_unref(&link->in_formats); - ff_formats_unref(&link->out_formats); - ff_formats_unref(&link->in_samplerates); - ff_formats_unref(&link->out_samplerates); - ff_channel_layouts_unref(&link->in_channel_layouts); - ff_channel_layouts_unref(&link->out_channel_layouts); - } - avfilter_link_free(&link); + free_link(filter->outputs[i]); } if (filter->filter->priv_class) |