[FFmpeg-devel] [PATCH 4/6] Clarify logic and feedback of the init() function.
Stefano Sabatini
stefano.sabatini-lala
Tue Jul 20 02:12:03 CEST 2010
---
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 3d53bee..8809589 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, only %d found in the provided arguments '%s'\n", n, 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)
--
1.6.0.4
More information about the ffmpeg-devel
mailing list