]> git.sesse.net Git - ffmpeg/commitdiff
lavfi/aspect: fail with AVERROR(EINVAL) in case of invalid specified aspect
authorStefano Sabatini <stefasab@gmail.com>
Mon, 19 Mar 2012 19:06:06 +0000 (20:06 +0100)
committerStefano Sabatini <stefasab@gmail.com>
Mon, 19 Mar 2012 19:09:22 +0000 (20:09 +0100)
Previously it was returning 0 in case the aspect was parsable but
invalid.

X-ColaCount: +10*PHIl

libavfilter/vf_aspect.c

index 89eaf5f18914058cca852c2d1819c3c42a228cf3..9e3b93b28daae1c9c63eb201819e88bb368a262d 100644 (file)
@@ -34,15 +34,14 @@ typedef struct {
 static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
 {
     AspectContext *aspect = ctx->priv;
-    int ret;
     aspect->ratio = (AVRational) {0, 1};
 
     if (args) {
-        if ((ret = av_parse_ratio(&aspect->ratio, args, 100, 0, ctx)) < 0 ||
+        if (av_parse_ratio(&aspect->ratio, args, 100, 0, ctx) ||
             aspect->ratio.num < 0 || aspect->ratio.den <= 0) {
             av_log(ctx, AV_LOG_ERROR,
                    "Invalid string '%s' for aspect ratio.\n", args);
-            return ret;
+            return AVERROR(EINVAL);
         }
     }