diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-05-10 01:32:51 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-05-10 02:25:48 +0200 |
commit | 7610dee87bd901972b92de014d5cb1e5319a4a14 (patch) | |
tree | 8731475ba382fa33c83553dba78e99e940a9d8be /libavfilter/avfiltergraph.c | |
parent | 61930bd0d7154b6f3f8c8d2398c056c20e921652 (diff) | |
download | ffmpeg-7610dee87bd901972b92de014d5cb1e5319a4a14.tar.gz |
avfiltergraph: improve pick_format()
without this the recent changes to format/sink handling would cause a regression in fate
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavfilter/avfiltergraph.c')
-rw-r--r-- | libavfilter/avfiltergraph.c | 43 |
1 files changed, 33 insertions, 10 deletions
diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c index 9d7b956fa0..6e803d6a55 100644 --- a/libavfilter/avfiltergraph.c +++ b/libavfilter/avfiltergraph.c @@ -337,19 +337,42 @@ static void reduce_formats(AVFilterGraph *graph) static void pick_formats(AVFilterGraph *graph) { int i, j; - - for (i = 0; i < graph->filter_count; i++) { - AVFilterContext *filter = graph->filters[i]; - if (filter->input_count && filter->output_count) { - for (j = 0; j < filter->input_count; j++) - pick_format(filter->inputs[j], NULL); - for (j = 0; j < filter->output_count; j++) - pick_format(filter->outputs[j], filter->inputs[0]); + int change; + + do{ + change = 0; + for (i = 0; i < graph->filter_count; i++) { + AVFilterContext *filter = graph->filters[i]; + if (filter->input_count){ + for (j = 0; j < filter->input_count; j++){ + if(filter->inputs[j]->in_formats && filter->inputs[j]->in_formats->format_count == 1) { + pick_format(filter->inputs[j], NULL); + change = 1; + } + } + } + if (filter->output_count){ + for (j = 0; j < filter->output_count; j++){ + if(filter->outputs[j]->in_formats && filter->outputs[j]->in_formats->format_count == 1) { + pick_format(filter->outputs[j], NULL); + change = 1; + } + } + } + if (filter->input_count && filter->output_count && filter->inputs[0]->format>=0) { + for (j = 0; j < filter->output_count; j++) { + if(filter->outputs[j]->format<0) { + pick_format(filter->outputs[j], filter->inputs[0]); + change = 1; + } + } + } } - } + }while(change); + for (i = 0; i < graph->filter_count; i++) { AVFilterContext *filter = graph->filters[i]; - if (!(filter->input_count && filter->output_count)) { + if (1) { for (j = 0; j < filter->input_count; j++) pick_format(filter->inputs[j], NULL); for (j = 0; j < filter->output_count; j++) |