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
81{81{
82 int ret;82 int ret;
83 83
84 if ((ret = avfilter_open(filt_ctx, filt, name)) < 0)84 *filt_ctx = avfilter_graph_alloc_filter(graph_ctx, filt, name);
85 goto fail;85 if (!*filt_ctx)
86 return AVERROR(ENOMEM);
86 if ((ret = avfilter_init_filter(*filt_ctx, args, opaque)) < 0)87 if ((ret = avfilter_init_filter(*filt_ctx, args, opaque)) < 0)
87 goto fail;88 goto fail;
88 if ((ret = avfilter_graph_add_filter(graph_ctx, *filt_ctx)) < 0)89
89 goto fail;
90 return 0;90 return 0;
91 91
92fail:92fail:
@@ -96,6 +96,32 @@ fail: · 3 unmodified lines
96 return ret;96 return ret;
97}97}
98 98
99AVFilterContext *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
99/**125/**
100 * Check for the validity of graph.126 * Check for the validity of graph.
101 *127 *

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