From 4ea7c179325f61736040f2ff22c2f27c702727d4 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Wed, 2 Jan 2013 11:17:07 +0100 Subject: lavfi/yadif: fail during the configuration stage in case of invalid video size This is better than repeatedly failing during the filtering stage. --- libavfilter/vf_yadif.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'libavfilter/vf_yadif.c') diff --git a/libavfilter/vf_yadif.c b/libavfilter/vf_yadif.c index 061b9732a9..ed2ffd5968 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; } -- cgit v1.2.3