| 700 | } |
| 701 | |
| 702 | static int link_inputs(AVFilterGraphSegment *seg, size_t idx_chain, |
| 703 | size_t idx_filter, AVFilterInOut **inputs) |
| 704 | { |
| 705 | AVFilterChain *ch = seg->chains[idx_chain]; |
| 706 | AVFilterParams *p = ch->filters[idx_filter]; |
| 707 | AVFilterContext *f = p->filter; |
| 708 | |
| 709 | int ret; |
| 710 | |
| 711 | if (f->nb_inputs < p->nb_inputs) { |
| 712 | av_log(seg->graph, AV_LOG_ERROR, |
| 713 | "More input link labels specified for filter '%s' than " |
| 714 | "it has inputs: %u > %d\n", f->filter->name, |
| 715 | p->nb_inputs, f->nb_inputs); |
| 716 | return AVERROR(EINVAL); |
| 717 | } |
| 718 | |
| 719 | for (unsigned in = 0; in < f->nb_inputs; in++) { |
| 720 | const char *label = (in < p->nb_inputs) ? p->inputs[in]->label : NULL; |
| 721 | |
| 722 | // skip already linked inputs |
| 723 | if (f->inputs[in]) |
| 724 | continue; |
| 725 | |
| 726 | if (label) { |
| 727 | AVFilterParams *po = NULL; |
| 728 | unsigned idx = find_linklabel(seg, label, 1, idx_chain, idx_filter, &po); |
| 729 | |
| 730 | if (po) { |
| 731 | ret = avfilter_link(po->filter, idx, f, in); |
| 732 | if (ret < 0) |
| 733 | return ret; |
| 734 | |
| 735 | continue; |
| 736 | } |
| 737 | } |
| 738 | |
| 739 | ret = inout_add(inputs, f, in, label); |
| 740 | if (ret < 0) |
| 741 | return ret; |
| 742 | } |
| 743 | |
| 744 | return 0; |
| 745 | } |
| 746 | |
| 747 | static int link_outputs(AVFilterGraphSegment *seg, size_t idx_chain, |
| 748 | size_t idx_filter, AVFilterInOut **outputs) |
no test coverage detected