[FFmpeg-cvslog] r24385 - trunk/libavfilter/vsrc_buffer.c

stefano subversion
Wed Jul 21 19:14:13 CEST 2010


Author: stefano
Date: Wed Jul 21 19:14:13 2010
New Revision: 24385

Log:
Clarify logic and feedback of the init() function.

Modified:
   trunk/libavfilter/vsrc_buffer.c

Modified: trunk/libavfilter/vsrc_buffer.c
==============================================================================
--- trunk/libavfilter/vsrc_buffer.c	Wed Jul 21 19:14:08 2010	(r24384)
+++ trunk/libavfilter/vsrc_buffer.c	Wed Jul 21 19:14:13 2010	(r24385)
@@ -62,12 +62,14 @@ int av_vsrc_buffer_add_frame(AVFilterCon
 static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
 {
     BufferSourceContext *c = ctx->priv;
+    int n = 0;
 
-    if (args && sscanf(args, "%d:%d:%d", &c->w, &c->h, &c->pix_fmt) == 3)
-        return 0;
+    if (!args || (n = sscanf(args, "%d:%d:%d", &c->w, &c->h, &c->pix_fmt)) != 3) {
+        av_log(ctx, AV_LOG_ERROR, "Expected 3 arguments, but only %d found in '%s'\n", n, args ? args : "");
+        return AVERROR(EINVAL);
+    }
 
-    av_log(ctx, AV_LOG_ERROR, "init() expected 3 arguments:'%s'\n", args);
-    return -1;
+    return 0;
 }
 
 static int query_formats(AVFilterContext *ctx)



More information about the ffmpeg-cvslog mailing list