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
Unified · Split
| @@ -47,6 +47,27 @@ void avfilter_unref_pic(AVFilterPicRef *ref) · 46 unmodified lines | ||
| 47 | 47 | av_free(ref); |
| 48 | 48 | } |
| 49 | 49 | |
| 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 | + | |
| 50 | 71 | int avfilter_link(AVFilterContext *src, unsigned srcpad, |
| 51 | 72 | AVFilterContext *dst, unsigned dstpad) |
| 52 | 73 | { |