Make it returns the list of open inputs and outputs, so it can be reused by applications. Breaks API/ABI.
Showing the changes to libavfilter/graphparser.c (1 of 6 files). Show all
Unified · Split
| @@ -328,8 +328,8 @@ static int parse_outputs(const char **buf, AVFilterInOut **curr_inputs, · 327 unmodified lines | |||
| 328 | } | 328 | } |
| 329 | 329 | ||
| 330 | int avfilter_graph_parse(AVFilterGraph *graph, const char *filters, | 330 | int avfilter_graph_parse(AVFilterGraph *graph, const char *filters, |
| 331 | AVFilterInOut *open_inputs, | 331 | AVFilterInOut **open_inputs, AVFilterInOut **open_outputs, |
| 332 | AVFilterInOut *open_outputs, void *log_ctx) | 332 | void *log_ctx) |
| 333 | { | 333 | { |
| 334 | int index = 0, ret; | 334 | int index = 0, ret; |
| 335 | char chr = 0; | 335 | char chr = 0; |
| @@ -341,7 +341,7 @@ int avfilter_graph_parse(AVFilterGraph *graph, const char *filters, · 5 unmodified lines | |||
| 341 | const char *filterchain = filters; | 341 | const char *filterchain = filters; |
| 342 | filters += strspn(filters, WHITESPACES); | 342 | filters += strspn(filters, WHITESPACES); |
| 343 | 343 | ||
| 344 | if ((ret = parse_inputs(&filters, &curr_inputs, &open_outputs, log_ctx)) < 0) | 344 | if ((ret = parse_inputs(&filters, &curr_inputs, open_outputs, log_ctx)) < 0) |
| 345 | goto fail; | 345 | goto fail; |
| 346 | 346 | ||
| 347 | if ((ret = parse_filter(&filter, &filters, graph, index, log_ctx)) < 0) | 347 | if ((ret = parse_filter(&filter, &filters, graph, index, log_ctx)) < 0) |
| @@ -350,14 +350,14 @@ int avfilter_graph_parse(AVFilterGraph *graph, const char *filters, · 2 unmodified lines | |||
| 350 | if (filter->input_count == 1 && !curr_inputs && !index) { | 350 | if (filter->input_count == 1 && !curr_inputs && !index) { |
| 351 | /* First input can be omitted if it is "[in]" */ | 351 | /* First input can be omitted if it is "[in]" */ |
| 352 | const char *tmp = "[in]"; | 352 | const char *tmp = "[in]"; |
| 353 | if ((ret = parse_inputs(&tmp, &curr_inputs, &open_outputs, log_ctx)) < 0) | 353 | if ((ret = parse_inputs(&tmp, &curr_inputs, open_outputs, log_ctx)) < 0) |
| 354 | goto fail; | 354 | goto fail; |
| 355 | } | 355 | } |
| 356 | 356 | ||
| 357 | if ((ret = link_filter_inouts(filter, &curr_inputs, &open_inputs, log_ctx)) < 0) | 357 | if ((ret = link_filter_inouts(filter, &curr_inputs, open_inputs, log_ctx)) < 0) |
| 358 | goto fail; | 358 | goto fail; |
| 359 | 359 | ||
| 360 | if ((ret = parse_outputs(&filters, &curr_inputs, &open_inputs, &open_outputs, | 360 | if ((ret = parse_outputs(&filters, &curr_inputs, open_inputs, open_outputs, |
| 361 | log_ctx)) < 0) | 361 | log_ctx)) < 0) |
| 362 | goto fail; | 362 | goto fail; |
| 363 | 363 | ||
| @@ -382,10 +382,10 @@ int avfilter_graph_parse(AVFilterGraph *graph, const char *filters, · 18 unmodified lines | |||
| 382 | goto fail; | 382 | goto fail; |
| 383 | } | 383 | } |
| 384 | 384 | ||
| 385 | if (open_inputs && !strcmp(open_inputs->name, "out") && curr_inputs) { | 385 | if (*open_inputs && !strcmp((*open_inputs)->name, "out") && curr_inputs) { |
| 386 | /* Last output can be omitted if it is "[out]" */ | 386 | /* Last output can be omitted if it is "[out]" */ |
| 387 | const char *tmp = "[out]"; | 387 | const char *tmp = "[out]"; |
| 388 | if ((ret = parse_outputs(&tmp, &curr_inputs, &open_inputs, &open_outputs, | 388 | if ((ret = parse_outputs(&tmp, &curr_inputs, open_inputs, open_outputs, |
| 389 | log_ctx)) < 0) | 389 | log_ctx)) < 0) |
| 390 | goto fail; | 390 | goto fail; |
| 391 | } | 391 | } |
| @@ -396,8 +396,8 @@ int avfilter_graph_parse(AVFilterGraph *graph, const char *filters, · 4 unmodified lines | |||
| 396 | for (; graph->filter_count > 0; graph->filter_count--) | 396 | for (; graph->filter_count > 0; graph->filter_count--) |
| 397 | avfilter_free(graph->filters[graph->filter_count - 1]); | 397 | avfilter_free(graph->filters[graph->filter_count - 1]); |
| 398 | av_freep(&graph->filters); | 398 | av_freep(&graph->filters); |
| 399 | free_inout(open_inputs); | 399 | free_inout(*open_inputs); |
| 400 | free_inout(open_outputs); | 400 | free_inout(*open_outputs); |
| 401 | free_inout(curr_inputs); | 401 | free_inout(curr_inputs); |
| 402 | return ret; | 402 | return ret; |
| 403 | } | 403 | } |