diff options
author | Anton Khirnov <anton@khirnov.net> | 2012-04-09 05:01:05 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2012-04-14 09:25:46 +0200 |
commit | 4e781c25b7b1955d1a9a0b0771c3ce1acb0957bd (patch) | |
tree | 2514fd2659978cdd2f34e146f44c0d5e5a2ef397 /libavfilter/graphparser.c | |
parent | d7bcc71dadea71d86a2b95a4f46aedd392f8b948 (diff) | |
download | ffmpeg-4e781c25b7b1955d1a9a0b0771c3ce1acb0957bd.tar.gz |
graphparser: fix the order of connecting unlabeled links.
Right now, e.g. scale,[in]overlay would connect scale to the first
overlay input and [in] to the second, which goes against the
documentation and is unintuitive.
The bug happens because of the ordering mess in curr_inputs variable:
1) the unlabeled links from the previous filter are added to it in
correct order
2) input labels are parsed and inserted to the beginning one by one
(i.e. in reverse order)
3) curr_inputs is matched against filter inputs in reverse order
Fix the problem by always using proper ordering without trying to be
clever.
Diffstat (limited to 'libavfilter/graphparser.c')
-rw-r--r-- | libavfilter/graphparser.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/libavfilter/graphparser.c b/libavfilter/graphparser.c index 7a899a815c..ebd9cc929c 100644 --- a/libavfilter/graphparser.c +++ b/libavfilter/graphparser.c @@ -219,9 +219,9 @@ static int link_filter_inouts(AVFilterContext *filt_ctx, AVFilterInOut **curr_inputs, AVFilterInOut **open_inputs, void *log_ctx) { - int pad = filt_ctx->input_count, ret; + int pad, ret; - while (pad--) { + for (pad = 0; pad < filt_ctx->input_count; pad++) { AVFilterInOut *p = *curr_inputs; if (p) @@ -264,6 +264,7 @@ static int link_filter_inouts(AVFilterContext *filt_ctx, static int parse_inputs(const char **buf, AVFilterInOut **curr_inputs, AVFilterInOut **open_outputs, void *log_ctx) { + AVFilterInOut *parsed_inputs = NULL; int pad = 0; while (**buf == '[') { @@ -286,12 +287,15 @@ static int parse_inputs(const char **buf, AVFilterInOut **curr_inputs, match->pad_idx = pad; } - insert_inout(curr_inputs, match); + append_inout(&parsed_inputs, &match); *buf += strspn(*buf, WHITESPACES); pad++; } + append_inout(&parsed_inputs, curr_inputs); + *curr_inputs = parsed_inputs; + return pad; } |