mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
Factor common code out of if
Commited in SoC by Vitor Sessak on 2008-04-23 18:41:07 Originally committed as revision 13331 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
7baa62108a
commit
443c10ef2b
@ -276,6 +276,7 @@ static int parse_inputs(const char **buf, AVFilterInOut **currInputs,
|
|||||||
|
|
||||||
while (**buf == '[') {
|
while (**buf == '[') {
|
||||||
char *name;
|
char *name;
|
||||||
|
AVFilterInOut *link_to_add;
|
||||||
AVFilterInOut *match;
|
AVFilterInOut *match;
|
||||||
|
|
||||||
parse_link_name(buf, &name, log_ctx);
|
parse_link_name(buf, &name, log_ctx);
|
||||||
@ -289,25 +290,24 @@ static int parse_inputs(const char **buf, AVFilterInOut **currInputs,
|
|||||||
if(match) {
|
if(match) {
|
||||||
/* A label of a open link. Make it one of the inputs of the next
|
/* A label of a open link. Make it one of the inputs of the next
|
||||||
filter */
|
filter */
|
||||||
AVFilterInOut *currlinkn = match;
|
|
||||||
if (match->type != LinkTypeOut) {
|
if (match->type != LinkTypeOut) {
|
||||||
av_log(log_ctx, AV_LOG_ERROR,
|
av_log(log_ctx, AV_LOG_ERROR,
|
||||||
"Label \"%s\" appears twice as input!\n", match->name);
|
"Label \"%s\" appears twice as input!\n", match->name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
currlinkn->next = *currInputs;
|
|
||||||
*currInputs = currlinkn;
|
link_to_add = match;
|
||||||
} else {
|
} else {
|
||||||
/* Not in the list, so add it as an input */
|
/* Not in the list, so add it as an input */
|
||||||
AVFilterInOut *currlinkn = av_malloc(sizeof(AVFilterInOut));
|
link_to_add = av_malloc(sizeof(AVFilterInOut));
|
||||||
|
|
||||||
currlinkn->name = name;
|
link_to_add->name = name;
|
||||||
currlinkn->type = LinkTypeIn;
|
link_to_add->type = LinkTypeIn;
|
||||||
currlinkn->filter = NULL;
|
link_to_add->filter = NULL;
|
||||||
currlinkn->pad_idx = pad;
|
link_to_add->pad_idx = pad;
|
||||||
currlinkn->next = *currInputs;
|
|
||||||
*currInputs = currlinkn;
|
|
||||||
}
|
}
|
||||||
|
link_to_add->next = *currInputs;
|
||||||
|
*currInputs = link_to_add;
|
||||||
consume_whitespace(buf);
|
consume_whitespace(buf);
|
||||||
pad++;
|
pad++;
|
||||||
}
|
}
|
||||||
@ -324,6 +324,9 @@ static int parse_outputs(const char **buf, AVFilterInOut **currInputs,
|
|||||||
char *name;
|
char *name;
|
||||||
AVFilterInOut *match;
|
AVFilterInOut *match;
|
||||||
|
|
||||||
|
AVFilterInOut *input = *currInputs;
|
||||||
|
*currInputs = (*currInputs)->next;
|
||||||
|
|
||||||
parse_link_name(buf, &name, log_ctx);
|
parse_link_name(buf, &name, log_ctx);
|
||||||
|
|
||||||
if(!name)
|
if(!name)
|
||||||
@ -334,14 +337,12 @@ static int parse_outputs(const char **buf, AVFilterInOut **currInputs,
|
|||||||
|
|
||||||
if(match) {
|
if(match) {
|
||||||
/* A label of a open link. Link it. */
|
/* A label of a open link. Link it. */
|
||||||
AVFilterInOut *input = *currInputs;
|
|
||||||
if (match->type != LinkTypeIn) {
|
if (match->type != LinkTypeIn) {
|
||||||
av_log(log_ctx, AV_LOG_ERROR,
|
av_log(log_ctx, AV_LOG_ERROR,
|
||||||
"Label \"%s\" appears twice as output!\n", match->name);
|
"Label \"%s\" appears twice as output!\n", match->name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
*currInputs = (*currInputs)->next;
|
|
||||||
if(link_filter(input->filter, input->pad_idx,
|
if(link_filter(input->filter, input->pad_idx,
|
||||||
match->filter, match->pad_idx, log_ctx) < 0)
|
match->filter, match->pad_idx, log_ctx) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
@ -349,8 +350,6 @@ static int parse_outputs(const char **buf, AVFilterInOut **currInputs,
|
|||||||
av_free(input);
|
av_free(input);
|
||||||
} else {
|
} else {
|
||||||
/* Not in the list, so add the first input as a openLink */
|
/* Not in the list, so add the first input as a openLink */
|
||||||
AVFilterInOut *input = *currInputs;
|
|
||||||
*currInputs = (*currInputs)->next;
|
|
||||||
input->next = *openLinks;
|
input->next = *openLinks;
|
||||||
input->type = LinkTypeOut;
|
input->type = LinkTypeOut;
|
||||||
input->name = name;
|
input->name = name;
|
||||||
|
Loading…
Reference in New Issue
Block a user