diff --git a/libavfilter/af_acrossover.c b/libavfilter/af_acrossover.c index e8dcc48e6a..d57c0406c9 100644 --- a/libavfilter/af_acrossover.c +++ b/libavfilter/af_acrossover.c @@ -191,7 +191,7 @@ static av_cold int init(AVFilterContext *ctx) return AVERROR(ENOMEM); pad.name = name; - if ((ret = ff_insert_outpad(ctx, i, &pad)) < 0) { + if ((ret = ff_append_outpad(ctx, &pad)) < 0) { av_freep(&pad.name); return ret; } diff --git a/libavfilter/af_afir.c b/libavfilter/af_afir.c index 8cbdf81df4..d3868a7f2e 100644 --- a/libavfilter/af_afir.c +++ b/libavfilter/af_afir.c @@ -836,7 +836,7 @@ static av_cold int init(AVFilterContext *ctx) .type = AVMEDIA_TYPE_AUDIO, }; - ret = ff_insert_inpad(ctx, 0, &pad); + ret = ff_append_inpad(ctx, &pad); if (ret < 0) return ret; @@ -849,7 +849,7 @@ static av_cold int init(AVFilterContext *ctx) if (!pad.name) return AVERROR(ENOMEM); - ret = ff_insert_inpad(ctx, n + 1, &pad); + ret = ff_append_inpad(ctx, &pad); if (ret < 0) { av_freep(&pad.name); return ret; @@ -862,7 +862,7 @@ static av_cold int init(AVFilterContext *ctx) .config_props = config_output, }; - ret = ff_insert_outpad(ctx, 0, &pad); + ret = ff_append_outpad(ctx, &pad); if (ret < 0) return ret; @@ -873,7 +873,7 @@ static av_cold int init(AVFilterContext *ctx) .config_props = config_video, }; - ret = ff_insert_outpad(ctx, 1, &vpad); + ret = ff_append_outpad(ctx, &vpad); if (ret < 0) return ret; } diff --git a/libavfilter/af_aiir.c b/libavfilter/af_aiir.c index 55d5ac7f14..d46fdea3b7 100644 --- a/libavfilter/af_aiir.c +++ b/libavfilter/af_aiir.c @@ -1473,7 +1473,7 @@ static av_cold int init(AVFilterContext *ctx) .config_props = config_output, }; - ret = ff_insert_outpad(ctx, 0, &pad); + ret = ff_append_outpad(ctx, &pad); if (ret < 0) return ret; @@ -1484,7 +1484,7 @@ static av_cold int init(AVFilterContext *ctx) .config_props = config_video, }; - ret = ff_insert_outpad(ctx, 1, &vpad); + ret = ff_append_outpad(ctx, &vpad); if (ret < 0) return ret; } diff --git a/libavfilter/af_amerge.c b/libavfilter/af_amerge.c index 7749495970..37fb359c84 100644 --- a/libavfilter/af_amerge.c +++ b/libavfilter/af_amerge.c @@ -328,7 +328,7 @@ static av_cold int init(AVFilterContext *ctx) }; if (!name) return AVERROR(ENOMEM); - if ((ret = ff_insert_inpad(ctx, i, &pad)) < 0) { + if ((ret = ff_append_inpad(ctx, &pad)) < 0) { av_freep(&pad.name); return ret; } diff --git a/libavfilter/af_amix.c b/libavfilter/af_amix.c index 003c1717cd..8c1bcb96b6 100644 --- a/libavfilter/af_amix.c +++ b/libavfilter/af_amix.c @@ -553,7 +553,7 @@ static av_cold int init(AVFilterContext *ctx) if (!pad.name) return AVERROR(ENOMEM); - if ((ret = ff_insert_inpad(ctx, i, &pad)) < 0) { + if ((ret = ff_append_inpad(ctx, &pad)) < 0) { av_freep(&pad.name); return ret; } diff --git a/libavfilter/af_anequalizer.c b/libavfilter/af_anequalizer.c index b9d02e28ff..229e978278 100644 --- a/libavfilter/af_anequalizer.c +++ b/libavfilter/af_anequalizer.c @@ -196,7 +196,7 @@ static av_cold int init(AVFilterContext *ctx) .type = AVMEDIA_TYPE_AUDIO, }; - ret = ff_insert_outpad(ctx, 0, &pad); + ret = ff_append_outpad(ctx, &pad); if (ret < 0) return ret; @@ -206,7 +206,7 @@ static av_cold int init(AVFilterContext *ctx) .type = AVMEDIA_TYPE_VIDEO, .config_props = config_video, }; - ret = ff_insert_outpad(ctx, 1, &vpad); + ret = ff_append_outpad(ctx, &vpad); if (ret < 0) return ret; } diff --git a/libavfilter/af_channelsplit.c b/libavfilter/af_channelsplit.c index d6f1438b86..7857ce0343 100644 --- a/libavfilter/af_channelsplit.c +++ b/libavfilter/af_channelsplit.c @@ -97,9 +97,8 @@ static av_cold int init(AVFilterContext *ctx) s->map[i] = ret; } - if ((ret = ff_insert_outpad(ctx, i, &pad)) < 0) { + if ((ret = ff_append_outpad(ctx, &pad)) < 0) return ret; - } } fail: diff --git a/libavfilter/af_headphone.c b/libavfilter/af_headphone.c index f3543fafb6..d5b0d84052 100644 --- a/libavfilter/af_headphone.c +++ b/libavfilter/af_headphone.c @@ -652,7 +652,7 @@ static av_cold int init(AVFilterContext *ctx) .type = AVMEDIA_TYPE_AUDIO, .config_props = config_input, }; - if ((ret = ff_insert_inpad(ctx, 0, &pad)) < 0) + if ((ret = ff_append_inpad(ctx, &pad)) < 0) return ret; if (!s->map) { @@ -670,7 +670,7 @@ static av_cold int init(AVFilterContext *ctx) }; if (!name) return AVERROR(ENOMEM); - if ((ret = ff_insert_inpad(ctx, i + 1, &pad)) < 0) { + if ((ret = ff_append_inpad(ctx, &pad)) < 0) { av_freep(&pad.name); return ret; } diff --git a/libavfilter/af_join.c b/libavfilter/af_join.c index 10bd3c1c01..939edc4fa6 100644 --- a/libavfilter/af_join.c +++ b/libavfilter/af_join.c @@ -194,7 +194,7 @@ static av_cold int join_init(AVFilterContext *ctx) if (!pad.name) return AVERROR(ENOMEM); - if ((ret = ff_insert_inpad(ctx, i, &pad)) < 0) { + if ((ret = ff_append_inpad(ctx, &pad)) < 0) { av_freep(&pad.name); return ret; } diff --git a/libavfilter/af_ladspa.c b/libavfilter/af_ladspa.c index 0c2bd5a54e..3cf5f9f22b 100644 --- a/libavfilter/af_ladspa.c +++ b/libavfilter/af_ladspa.c @@ -639,7 +639,7 @@ static av_cold int init(AVFilterContext *ctx) pad.filter_frame = filter_frame; pad.config_props = config_input; - if (ff_insert_inpad(ctx, ctx->nb_inputs, &pad) < 0) { + if (ff_append_inpad(ctx, &pad) < 0) { av_freep(&pad.name); return AVERROR(ENOMEM); } diff --git a/libavfilter/af_lv2.c b/libavfilter/af_lv2.c index 83ff5e7861..a7f069206d 100644 --- a/libavfilter/af_lv2.c +++ b/libavfilter/af_lv2.c @@ -464,7 +464,7 @@ static av_cold int init(AVFilterContext *ctx) return AVERROR(ENOMEM); pad.filter_frame = filter_frame; - if (ff_insert_inpad(ctx, ctx->nb_inputs, &pad) < 0) { + if (ff_append_inpad(ctx, &pad) < 0) { av_freep(&pad.name); return AVERROR(ENOMEM); } diff --git a/libavfilter/avf_aphasemeter.c b/libavfilter/avf_aphasemeter.c index a31805f204..bd3ad1ac61 100644 --- a/libavfilter/avf_aphasemeter.c +++ b/libavfilter/avf_aphasemeter.c @@ -355,7 +355,7 @@ static av_cold int init(AVFilterContext *ctx) .name = "out0", .type = AVMEDIA_TYPE_AUDIO, }; - ret = ff_insert_outpad(ctx, 0, &pad); + ret = ff_append_outpad(ctx, &pad); if (ret < 0) return ret; @@ -365,7 +365,7 @@ static av_cold int init(AVFilterContext *ctx) .type = AVMEDIA_TYPE_VIDEO, .config_props = config_video_output, }; - ret = ff_insert_outpad(ctx, 1, &pad); + ret = ff_append_outpad(ctx, &pad); if (ret < 0) return ret; } diff --git a/libavfilter/avf_concat.c b/libavfilter/avf_concat.c index 5f4e2f74df..10f21cecb7 100644 --- a/libavfilter/avf_concat.c +++ b/libavfilter/avf_concat.c @@ -319,7 +319,7 @@ static av_cold int init(AVFilterContext *ctx) else pad.get_buffer.audio = get_audio_buffer; pad.name = av_asprintf("in%d:%c%d", seg, "va"[type], str); - if ((ret = ff_insert_inpad(ctx, ctx->nb_inputs, &pad)) < 0) { + if ((ret = ff_append_inpad(ctx, &pad)) < 0) { av_freep(&pad.name); return ret; } @@ -334,7 +334,7 @@ static av_cold int init(AVFilterContext *ctx) .config_props = config_output, }; pad.name = av_asprintf("out:%c%d", "va"[type], str); - if ((ret = ff_insert_outpad(ctx, ctx->nb_outputs, &pad)) < 0) { + if ((ret = ff_append_outpad(ctx, &pad)) < 0) { av_freep(&pad.name); return ret; } diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 87b44d34fe..ea22b247de 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -101,18 +101,16 @@ void ff_command_queue_pop(AVFilterContext *filter) av_free(c); } -int ff_insert_pad(unsigned idx, unsigned *count, size_t padidx_off, +int ff_append_pad(unsigned *count, AVFilterPad **pads, AVFilterLink ***links, AVFilterPad *newpad) { AVFilterLink **newlinks; AVFilterPad *newpads; - unsigned i; + unsigned idx = *count; - idx = FFMIN(idx, *count); - - newpads = av_realloc_array(*pads, *count + 1, sizeof(AVFilterPad)); - newlinks = av_realloc_array(*links, *count + 1, sizeof(AVFilterLink*)); + newpads = av_realloc_array(*pads, idx + 1, sizeof(*newpads)); + newlinks = av_realloc_array(*links, idx + 1, sizeof(*newlinks)); if (newpads) *pads = newpads; if (newlinks) @@ -120,15 +118,10 @@ int ff_insert_pad(unsigned idx, unsigned *count, size_t padidx_off, if (!newpads || !newlinks) return AVERROR(ENOMEM); - memmove(*pads + idx + 1, *pads + idx, sizeof(AVFilterPad) * (*count - idx)); - memmove(*links + idx + 1, *links + idx, sizeof(AVFilterLink*) * (*count - idx)); memcpy(*pads + idx, newpad, sizeof(AVFilterPad)); (*links)[idx] = NULL; (*count)++; - for (i = idx + 1; i < *count; i++) - if ((*links)[i]) - (*(unsigned *)((uint8_t *) (*links)[i] + padidx_off))++; return 0; } diff --git a/libavfilter/f_ebur128.c b/libavfilter/f_ebur128.c index 47ea9b59d7..938ae60848 100644 --- a/libavfilter/f_ebur128.c +++ b/libavfilter/f_ebur128.c @@ -552,7 +552,7 @@ static av_cold int init(AVFilterContext *ctx) .type = AVMEDIA_TYPE_VIDEO, .config_props = config_video_output, }; - ret = ff_insert_outpad(ctx, 0, &pad); + ret = ff_append_outpad(ctx, &pad); if (ret < 0) return ret; } @@ -561,7 +561,7 @@ static av_cold int init(AVFilterContext *ctx) .type = AVMEDIA_TYPE_AUDIO, .config_props = config_audio_output, }; - ret = ff_insert_outpad(ctx, ebur128->do_video, &pad); + ret = ff_append_outpad(ctx, &pad); if (ret < 0) return ret; diff --git a/libavfilter/f_interleave.c b/libavfilter/f_interleave.c index 56c30a39c8..2845d72b79 100644 --- a/libavfilter/f_interleave.c +++ b/libavfilter/f_interleave.c @@ -173,7 +173,7 @@ static av_cold int init(AVFilterContext *ctx) default: av_assert0(0); } - if ((ret = ff_insert_inpad(ctx, i, &inpad)) < 0) { + if ((ret = ff_append_inpad(ctx, &inpad)) < 0) { av_freep(&inpad.name); return ret; } diff --git a/libavfilter/f_segment.c b/libavfilter/f_segment.c index f060794cfe..d2c6d44cbe 100644 --- a/libavfilter/f_segment.c +++ b/libavfilter/f_segment.c @@ -137,7 +137,7 @@ static av_cold int init(AVFilterContext *ctx, enum AVMediaType type) if (!pad.name) return AVERROR(ENOMEM); - if ((ret = ff_insert_outpad(ctx, i, &pad)) < 0) { + if ((ret = ff_append_outpad(ctx, &pad)) < 0) { av_freep(&pad.name); return ret; } diff --git a/libavfilter/f_select.c b/libavfilter/f_select.c index 4a131f01c8..68afafb8b6 100644 --- a/libavfilter/f_select.c +++ b/libavfilter/f_select.c @@ -192,7 +192,7 @@ static av_cold int init(AVFilterContext *ctx) return AVERROR(ENOMEM); pad.type = ctx->filter->inputs[0].type; pad.request_frame = request_frame; - if ((ret = ff_insert_outpad(ctx, i, &pad)) < 0) { + if ((ret = ff_append_outpad(ctx, &pad)) < 0) { av_freep(&pad.name); return ret; } diff --git a/libavfilter/f_streamselect.c b/libavfilter/f_streamselect.c index 05a8d5f49a..da2391898f 100644 --- a/libavfilter/f_streamselect.c +++ b/libavfilter/f_streamselect.c @@ -167,10 +167,10 @@ static int parse_definition(AVFilterContext *ctx, int nb_pads, int is_input, int av_log(ctx, AV_LOG_DEBUG, "Add %s pad %s\n", padtype, pad.name); if (is_input) { - ret = ff_insert_inpad(ctx, i, &pad); + ret = ff_append_inpad(ctx, &pad); } else { pad.config_props = config_output; - ret = ff_insert_outpad(ctx, i, &pad); + ret = ff_append_outpad(ctx, &pad); } if (ret < 0) { diff --git a/libavfilter/internal.h b/libavfilter/internal.h index af8103f8aa..a0aa32af4d 100644 --- a/libavfilter/internal.h +++ b/libavfilter/internal.h @@ -226,34 +226,29 @@ void ff_tlog_link(void *ctx, AVFilterLink *link, int end); /** * Insert a new pad. * - * @param idx Insertion point. Pad is inserted at the end if this point - * is beyond the end of the list of pads. * @param count Pointer to the number of pads in the list - * @param padidx_off Offset within an AVFilterLink structure to the element - * to increment when inserting a new pad causes link - * numbering to change * @param pads Pointer to the pointer to the beginning of the list of pads * @param links Pointer to the pointer to the beginning of the list of links * @param newpad The new pad to add. A copy is made when adding. * @return >= 0 in case of success, a negative AVERROR code on error */ -int ff_insert_pad(unsigned idx, unsigned *count, size_t padidx_off, +int ff_append_pad(unsigned *count, AVFilterPad **pads, AVFilterLink ***links, AVFilterPad *newpad); /** Insert a new input pad for the filter. */ -static inline int ff_insert_inpad(AVFilterContext *f, unsigned index, +static inline int ff_append_inpad(AVFilterContext *f, AVFilterPad *p) { - return ff_insert_pad(index, &f->nb_inputs, offsetof(AVFilterLink, dstpad), + return ff_append_pad(&f->nb_inputs, &f->input_pads, &f->inputs, p); } /** Insert a new output pad for the filter. */ -static inline int ff_insert_outpad(AVFilterContext *f, unsigned index, +static inline int ff_append_outpad(AVFilterContext *f, AVFilterPad *p) { - return ff_insert_pad(index, &f->nb_outputs, offsetof(AVFilterLink, srcpad), + return ff_append_pad(&f->nb_outputs, &f->output_pads, &f->outputs, p); } diff --git a/libavfilter/split.c b/libavfilter/split.c index da5f681af8..56b29e1171 100644 --- a/libavfilter/split.c +++ b/libavfilter/split.c @@ -56,7 +56,7 @@ static av_cold int split_init(AVFilterContext *ctx) if (!pad.name) return AVERROR(ENOMEM); - if ((ret = ff_insert_outpad(ctx, i, &pad)) < 0) { + if ((ret = ff_append_outpad(ctx, &pad)) < 0) { av_freep(&pad.name); return ret; } diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c index 7d97295dd0..ea5bb90255 100644 --- a/libavfilter/src_movie.c +++ b/libavfilter/src_movie.c @@ -306,7 +306,7 @@ static av_cold int movie_common_init(AVFilterContext *ctx) return AVERROR(ENOMEM); pad.config_props = movie_config_output_props; pad.request_frame = movie_request_frame; - if ((ret = ff_insert_outpad(ctx, i, &pad)) < 0) { + if ((ret = ff_append_outpad(ctx, &pad)) < 0) { av_freep(&pad.name); return ret; } diff --git a/libavfilter/vf_bm3d.c b/libavfilter/vf_bm3d.c index 49a52ecc18..e07072439a 100644 --- a/libavfilter/vf_bm3d.c +++ b/libavfilter/vf_bm3d.c @@ -941,7 +941,7 @@ static av_cold int init(AVFilterContext *ctx) pad.name = "source"; pad.config_props = config_input; - if ((ret = ff_insert_inpad(ctx, 0, &pad)) < 0) + if ((ret = ff_append_inpad(ctx, &pad)) < 0) return ret; if (s->ref) { @@ -949,7 +949,7 @@ static av_cold int init(AVFilterContext *ctx) pad.name = "reference"; pad.config_props = NULL; - if ((ret = ff_insert_inpad(ctx, 1, &pad)) < 0) + if ((ret = ff_append_inpad(ctx, &pad)) < 0) return ret; } diff --git a/libavfilter/vf_decimate.c b/libavfilter/vf_decimate.c index 9ef03ff1a3..f831d9c5a3 100644 --- a/libavfilter/vf_decimate.c +++ b/libavfilter/vf_decimate.c @@ -310,13 +310,13 @@ static av_cold int decimate_init(AVFilterContext *ctx) }; int ret; - if ((ret = ff_insert_inpad(ctx, INPUT_MAIN, &pad)) < 0) + if ((ret = ff_append_inpad(ctx, &pad)) < 0) return ret; if (dm->ppsrc) { pad.name = "clean_src"; pad.config_props = NULL; - if ((ret = ff_insert_inpad(ctx, INPUT_CLEANSRC, &pad)) < 0) + if ((ret = ff_append_inpad(ctx, &pad)) < 0) return ret; } diff --git a/libavfilter/vf_extractplanes.c b/libavfilter/vf_extractplanes.c index cede3d669e..fdf525493d 100644 --- a/libavfilter/vf_extractplanes.c +++ b/libavfilter/vf_extractplanes.c @@ -352,7 +352,7 @@ static av_cold int init(AVFilterContext *ctx) pad.type = AVMEDIA_TYPE_VIDEO; pad.config_props = config_output; - if ((ret = ff_insert_outpad(ctx, ctx->nb_outputs, &pad)) < 0) { + if ((ret = ff_append_outpad(ctx, &pad)) < 0) { av_freep(&pad.name); return ret; } diff --git a/libavfilter/vf_fieldmatch.c b/libavfilter/vf_fieldmatch.c index 9626737b40..c2c00fb5b6 100644 --- a/libavfilter/vf_fieldmatch.c +++ b/libavfilter/vf_fieldmatch.c @@ -970,13 +970,13 @@ static av_cold int fieldmatch_init(AVFilterContext *ctx) }; int ret; - if ((ret = ff_insert_inpad(ctx, INPUT_MAIN, &pad)) < 0) + if ((ret = ff_append_inpad(ctx, &pad)) < 0) return ret; if (fm->ppsrc) { pad.name = "clean_src"; pad.config_props = NULL; - if ((ret = ff_insert_inpad(ctx, INPUT_CLEANSRC, &pad)) < 0) + if ((ret = ff_append_inpad(ctx, &pad)) < 0) return ret; } diff --git a/libavfilter/vf_guided.c b/libavfilter/vf_guided.c index 4003b9578f..b96b926e57 100644 --- a/libavfilter/vf_guided.c +++ b/libavfilter/vf_guided.c @@ -442,7 +442,7 @@ static av_cold int init(AVFilterContext *ctx) pad.name = "source"; pad.config_props = config_input; - if ((ret = ff_insert_inpad(ctx, 0, &pad)) < 0) + if ((ret = ff_append_inpad(ctx, &pad)) < 0) return ret; if (s->guidance == ON) { @@ -450,7 +450,7 @@ static av_cold int init(AVFilterContext *ctx) pad.name = "guidance"; pad.config_props = NULL; - if ((ret = ff_insert_inpad(ctx, 1, &pad)) < 0) + if ((ret = ff_append_inpad(ctx, &pad)) < 0) return ret; } diff --git a/libavfilter/vf_mergeplanes.c b/libavfilter/vf_mergeplanes.c index 30888f62af..4a83af7d2b 100644 --- a/libavfilter/vf_mergeplanes.c +++ b/libavfilter/vf_mergeplanes.c @@ -96,7 +96,7 @@ static av_cold int init(AVFilterContext *ctx) if (!pad.name) return AVERROR(ENOMEM); - if ((ret = ff_insert_inpad(ctx, i, &pad)) < 0){ + if ((ret = ff_append_inpad(ctx, &pad)) < 0){ av_freep(&pad.name); return ret; } diff --git a/libavfilter/vf_mix.c b/libavfilter/vf_mix.c index 5bd056759e..cbcd82f238 100644 --- a/libavfilter/vf_mix.c +++ b/libavfilter/vf_mix.c @@ -125,7 +125,7 @@ static av_cold int init(AVFilterContext *ctx) if (!pad.name) return AVERROR(ENOMEM); - if ((ret = ff_insert_inpad(ctx, i, &pad)) < 0) { + if ((ret = ff_append_inpad(ctx, &pad)) < 0) { av_freep(&pad.name); return ret; } diff --git a/libavfilter/vf_premultiply.c b/libavfilter/vf_premultiply.c index bc8e080e4c..95eabf3883 100644 --- a/libavfilter/vf_premultiply.c +++ b/libavfilter/vf_premultiply.c @@ -790,7 +790,7 @@ static av_cold int init(AVFilterContext *ctx) pad.name = "main"; pad.config_props = config_input; - if ((ret = ff_insert_inpad(ctx, 0, &pad)) < 0) + if ((ret = ff_append_inpad(ctx, &pad)) < 0) return ret; if (!s->inplace) { @@ -798,7 +798,7 @@ static av_cold int init(AVFilterContext *ctx) pad.name = "alpha"; pad.config_props = NULL; - if ((ret = ff_insert_inpad(ctx, 1, &pad)) < 0) + if ((ret = ff_append_inpad(ctx, &pad)) < 0) return ret; } diff --git a/libavfilter/vf_program_opencl.c b/libavfilter/vf_program_opencl.c index 5f455e9afa..502d797154 100644 --- a/libavfilter/vf_program_opencl.c +++ b/libavfilter/vf_program_opencl.c @@ -287,7 +287,7 @@ static av_cold int program_opencl_init(AVFilterContext *avctx) input.config_props = &ff_opencl_filter_config_input; - err = ff_insert_inpad(avctx, i, &input); + err = ff_append_inpad(avctx, &input); if (err < 0) { av_freep(&input.name); return err; diff --git a/libavfilter/vf_signature.c b/libavfilter/vf_signature.c index 69930e9f02..2e9d6e177a 100644 --- a/libavfilter/vf_signature.c +++ b/libavfilter/vf_signature.c @@ -664,7 +664,7 @@ static av_cold int init(AVFilterContext *ctx) if (!pad.name) return AVERROR(ENOMEM); - if ((ret = ff_insert_inpad(ctx, i, &pad)) < 0) { + if ((ret = ff_append_inpad(ctx, &pad)) < 0) { av_freep(&pad.name); return ret; } diff --git a/libavfilter/vf_stack.c b/libavfilter/vf_stack.c index 38e5aa098b..48f3e4fbfd 100644 --- a/libavfilter/vf_stack.c +++ b/libavfilter/vf_stack.c @@ -123,7 +123,7 @@ static av_cold int init(AVFilterContext *ctx) if (!pad.name) return AVERROR(ENOMEM); - if ((ret = ff_insert_inpad(ctx, i, &pad)) < 0) { + if ((ret = ff_append_inpad(ctx, &pad)) < 0) { av_freep(&pad.name); return ret; } diff --git a/libavfilter/vf_xmedian.c b/libavfilter/vf_xmedian.c index fa131a7259..ab09161879 100644 --- a/libavfilter/vf_xmedian.c +++ b/libavfilter/vf_xmedian.c @@ -118,7 +118,7 @@ static av_cold int init(AVFilterContext *ctx) if (!pad.name) return AVERROR(ENOMEM); - if ((ret = ff_insert_inpad(ctx, i, &pad)) < 0) { + if ((ret = ff_append_inpad(ctx, &pad)) < 0) { av_freep(&pad.name); return ret; }