summaryrefslogtreecommitdiff
path: root/libavfilter
diff options
context:
space:
mode:
authorStefano Sabatini <stefano.sabatini-lala@poste.it>2009-10-27 19:52:14 +0000
committerStefano Sabatini <stefano.sabatini-lala@poste.it>2009-10-27 19:52:14 +0000
commit3555d2e88e2ad11c6368074469b8881c50934cb9 (patch)
treeb156b8663b3378a3fe59f9a20f713671511117c0 /libavfilter
parent290d4a44f18634ac5590c851abc26735acd560df (diff)
Introduce first_avfilter and use that, together with AVFilter.next,
for registering and finding filters, rather than use the struct AVFilterList, which is removed. Simplify the filter registration management code. Originally committed as revision 20387 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavfilter')
-rw-r--r--libavfilter/avfilter.c34
1 files changed, 13 insertions, 21 deletions
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index bc49bd6a73..5e33047262 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -28,13 +28,6 @@ unsigned avfilter_version(void) {
return LIBAVFILTER_VERSION_INT;
}
-/** list of registered filters */
-static struct FilterList
-{
- AVFilter *filter;
- struct FilterList *next;
-} *filters = NULL;
-
/** helper macros to get the in/out pad on the dst/src filter */
#define link_dpad(link) link->dst-> input_pads[link->dstpad]
#define link_spad(link) link->src->output_pads[link->srcpad]
@@ -327,34 +320,33 @@ void avfilter_draw_slice(AVFilterLink *link, int y, int h)
draw_slice(link, y, h);
}
+AVFilter *first_avfilter = NULL;
+
AVFilter *avfilter_get_by_name(const char *name)
{
- struct FilterList *filt;
+ AVFilter *filter;
- for(filt = filters; filt; filt = filt->next)
- if(!strcmp(filt->filter->name, name))
- return filt->filter;
+ for (filter = first_avfilter; filter; filter = filter->next)
+ if (!strcmp(filter->name, name))
+ return filter;
return NULL;
}
void avfilter_register(AVFilter *filter)
{
- struct FilterList *newfilt = av_malloc(sizeof(struct FilterList));
+ AVFilter **p;
+ p = &first_avfilter;
+ while (*p)
+ p = &(*p)->next;
- newfilt->filter = filter;
- newfilt->next = filters;
- filters = newfilt;
+ *p = filter;
+ filter->next = NULL;
}
void avfilter_uninit(void)
{
- struct FilterList *tmp;
-
- for(; filters; filters = tmp) {
- tmp = filters->next;
- av_free(filters);
- }
+ first_avfilter = NULL;
}
static int pad_count(const AVFilterPad *pads)