[FFmpeg-devel] [PATCH] lavfi/yadif: fail during the configuration stage in case of invalid video size
Stefano Sabatini
stefasab at gmail.com
Wed Jan 2 17:20:45 CET 2013
This is better than repeatedly failing during the filtering stage.
---
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;
}
--
1.7.9.5
More information about the ffmpeg-devel
mailing list