{
AVFilter *filter;
AVFilterContext *filter_ctx;
+ AVFilterGraph *graph_ctx;
const char *filter_name;
const char *filter_args = NULL;
int i, j;
if (argv[2])
filter_args = argv[2];
+ /* allocate graph */
+ graph_ctx = avfilter_graph_alloc();
+ if (!graph_ctx)
+ return 1;
+
avfilter_register_all();
/* get a corresponding filter and open it */
return 1;
}
- if (avfilter_open(&filter_ctx, filter, NULL) < 0) {
+ /* open filter and add it to the graph */
+ if (!(filter_ctx = avfilter_graph_alloc_filter(graph_ctx, filter, filter_name))) {
fprintf(stderr, "Impossible to open filter with name '%s'\n",
filter_name);
return 1;
}
avfilter_free(filter_ctx);
+ avfilter_graph_free(&graph_ctx);
fflush(stdout);
return 0;
}