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

Stefano Sabatini stefano.sabatini-lala
Tue Jul 20 23:43:30 CEST 2010


On date Tuesday 2010-07-20 22:39:41 +0200, V?ctor Paesa encoded:
> Hi,
> 
> On Tue, Jul 20, 2010 at 19:50, Stefano Sabatini
> <stefano.sabatini-lala at poste.it> wrote:
> > On date Tuesday 2010-07-20 13:59:58 +0200, Michael Niedermayer encoded:
> >> 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 ?
> >
> > Fixed.
> 
> To avoid the comma splice, and shorten the sentence a bit, I would write:
> "Expected 3 arguments, but only %d found in '%s'\n"

Yes, much better, updated.
-- 
FFmpeg = Fierce and Fiendish Mythic Perennial Entertaining Guide



More information about the ffmpeg-devel mailing list