diff options
author | Vitor Sessak <vitor1001@gmail.com> | 2008-05-24 20:40:30 +0000 |
---|---|---|
committer | Vitor Sessak <vitor1001@gmail.com> | 2008-05-24 20:40:30 +0000 |
commit | cf4f7d38d093bff89ca2d96d01f448c1e617075b (patch) | |
tree | 091cd12cd442827e60cd23a6f135dbe2a9b6bc8b /libavfilter | |
parent | 5cb9c725f2a556b62553bc1473d0861c0d7456d9 (diff) | |
download | ffmpeg-cf4f7d38d093bff89ca2d96d01f448c1e617075b.tar.gz |
Move code from handle_link() to the only place the function is called
Commited in SoC by Vitor Sessak on 2008-04-18 18:18:35
Originally committed as revision 13319 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavfilter')
-rw-r--r-- | libavfilter/graphparser.c | 78 |
1 files changed, 32 insertions, 46 deletions
diff --git a/libavfilter/graphparser.c b/libavfilter/graphparser.c index a3cd9b714c..a4b423ba51 100644 --- a/libavfilter/graphparser.c +++ b/libavfilter/graphparser.c @@ -199,50 +199,6 @@ static void free_inout(AVFilterInOut *head) } /** - * Process a link. This funcion looks for a matching label in the *inout - * linked list. If none is found, it adds this link to the list. - */ -static int handle_link(char *name, AVFilterInOut **inout, int pad, - enum LinkType type, AVFilterContext *filter, - AVClass *log_ctx) -{ - AVFilterInOut *p = *inout; - - for (; p && strcmp(p->name, name); p = p->next); - - if(!p) { - // First label apearence, add it to the linked list - AVFilterInOut *inoutn = av_malloc(sizeof(AVFilterInOut)); - - inoutn->name = name; - inoutn->type = type; - inoutn->filter = filter; - inoutn->pad_idx = pad; - inoutn->next = *inout; - *inout = inoutn; - return 0; - } - - if(p->type == LinkTypeIn && type == LinkTypeOut) { - if(link_filter(filter, pad, p->filter, p->pad_idx, log_ctx) < 0) - return -1; - } else if(p->type == LinkTypeOut && type == LinkTypeIn) { - if(link_filter(p->filter, p->pad_idx, filter, pad, log_ctx) < 0) - return -1; - } else { - av_log(log_ctx, AV_LOG_ERROR, - "Two links named '%s' are either both input or both output\n", - name); - return -1; - } - - p->filter = NULL; - - return 0; -} - - -/** * Parse "[a1][link2] ... [etc]" */ static int parse_inouts(const char **buf, AVFilterInOut **inout, int pad, @@ -251,17 +207,47 @@ static int parse_inouts(const char **buf, AVFilterInOut **inout, int pad, { while (**buf == '[') { char *name; + AVFilterInOut *p = *inout; parse_link_name(buf, &name, log_ctx); if(!name) return -1; - if(handle_link(name, inout, pad++, type, filter, log_ctx) < 0) - return -1; + for (; p && strcmp(p->name, name); p = p->next); + + if(!p) { + // First label apearence, add it to the linked list + AVFilterInOut *inoutn = av_malloc(sizeof(AVFilterInOut)); + + inoutn->name = name; + inoutn->type = type; + inoutn->filter = filter; + inoutn->pad_idx = pad; + inoutn->next = *inout; + *inout = inoutn; + } else { + if(p->type == LinkTypeIn && type == LinkTypeOut) { + if(link_filter(filter, pad, p->filter, p->pad_idx, log_ctx) < 0) + return -1; + } else if(p->type == LinkTypeOut && type == LinkTypeIn) { + if(link_filter(p->filter, p->pad_idx, filter, pad, log_ctx) < 0) + return -1; + } else { + av_log(log_ctx, AV_LOG_ERROR, + "Two links named '%s' are either both input or both output\n", + name); + return -1; + } + + p->filter = NULL; + } + + pad++; consume_whitespace(buf); } + return pad; } |