Logo Search packages:      
Sourcecode: ffmpeg version File versions  Download package

struct SwsContext* sws_getCachedContext ( struct SwsContext *  context,
int  srcW,
int  srcH,
enum PixelFormat  srcFormat,
int  dstW,
int  dstH,
enum PixelFormat  dstFormat,
int  flags,
SwsFilter *  srcFilter,
SwsFilter *  dstFilter,
double *  param 
) [read]

Checks if context can be reused, otherwise reallocates a new one.

If context is NULL, just calls sws_getContext() to get a new context. Otherwise, checks if the parameters are the ones already saved in context. If that is the case, returns the current context. Otherwise, frees context and gets a new context with the new parameters.

Be warned that srcFilter and dstFilter are not checked, they are assumed to remain the same.

Definition at line 3169 of file swscale.c.

{
    static const double default_param[2] = {SWS_PARAM_DEFAULT, SWS_PARAM_DEFAULT};

    if (!param)
        param = default_param;

    if (context) {
        if (context->srcW != srcW || context->srcH != srcH ||
            context->srcFormat != srcFormat ||
            context->dstW != dstW || context->dstH != dstH ||
            context->dstFormat != dstFormat || context->flags != flags ||
            context->param[0] != param[0] || context->param[1] != param[1])
        {
            sws_freeContext(context);
            context = NULL;
        }
    }
    if (!context) {
        return sws_getContext(srcW, srcH, srcFormat,
                              dstW, dstH, dstFormat, flags,
                              srcFilter, dstFilter, param);
    }
    return context;
}


Generated by  Doxygen 1.6.0   Back to index