[FFmpeg-cvslog] r32368 - in trunk/libswscale: swscale.h utils.c

Aurelien Jacobs aurel
Sun Sep 26 23:06:42 CEST 2010


On Sun, Sep 26, 2010 at 05:00:40PM -0300, Ramiro Polla wrote:
> On Sun, Sep 26, 2010 at 4:33 PM, michael <subversion at mplayerhq.hu> wrote:
> > Author: michael
> > Date: Sun Sep 26 21:33:57 2010
> > New Revision: 32368
> >
> > Log:
> > Split alloc and init of context so that parameters can be set in the context
> > instead of requireing being passed through function parameters. This also
> > makes sws work with AVOptions.
> 
> Thanks
> 
> > Modified:
> > ? trunk/libswscale/swscale.h
> > ? trunk/libswscale/utils.c
> >
> > Modified: trunk/libswscale/swscale.h
> > ==============================================================================
> > --- trunk/libswscale/swscale.h ?Sun Sep 26 21:33:48 2010 ? ? ? ?(r32367)
> > +++ trunk/libswscale/swscale.h ?Sun Sep 26 21:33:57 2010 ? ? ? ?(r32368)
> > @@ -144,6 +144,17 @@ int sws_isSupportedInput(enum PixelForma
> > ?int sws_isSupportedOutput(enum PixelFormat pix_fmt);
> >
> > ?/**
> > + * Alloctaes an empty SwsContext, this must be filled and passed to sws_init_context().
> > + * For filling see AVOptions, options.c and sws_setColorspaceDetails().
> > + */
> > +struct SwsContext *sws_alloc_context(void);
> > +
> > +/**
> > + * Initializs the swscaler context sws_context.
> > + */
> > +int sws_init_context(struct SwsContext *sws_context, SwsFilter *srcFilter, SwsFilter *dstFilter);

What about taking this opportunity to use hierarchical names instead ?
  sws_context_alloc
  sws_context_init
I think it's not too late.

> One thing that particularly bothers me are the filters and params
> being part of the arguments in the function call to initialize a
> context. I haven't checked extensively, but almost no one uses them
> (except for mplayer), which leads to an extra "NULL, NULL, NULL" to a
> bunch of code.

We could use this new API opportunity to also introduce those functions?

SwsContext *sws_context_get_full(int src_w, int src_h, enum PixelFormat src_format,
                                 int dst_w, int dst_h, enum PixelFormat dst_format,
                                 int flags,
                                 SwsFilter *src_filter, SwsFilter
                                 *dst_filter,
                                 const double *param)
{
    ...
}

SwsContext *sws_context_get(int src_w, int src_h, enum PixelFormat src_format,
                            int dst_w, int dst_h, enum PixelFormat dst_format,
                            int flags)
{
    return sws_context_get_full(src_w, src_h, src_format,
                                dst_w, dst_h, dst_format, flags,
                                NULL, NULL, NULL);
}

Aurel



More information about the ffmpeg-cvslog mailing list