|
|
@@ -59,12 +59,27 @@ AVFilterGraph *avfilter_graph_alloc(void) |
|
|
|
return ret; |
|
|
|
} |
|
|
|
|
|
|
|
void ff_filter_graph_remove_filter(AVFilterGraph *graph, AVFilterContext *filter) |
|
|
|
{ |
|
|
|
int i; |
|
|
|
for (i = 0; i < graph->nb_filters; i++) { |
|
|
|
if (graph->filters[i] == filter) { |
|
|
|
FFSWAP(AVFilterContext*, graph->filters[i], |
|
|
|
graph->filters[graph->nb_filters - 1]); |
|
|
|
graph->nb_filters--; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void avfilter_graph_free(AVFilterGraph **graph) |
|
|
|
{ |
|
|
|
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); |
|
|
@@ -103,10 +118,8 @@ int avfilter_graph_create_filter(AVFilterContext **filt_ctx, AVFilter *filt, |
|
|
|
*filt_ctx = avfilter_graph_alloc_filter(graph_ctx, filt, name); |
|
|
|
if (!*filt_ctx) |
|
|
|
return AVERROR(ENOMEM); |
|
|
|
if ((ret = avfilter_init_filter(*filt_ctx, args, opaque)) < 0) { |
|
|
|
graph_ctx->filters[graph_ctx->nb_filters-1] = NULL; |
|
|
|
if ((ret = avfilter_init_filter(*filt_ctx, args, opaque)) < 0) |
|
|
|
goto fail; |
|
|
|
} |
|
|
|
|
|
|
|
return 0; |
|
|
|
|
|
|
|