Merge commit '1565cbc65cbb9f95c11367314a080068895e0cf0'
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 11 Apr 2013 22:54:05 +0000 (00:54 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 11 Apr 2013 22:54:05 +0000 (00:54 +0200)
* 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>
1  2 
libavfilter/avfilter.c
libavfilter/avfilter.h
libavfilter/avfiltergraph.c
libavfilter/graphparser.c
libavfilter/internal.h

@@@ -568,9 -430,9 +568,12 @@@ void avfilter_free(AVFilterContext *fil
      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);
  
Simple merge
@@@ -63,11 -63,11 +76,13 @@@ void avfilter_graph_free(AVFilterGraph 
  {
      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);
@@@ -429,9 -429,9 +429,9 @@@ int avfilter_graph_parse2(AVFilterGrap
      *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);
Simple merge