summaryrefslogtreecommitdiff
path: root/libavfilter/avfilter.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavfilter/avfilter.c')
-rw-r--r--libavfilter/avfilter.c15
1 files changed, 4 insertions, 11 deletions
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;
-
- idx = FFMIN(idx, *count);
+ unsigned 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;
}