diff options
author | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2010-07-21 17:14:13 +0000 |
---|---|---|
committer | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2010-07-21 17:14:13 +0000 |
commit | b8dddebf3e341631d02328144e8dd9e75091fc69 (patch) | |
tree | 6fa9bb0c5e1a555a144a5b3e8fa4069f566ad7d3 /libavfilter | |
parent | ce1f85362587d6121665e77c73271073d4ef9607 (diff) |
Clarify logic and feedback of the init() function.
Originally committed as revision 24385 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavfilter')
-rw-r--r-- | libavfilter/vsrc_buffer.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/libavfilter/vsrc_buffer.c b/libavfilter/vsrc_buffer.c index d6b0b40616..c48f04af58 100644 --- a/libavfilter/vsrc_buffer.c +++ b/libavfilter/vsrc_buffer.c @@ -62,12 +62,14 @@ int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame, 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) |