mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-21 10:55:51 +02:00
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
This commit is contained in:
parent
290d4a44f1
commit
3555d2e88e
@ -28,13 +28,6 @@ unsigned avfilter_version(void) {
|
|||||||
return LIBAVFILTER_VERSION_INT;
|
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 */
|
/** 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_dpad(link) link->dst-> input_pads[link->dstpad]
|
||||||
#define link_spad(link) link->src->output_pads[link->srcpad]
|
#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);
|
draw_slice(link, y, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AVFilter *first_avfilter = NULL;
|
||||||
|
|
||||||
AVFilter *avfilter_get_by_name(const char *name)
|
AVFilter *avfilter_get_by_name(const char *name)
|
||||||
{
|
{
|
||||||
struct FilterList *filt;
|
AVFilter *filter;
|
||||||
|
|
||||||
for(filt = filters; filt; filt = filt->next)
|
for (filter = first_avfilter; filter; filter = filter->next)
|
||||||
if(!strcmp(filt->filter->name, name))
|
if (!strcmp(filter->name, name))
|
||||||
return filt->filter;
|
return filter;
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void avfilter_register(AVFilter *filter)
|
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;
|
*p = filter;
|
||||||
newfilt->next = filters;
|
filter->next = NULL;
|
||||||
filters = newfilt;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void avfilter_uninit(void)
|
void avfilter_uninit(void)
|
||||||
{
|
{
|
||||||
struct FilterList *tmp;
|
first_avfilter = NULL;
|
||||||
|
|
||||||
for(; filters; filters = tmp) {
|
|
||||||
tmp = filters->next;
|
|
||||||
av_free(filters);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pad_count(const AVFilterPad *pads)
|
static int pad_count(const AVFilterPad *pads)
|
||||||
|
Loading…
Reference in New Issue
Block a user