av_free(pic);
}
-#define ALIGN(a) do{ \
- (a) = ((a) + 15) & (~15); \
- } while(0);
-
/* TODO: set the buffer's priv member to a context structure for the whole
* filter chain. This will allow for a buffer pool instead of the constant
* alloc & free cycle currently implemented. */
-AVFilterPicRef *avfilter_default_get_video_buffer(AVFilterLink *link, int perms)
+AVFilterPicRef *avfilter_default_get_video_buffer(AVFilterLink *link, int perms, int w, int h)
{
AVFilterPic *pic = av_mallocz(sizeof(AVFilterPic));
AVFilterPicRef *ref = av_mallocz(sizeof(AVFilterPicRef));
char *buf;
ref->pic = pic;
- ref->w = link->w;
- ref->h = link->h;
+ ref->w = pic->w = w;
+ ref->h = pic->h = h;
/* make sure the buffer gets read permission or it's useless for output */
ref->perms = perms | AV_PERM_READ;
ff_fill_linesize((AVPicture *)pic, pic->format, ref->w);
for (i=0; i<4;i++)
- ALIGN(pic->linesize[i]);
+ pic->linesize[i] = FFALIGN(pic->linesize[i], 16);
tempsize = ff_fill_pointer((AVPicture *)pic, NULL, pic->format, ref->h);
buf = av_malloc(tempsize);
out = link->dst->outputs[0];
if(out) {
- out->outpic = avfilter_get_video_buffer(out, AV_PERM_WRITE);
+ out->outpic = avfilter_get_video_buffer(out, AV_PERM_WRITE, out->w, out->h);
out->outpic->pts = picref->pts;
avfilter_start_frame(out, avfilter_ref_pic(out->outpic, ~0));
}
}
+void avfilter_default_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
+{
+ AVFilterLink *out = NULL;
+
+ if(link->dst->output_count)
+ out = link->dst->outputs[0];
+
+ if(out)
+ avfilter_draw_slice(out, y, h, slice_dir);
+}
+
void avfilter_default_end_frame(AVFilterLink *link)
{
AVFilterLink *out = NULL;