without this the recent changes to format/sink handling would cause a regression in fate
Showing the changes to libavfilter/avfiltergraph.c (1 of 1 file). Show all
Unified · Split
| @@ -337,19 +337,42 @@ static void reduce_formats(AVFilterGraph *graph) · 336 unmodified lines | ||
| 337 | 337 | static void pick_formats(AVFilterGraph *graph) |
| 338 | 338 | { |
| 339 | 339 | int i, j; |
| 340 | − | |
| 341 | − for (i = 0; i < graph->filter_count; i++) { | |
| 342 | − AVFilterContext *filter = graph->filters[i]; | |
| 343 | − if (filter->input_count && filter->output_count) { | |
| 344 | − for (j = 0; j < filter->input_count; j++) | |
| 345 | − pick_format(filter->inputs[j], NULL); | |
| 346 | − for (j = 0; j < filter->output_count; j++) | |
| 347 | − pick_format(filter->outputs[j], filter->inputs[0]); | |
| 340 | + int change; | |
| 341 | + | |
| 342 | + do{ | |
| 343 | + change = 0; | |
| 344 | + for (i = 0; i < graph->filter_count; i++) { | |
| 345 | + AVFilterContext *filter = graph->filters[i]; | |
| 346 | + if (filter->input_count){ | |
| 347 | + for (j = 0; j < filter->input_count; j++){ | |
| 348 | + if(filter->inputs[j]->in_formats && filter->inputs[j]->in_formats->format_count == 1) { | |
| 349 | + pick_format(filter->inputs[j], NULL); | |
| 350 | + change = 1; | |
| 351 | + } | |
| 352 | + } | |
| 353 | + } | |
| 354 | + if (filter->output_count){ | |
| 355 | + for (j = 0; j < filter->output_count; j++){ | |
| 356 | + if(filter->outputs[j]->in_formats && filter->outputs[j]->in_formats->format_count == 1) { | |
| 357 | + pick_format(filter->outputs[j], NULL); | |
| 358 | + change = 1; | |
| 359 | + } | |
| 360 | + } | |
| 361 | + } | |
| 362 | + if (filter->input_count && filter->output_count && filter->inputs[0]->format>=0) { | |
| 363 | + for (j = 0; j < filter->output_count; j++) { | |
| 364 | + if(filter->outputs[j]->format<0) { | |
| 365 | + pick_format(filter->outputs[j], filter->inputs[0]); | |
| 366 | + change = 1; | |
| 367 | + } | |
| 368 | + } | |
| 369 | + } | |
| 348 | 370 | } |
| 349 | − } | |
| 371 | + }while(change); | |
| 372 | + | |
| 350 | 373 | for (i = 0; i < graph->filter_count; i++) { |
| 351 | 374 | AVFilterContext *filter = graph->filters[i]; |
| 352 | − if (!(filter->input_count && filter->output_count)) { | |
| 375 | + if (1) { | |
| 353 | 376 | for (j = 0; j < filter->input_count; j++) |
| 354 | 377 | pick_format(filter->inputs[j], NULL); |
| 355 | 378 | for (j = 0; j < filter->output_count; j++) |