Skip to content
Snippets Groups Projects
Commit 24618441 authored by Vitor Sessak's avatar Vitor Sessak
Browse files

Helper functions for adding new pads to filters at runtime

Commited in SoC by Bobby Bingham on 2007-08-07 22:31:56

Originally committed as revision 11999 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 01942f1d
No related branches found
No related tags found
No related merge requests found
...@@ -47,6 +47,27 @@ void avfilter_unref_pic(AVFilterPicRef *ref) ...@@ -47,6 +47,27 @@ void avfilter_unref_pic(AVFilterPicRef *ref)
av_free(ref); av_free(ref);
} }
void avfilter_insert_pad(unsigned idx, unsigned *count, size_t padidx_off,
AVFilterPad **pads, AVFilterLink ***links,
AVFilterPad *newpad)
{
unsigned i;
idx = FFMIN(idx, *count);
*pads = av_realloc(*pads, sizeof(AVFilterPad) * (*count + 1));
*links = av_realloc(*links, sizeof(AVFilterLink*) * (*count + 1));
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)) ++;
}
int avfilter_link(AVFilterContext *src, unsigned srcpad, int avfilter_link(AVFilterContext *src, unsigned srcpad,
AVFilterContext *dst, unsigned dstpad) AVFilterContext *dst, unsigned dstpad)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment