[FFmpeg-cvslog] lavfi/blend: use correct way to check number of planes

Paul B Mahol git at videolan.org
Thu May 2 14:22:54 CEST 2013


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Thu May  2 12:09:28 2013 +0000| [990b13806d38f51201afb4e5048c61bf3e1c576e] | committer: Paul B Mahol

lavfi/blend: use correct way to check number of planes

This fix crash with gray, as its marked as pseudopal,
and thus have extra plane.

Signed-off-by: Paul B Mahol <onemda at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=990b13806d38f51201afb4e5048c61bf3e1c576e
---

 libavfilter/vf_blend.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavfilter/vf_blend.c b/libavfilter/vf_blend.c
index 93b68be..17b168d 100644
--- a/libavfilter/vf_blend.c
+++ b/libavfilter/vf_blend.c
@@ -80,6 +80,7 @@ typedef struct {
     struct FFBufQueue queue_top;
     struct FFBufQueue queue_bottom;
     int hsub, vsub;             ///< chroma subsampling values
+    int nb_planes;
     int frame_requested;
     char *all_expr;
     enum BlendMode all_mode;
@@ -330,6 +331,7 @@ static int config_input_top(AVFilterLink *inlink)
 
     b->hsub = pix_desc->log2_chroma_w;
     b->vsub = pix_desc->log2_chroma_h;
+    b->nb_planes = av_pix_fmt_count_planes(inlink->format);
     return 0;
 }
 
@@ -371,7 +373,7 @@ static void blend_frame(AVFilterContext *ctx,
     FilterParams *param;
     int plane;
 
-    for (plane = 0; dst_buf->data[plane]; plane++) {
+    for (plane = 0; plane < b->nb_planes; plane++) {
         int hsub = plane == 1 || plane == 2 ? b->hsub : 0;
         int vsub = plane == 1 || plane == 2 ? b->vsub : 0;
         int outw = dst_buf->width  >> hsub;
@@ -422,7 +424,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
 
         b->frame_requested = 0;
         blend_frame(ctx, top_buf, bottom_buf, out_buf);
-        ret = ff_filter_frame(ctx->outputs[0], out_buf);
+        ret = ff_filter_frame(outlink, out_buf);
         av_frame_free(&top_buf);
         av_frame_free(&bottom_buf);
     }



More information about the ffmpeg-cvslog mailing list