History

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

Vitor Sessak committed 18 years ago

Commit 24618441 parent 01942f11 file · +21 −0Browse files

Showing the changes to libavfilter/avfilter.c (1 of 1 file). Show all

Unified · Split

libavfilter/avfilter.c+21−0
@@ -47,6 +47,27 @@ void avfilter_unref_pic(AVFilterPicRef *ref) · 46 unmodified lines
4747 av_free(ref);
4848 }
4949
50+void avfilter_insert_pad(unsigned idx, unsigned *count, size_t padidx_off,
51+ AVFilterPad **pads, AVFilterLink ***links,
52+ AVFilterPad *newpad)
53+{
54+ unsigned i;
55+
56+ idx = FFMIN(idx, *count);
57+
58+ *pads = av_realloc(*pads, sizeof(AVFilterPad) * (*count + 1));
59+ *links = av_realloc(*links, sizeof(AVFilterLink*) * (*count + 1));
60+ memmove(*pads +idx+1, *pads +idx, sizeof(AVFilterPad) * (*count-idx));
61+ memmove(*links+idx+1, *links+idx, sizeof(AVFilterLink*) * (*count-idx));
62+ memcpy(*pads+idx, newpad, sizeof(AVFilterPad));
63+ (*links)[idx] = NULL;
64+
65+ (*count) ++;
66+ for(i = idx+1; i < *count; i ++)
67+ if(*links[i])
68+ (*(unsigned *)((uint8_t *)(*links[i]) + padidx_off)) ++;
69+}
70+
5071 int avfilter_link(AVFilterContext *src, unsigned srcpad,
5172 AVFilterContext *dst, unsigned dstpad)
5273 {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t