* commit '
1565cbc65cbb9f95c11367314a080068895e0cf0':
lavfi: make avfilter_free() remove the filter from its graph.
Conflicts:
libavfilter/avfilter.c
libavfilter/avfiltergraph.c
libavfilter/graphparser.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
int i;
AVFilterLink *link;
+ if (!filter)
+ return;
+
+ if (filter->graph)
+ ff_filter_graph_remove_filter(filter->graph, filter);
+
if (filter->filter->uninit)
filter->filter->uninit(filter);
{
if (!*graph)
return;
- for (; (*graph)->nb_filters > 0; (*graph)->nb_filters--)
- avfilter_free((*graph)->filters[(*graph)->nb_filters - 1]);
+
+ while ((*graph)->nb_filters)
+ avfilter_free((*graph)->filters[0]);
+
+ av_freep(&(*graph)->sink_links);
av_freep(&(*graph)->scale_sws_opts);
+ av_freep(&(*graph)->aresample_swr_opts);
av_freep(&(*graph)->resample_lavr_opts);
av_freep(&(*graph)->filters);
av_freep(graph);
*outputs = open_outputs;
return 0;
- fail:
+ fail:end:
- for (; graph->nb_filters > 0; graph->nb_filters--)
- avfilter_free(graph->filters[graph->nb_filters - 1]);
+ while (graph->nb_filters)
+ avfilter_free(graph->filters[0]);
av_freep(&graph->filters);
avfilter_inout_free(&open_inputs);
avfilter_inout_free(&open_outputs);