[FFmpeg-devel] [PATCH 4/6] Clarify logic and feedback of the init() function.

Michael Niedermayer michaelni
Tue Jul 20 13:59:58 CEST 2010


On Tue, Jul 20, 2010 at 02:12:03AM +0200, Stefano Sabatini wrote:
> ---
>  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;
>  }

args== NULL ?

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Dictatorship naturally arises out of democracy, and the most aggravated
form of tyranny and slavery out of the most extreme liberty. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100720/835c6628/attachment.pgp>



More information about the ffmpeg-devel mailing list