[FFmpeg-soc] [soc]: r417 - in libavfilter: avfilter.c avfilter.h filter_test.c
koorogi
subversion at mplayerhq.hu
Sat Jul 14 21:33:28 CEST 2007
Author: koorogi
Date: Sat Jul 14 21:33:28 2007
New Revision: 417
Log:
Allow giving filter instances names, in anticipation of the upcoming
AVFilterGraph structure and related functions.
Modified:
libavfilter/avfilter.c
libavfilter/avfilter.h
libavfilter/filter_test.c
Modified: libavfilter/avfilter.c
==============================================================================
--- libavfilter/avfilter.c (original)
+++ libavfilter/avfilter.c Sat Jul 14 21:33:28 2007
@@ -288,13 +288,14 @@ static const char *filter_name(void *p)
return filter->filter->name;
}
-AVFilterContext *avfilter_create(AVFilter *filter)
+AVFilterContext *avfilter_create(AVFilter *filter, char *inst_name)
{
AVFilterContext *ret = av_malloc(sizeof(AVFilterContext));
ret->av_class = av_mallocz(sizeof(AVClass));
ret->av_class->item_name = filter_name;
ret->filter = filter;
+ ret->name = inst_name ? strdup(inst_name) : NULL;
ret->inputs = av_mallocz(sizeof(AVFilterLink*) * pad_count(filter->inputs));
ret->outputs = av_mallocz(sizeof(AVFilterLink*) * pad_count(filter->outputs));
ret->priv = av_mallocz(filter->priv_size);
@@ -320,6 +321,7 @@ void avfilter_destroy(AVFilterContext *f
av_free(filter->outputs[i]);
}
+ free (filter->name);
av_free(filter->inputs);
av_free(filter->outputs);
av_free(filter->priv);
@@ -327,12 +329,12 @@ void avfilter_destroy(AVFilterContext *f
av_free(filter);
}
-AVFilterContext *avfilter_create_by_name(char *name)
+AVFilterContext *avfilter_create_by_name(char *name, char *inst_name)
{
AVFilter *filt;
if(!(filt = avfilter_get_by_name(name))) return NULL;
- return avfilter_create(filt);
+ return avfilter_create(filt, inst_name);
}
int avfilter_init_filter(AVFilterContext *filter, const char *args)
Modified: libavfilter/avfilter.h
==============================================================================
--- libavfilter/avfilter.h (original)
+++ libavfilter/avfilter.h Sat Jul 14 21:33:28 2007
@@ -180,6 +180,8 @@ struct AVFilterContext
AVFilter *filter;
+ char *name;
+
AVFilterLink **inputs;
AVFilterLink **outputs;
@@ -216,8 +218,8 @@ void avfilter_uninit(void);
void avfilter_register(AVFilter *filter);
AVFilter *avfilter_get_by_name(char *name);
-AVFilterContext *avfilter_create(AVFilter *filter);
-AVFilterContext *avfilter_create_by_name(char *name);
+AVFilterContext *avfilter_create(AVFilter *filter, char *inst_name);
+AVFilterContext *avfilter_create_by_name(char *name, char *inst_name);
int avfilter_init_filter(AVFilterContext *filter, const char *args);
void avfilter_destroy(AVFilterContext *filter);
Modified: libavfilter/filter_test.c
==============================================================================
--- libavfilter/filter_test.c (original)
+++ libavfilter/filter_test.c Sat Jul 14 21:33:28 2007
@@ -43,7 +43,7 @@ AVFilterContext *create_filter(char *arg
av_log(NULL, AV_LOG_INFO, "creating filter \"%s\" with args \"%s\"\n",
name, args ? args : "(none)");
- if((ret = avfilter_create_by_name(name))) {
+ if((ret = avfilter_create_by_name(name, NULL))) {
if(avfilter_init_filter(ret, args)) {
av_log(NULL, AV_LOG_ERROR, "error initializing filter!\n");
avfilter_destroy(ret);
More information about the FFmpeg-soc
mailing list