[FFmpeg-devel] [PATCH 2/2] Deprecate sws_getContext(), use sws_alloc_context() and sws_init_context() instead.
Stefano Sabatini
stefano.sabatini-lala
Tue Sep 28 18:43:41 CEST 2010
On date Tuesday 2010-09-28 18:38:41 +0200, Stefano Sabatini encoded:
> ---
> swscale.h | 11 +++++++++++
> utils.c | 16 +++++++++++++---
> 2 files changed, 24 insertions(+), 3 deletions(-)
>
> diff --git a/utils.c b/utils.c
> index c817a4d..826547d 100644
> --- a/utils.c
> +++ b/utils.c
[...]
> @@ -1564,9 +1566,17 @@ struct SwsContext *sws_getCachedContext(struct SwsContext *context,
> }
>
> if (!context) {
> - return sws_getContext(srcW, srcH, srcFormat,
> - dstW, dstH, dstFormat, flags,
> - srcFilter, dstFilter, param);
> + if (!(context = sws_alloc_context()))
> + return NULL;
> + context->srcW = srcW;
> + context->srcH = srcH;
> + context->srcFormat = srcFormat;
> + context->dstFormat = dstFormat;
> + context->flags = flags;
> + context->param[0] = param[0];
> + context->param[1] = param[1];
> + if (sws_init_context(context, srcFilter, dstFilter) < 0)
> + return NULL;
> }
> return context;
Fixed leak, updated.
--
FFmpeg = Fundamentalist and Formidable Marvellous Practical Ecumenical Guru
More information about the ffmpeg-devel
mailing list