History

lavfi: replace avfilter_open() with avfilter_graph_alloc_filter().

Since we do not support "standalone" filters not attached to an AVFilterGraph, we should not have a public function to create such filters. In addition that function is horribly named, the action it does cannot be possibly described as "opening" a filter.

Anton Khirnov committed 13 years ago

Commit bc1a9851 parent 38f0c077 files · +83 −20Browse files

Showing the changes to libavfilter/avfiltergraph.c (1 of 7 files). Show all

Unified · Split

libavfilter/avfiltergraph.c+30−4
@@ -81,12 +81,12 @@ int avfilter_graph_create_filter(AVFilterContext **filt_ctx, AVFilter *filt, · 80 unmodified lines
8181 {
8282 int ret;
8383
84− if ((ret = avfilter_open(filt_ctx, filt, name)) < 0)
85− goto fail;
84+ *filt_ctx = avfilter_graph_alloc_filter(graph_ctx, filt, name);
85+ if (!*filt_ctx)
86+ return AVERROR(ENOMEM);
8687 if ((ret = avfilter_init_filter(*filt_ctx, args, opaque)) < 0)
8788 goto fail;
88− if ((ret = avfilter_graph_add_filter(graph_ctx, *filt_ctx)) < 0)
89− goto fail;
89+
9090 return 0;
9191
9292 fail:
@@ -96,6 +96,32 @@ fail: · 3 unmodified lines
9696 return ret;
9797 }
9898
99+AVFilterContext *avfilter_graph_alloc_filter(AVFilterGraph *graph,
100+ const AVFilter *filter,
101+ const char *name)
102+{
103+ AVFilterContext **filters, *s;
104+
105+ s = ff_filter_alloc(filter, name);
106+ if (!s)
107+ return NULL;
108+
109+ filters = av_realloc(graph->filters, sizeof(*filters) * (graph->nb_filters + 1));
110+ if (!filters) {
111+ avfilter_free(s);
112+ return NULL;
113+ }
114+
115+ graph->filters = filters;
116+ graph->filters[graph->nb_filters++] = s;
117+
118+#if FF_API_FOO_COUNT
119+ graph->filter_count = graph->nb_filters;
120+#endif
121+
122+ return s;
123+}
124+
99125 /**
100126 * Check for the validity of graph.
101127 *

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t