[FFmpeg-cvslog] lavfi/yadif: fail during the configuration stage in case of invalid video size

Stefano Sabatini git at videolan.org
Fri Jan 4 11:52:02 CET 2013


ffmpeg | branch: master | Stefano Sabatini <stefasab at gmail.com> | Wed Jan  2 11:17:07 2013 +0100| [4ea7c179325f61736040f2ff22c2f27c702727d4] | committer: Stefano Sabatini

lavfi/yadif: fail during the configuration stage in case of invalid video size

This is better than repeatedly failing during the filtering stage.

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

 libavfilter/vf_yadif.c |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/libavfilter/vf_yadif.c b/libavfilter/vf_yadif.c
index 061b973..ed2ffd5 100644
--- a/libavfilter/vf_yadif.c
+++ b/libavfilter/vf_yadif.c
@@ -219,11 +219,6 @@ static int filter_frame(AVFilterLink *link, AVFilterBufferRef *picref)
 
     av_assert0(picref);
 
-    if (picref->video->h < 3 || picref->video->w < 3) {
-        av_log(ctx, AV_LOG_ERROR, "Video of less than 3 columns or lines is not supported\n");
-        return AVERROR(EINVAL);
-    }
-
     if (yadif->frame_pending)
         return_frame(ctx, 1);
 
@@ -369,7 +364,8 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
 
 static int config_props(AVFilterLink *link)
 {
-    YADIFContext *yadif = link->src->priv;
+    AVFilterContext *ctx = link->src;
+    YADIFContext *yadif = ctx->priv;
 
     link->time_base.num = link->src->inputs[0]->time_base.num;
     link->time_base.den = link->src->inputs[0]->time_base.den * 2;
@@ -379,6 +375,11 @@ static int config_props(AVFilterLink *link)
     if(yadif->mode&1)
         link->frame_rate = av_mul_q(link->src->inputs[0]->frame_rate, (AVRational){2,1});
 
+    if (link->w < 3 || link->h < 3) {
+        av_log(ctx, AV_LOG_ERROR, "Video of less than 3 columns or lines is not supported\n");
+        return AVERROR(EINVAL);
+    }
+
     return 0;
 }
 



More information about the ffmpeg-cvslog mailing list