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 | static void pick_formats(AVFilterGraph *graph) | 337 | static void pick_formats(AVFilterGraph *graph) |
| 338 | { | 338 | { |
| 339 | int i, j; | 339 | int i, j; |
| 340 | 340 | int change; | |
| 341 | for (i = 0; i < graph->filter_count; i++) { | 341 | |
| 342 | AVFilterContext *filter = graph->filters[i]; | 342 | do{ |
| 343 | if (filter->input_count && filter->output_count) { | 343 | change = 0; |
| 344 | for (j = 0; j < filter->input_count; j++) | 344 | for (i = 0; i < graph->filter_count; i++) { |
| 345 | pick_format(filter->inputs[j], NULL); | 345 | AVFilterContext *filter = graph->filters[i]; |
| 346 | for (j = 0; j < filter->output_count; j++) | 346 | if (filter->input_count){ |
| 347 | pick_format(filter->outputs[j], filter->inputs[0]); | 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 | for (i = 0; i < graph->filter_count; i++) { | 373 | for (i = 0; i < graph->filter_count; i++) { |
| 351 | AVFilterContext *filter = graph->filters[i]; | 374 | AVFilterContext *filter = graph->filters[i]; |
| 352 | if (!(filter->input_count && filter->output_count)) { | 375 | if (1) { |
| 353 | for (j = 0; j < filter->input_count; j++) | 376 | for (j = 0; j < filter->input_count; j++) |
| 354 | pick_format(filter->inputs[j], NULL); | 377 | pick_format(filter->inputs[j], NULL); |
| 355 | for (j = 0; j < filter->output_count; j++) | 378 | for (j = 0; j < filter->output_count; j++) |