[FFmpeg-cvslog] r32368 - in trunk/libswscale: swscale.h utils.c
Ramiro Polla
ramiro.polla
Sun Sep 26 22:27:46 CEST 2010
On Sun, Sep 26, 2010 at 4:33 PM, michael <subversion at mplayerhq.hu> wrote:
[...]
> ?/**
> + * 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);
Also SwsContext is still opaque to the user. This is good because it
hides the internals of SwsContext to the user which gives us more
flexibility to work on swscale, but it's harder for the user to use
(as in he has to go through AVOptions). I suggest something like this
in swscale.h:
struct SwsContext {
const AVClass *av_class;
void *opaque; /* for swscale's internal use */
int src_w;
int src_h;
int dst_w;
int dst_h;
enum PixelFormat src_pix_fmt;
enum PixelFormat dst_pix_fmt;
enum ScalingAlgorithm algo;
SwsFilter *src_filter;
SwsFilter *dst_filter;
const double *param;
int cpu_accel; /* not necessary if we decide to remove
user-specified runtime cpu detection */
int flags; /* bitexact, accurate_rnd, print_info, full_chroma_inp,
full_chroma_int */
/* possibly other options, like chroma drop which is not part of
AVOptions */
};
so the user can do
ctx = sws_alloc_context();
ctx->(src_w|src_h|dst_w|dst_h) = <...>;
ctx->(src_pix_fmt|dst_pix_fmt) = <...>;
ctx->algo = SWS_BILINEAR;
sws_init_context(ctx);
This also leads to the benefit that there's no need to specify
srcFilter, dstFilter or param if one doesn't want it. The user can
also avoid setting ctx->algo if it's unscaled.
More information about the ffmpeg-cvslog
mailing list