]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/defaults.c
Remove last MAX_STREAMS from avienc.c
[ffmpeg] / libavfilter / defaults.c
index da635456c7b3b935c617061fae5f59310d99e148..7e02ea849db57ea513b3db78bf140b03b3ca11a0 100644 (file)
@@ -29,14 +29,10 @@ void avfilter_default_free_video_buffer(AVFilterPic *pic)
     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));
@@ -44,8 +40,8 @@ AVFilterPicRef *avfilter_default_get_video_buffer(AVFilterLink *link, int perms)
     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;
@@ -56,7 +52,7 @@ AVFilterPicRef *avfilter_default_get_video_buffer(AVFilterLink *link, int perms)
     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);
@@ -76,12 +72,23 @@ void avfilter_default_start_frame(AVFilterLink *link, AVFilterPicRef *picref)
         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;