Originally committed as revision 25235 to svn://svn.ffmpeg.org/ffmpeg/trunk
Showing the changes to libavfilter/avfilter.c (1 of 2 files). Show all
Unified · Split
| @@ -122,7 +122,7 @@ int avfilter_link(AVFilterContext *src, unsigned srcpad, · 121 unmodified lines | |||
| 122 | } | 122 | } |
| 123 | 123 | ||
| 124 | int avfilter_insert_filter(AVFilterLink *link, AVFilterContext *filt, | 124 | int avfilter_insert_filter(AVFilterLink *link, AVFilterContext *filt, |
| 125 | unsigned in, unsigned out) | 125 | unsigned filt_srcpad_idx, unsigned filt_dstpad_idx) |
| 126 | { | 126 | { |
| 127 | int ret; | 127 | int ret; |
| 128 | unsigned dstpad_idx = link->dstpad - link->dst->input_pads; | 128 | unsigned dstpad_idx = link->dstpad - link->dst->input_pads; |
| @@ -132,7 +132,7 @@ int avfilter_insert_filter(AVFilterLink *link, AVFilterContext *filt, · 3 unmodified lines | |||
| 132 | filt->name, link->src->name, link->dst->name); | 132 | filt->name, link->src->name, link->dst->name); |
| 133 | 133 | ||
| 134 | link->dst->inputs[dstpad_idx] = NULL; | 134 | link->dst->inputs[dstpad_idx] = NULL; |
| 135 | if ((ret = avfilter_link(filt, out, link->dst, dstpad_idx)) < 0) { | 135 | if ((ret = avfilter_link(filt, filt_dstpad_idx, link->dst, dstpad_idx)) < 0) { |
| 136 | /* failed to link output filter to new filter */ | 136 | /* failed to link output filter to new filter */ |
| 137 | link->dst->inputs[dstpad_idx] = link; | 137 | link->dst->inputs[dstpad_idx] = link; |
| 138 | return ret; | 138 | return ret; |
| @@ -140,14 +140,14 @@ int avfilter_insert_filter(AVFilterLink *link, AVFilterContext *filt, · 1 unmodified line | |||
| 140 | 140 | ||
| 141 | /* re-hookup the link to the new destination filter we inserted */ | 141 | /* re-hookup the link to the new destination filter we inserted */ |
| 142 | link->dst = filt; | 142 | link->dst = filt; |
| 143 | link->dstpad = &filt->input_pads[in]; | 143 | link->dstpad = &filt->input_pads[filt_srcpad_idx]; |
| 144 | filt->inputs[in] = link; | 144 | filt->inputs[filt_srcpad_idx] = link; |
| 145 | 145 | ||
| 146 | /* if any information on supported media formats already exists on the | 146 | /* if any information on supported media formats already exists on the |
| 147 | * link, we need to preserve that */ | 147 | * link, we need to preserve that */ |
| 148 | if (link->out_formats) | 148 | if (link->out_formats) |
| 149 | avfilter_formats_changeref(&link->out_formats, | 149 | avfilter_formats_changeref(&link->out_formats, |
| 150 | &filt->outputs[out]->out_formats); | 150 | &filt->outputs[filt_dstpad_idx]->out_formats); |
| 151 | 151 | ||
| 152 | return 0; | 152 | return 0; |
| 153 | } | 153 | } |